/**
  * Parses the capabilities document for the WFS 
  * version number and returns it.
  * 
  * @return String
  * @param $xml String
  */
 private function getVersionFromXml($xml)
 {
     $admin = new administration();
     $values = $admin->parseXml($xml);
     foreach ($values as $element) {
         if ($this->sepNameSpace(strtoupper($element[tag])) == "WFS_CAPABILITIES" && $element[type] == "open") {
             return $element[attributes][version];
         }
     }
     throw new Exception("WFS version could not be determined from XML.");
 }
 private function readConfig($jsonConfFile)
 {
     $admin = new administration();
     $mbjson = new Mapbender_JSON();
     $jsonStr = file_get_contents(dirname(__FILE__) . "/../" . $jsonConfFile);
     if ($jsonStr == false) {
         $e = new mb_exception("mbPdfFactory: config file could not be read.");
         die("config not found.");
     }
     $jsonConf = $mbjson->decode($admin->char_encode($jsonStr));
     return $jsonConf;
 }
function getWfsConfData($wfsID)
{
    global $con;
    // re-check permission
    $adm = new administration();
    $serviceList = $adm->getWfsByOwner(Mapbender::session()->get("mb_user_id"));
    if (in_array($wfsID, $serviceList)) {
        $wfsConf = array();
        $wfsConf['id'] = array();
        $wfsConf['abstract'] = array();
        $sql = "SELECT * FROM wfs_conf WHERE fkey_wfs_id = \$1 ORDER BY wfs_conf_abstract";
        $v = array($wfsID);
        $t = array('i');
        $res = db_prep_query($sql, $v, $t);
        $cnt = 0;
        while ($row = db_fetch_array($res)) {
            array_push($wfsConf['id'], $row['wfs_conf_id']);
            array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
            $cnt++;
        }
        if ($cnt == 0) {
            return false;
        } else {
            return $wfsConf;
        }
    }
    //	else if($wfsID==="gui_confs"){
    //		$wfsConf = array();
    //		$wfsConf['id'] = array();
    //		$wfsConf['abstract'] = array();
    //		$wfsConf['id'] = $adm->getWfsConfByPermission(Mapbender::session()->get("mb_user_id"));
    //		$cnt = 0;
    //		foreach($wfsConf['id'] as $wfscid){
    //			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
    //			$v = array($wfscid);
    //			$t = array('i');
    //			$res = db_prep_query($sql,$v,$t);
    //			while($row = db_fetch_array($res)){
    //				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
    //			}
    //			$cnt++;
    //		}
    //		if($cnt == 0){
    //			return false;
    //		}
    //		else{
    //			return $wfsConf;
    //		}
    //	}
}
Esempio n. 4
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('reception/reception_model');
     $this->load->model('reports_model');
     $this->load->model('accounts/accounts_model');
 }
function forgotten_password()
{
    if (!isset($_REQUEST["Benutzername"]) || !isset($_REQUEST["EMail"]) || $_REQUEST["Benutzername"] == 'guest' || empty($_REQUEST["Benutzername"]) || empty($_REQUEST["EMail"]) || !(bool) trim($_REQUEST["Benutzername"]) || !(bool) trim($_REQUEST["EMail"])) {
        return -1;
    }
    if (!USE_PHP_MAILING) {
        return -4;
    }
    $administration = new administration();
    define("USER_NAME", trim($_REQUEST["Benutzername"]));
    define("USER_EMAIL", trim($_REQUEST["EMail"]));
    if (!$administration->getUserIdByUserName(USER_NAME) || USER_EMAIL != $administration->getEmailByUserId($administration->getUserIdByUserName(USER_NAME))) {
        return -2;
    }
    $new_password = $administration->getRandomPassword();
    $sql_update = "UPDATE mb_user SET mb_user_password = \$1, mb_user_digest = \$3 WHERE mb_user_id = \$2";
    $v = array(md5($new_password), $administration->getUserIdByUserName(USER_NAME), md5(USER_NAME . ";" . USER_EMAIL . ":" . REALM . ":" . $new_password));
    $t = array("s", "i");
    if (!db_prep_query($sql_update, $v, $t)) {
        return -3;
    }
    $email_subject = "New GeoPortal.rlp Password";
    $email_body = sprintf("Your new GeoPortal.rlp password is: %s", $new_password);
    if (!$administration->sendEmail(NULL, NULL, USER_EMAIL, USER_NAME, $email_subject, $email_body, $error_msg)) {
        return -4;
    }
    return 1;
}
Esempio n. 6
0
 public function __construct()
 {
     parent::__construct();
     $version = administration::getCurrentVersion();
     require '_upgrade.php';
 }
	//new for showing metadata - 30.05.2008 AR
	document.getElementById("metadatalink").href = "mod_layerMetadata.php?id="+wmsData[2];
	document.getElementById("metadatatext").firstChild.nodeValue = "WMS-ID: "+wmsData[0];
	//end ***
	
}
</script>
</head>
<body>
<form name='form1' action='<?php 
echo $self;
?>
' method='POST'>
<?php 
require_once dirname(__FILE__) . "/../classes/class_administration.php";
$admin = new administration();
$ownguis = $admin->getGuisByOwner(Mapbender::session()->get("mb_user_id"), true);
$permguis = $admin->getGuisByPermission(Mapbender::session()->get("mb_user_id"), true);
$wms_id_own = $admin->getWmsByOwnGuis($ownguis);
if (count($wms_id_own) > 0 and count($ownguis) > 0 and count($permguis) > 0) {
    $v = array();
    $t = array();
    $c = 1;
    //$sql = "SELECT wms_id, wms_title, wms_getcapabilities, wms_upload_url  FROM wms ";
    $sql = "SELECT wms.wms_id, wms.wms_title, wms.wms_getcapabilities, wms.wms_upload_url, layer.layer_id  FROM wms, layer ";
    $sql .= "WHERE wms_id IN(";
    for ($i = 0; $i < count($wms_id_own); $i++) {
        if ($wms_id_own[$i] != '') {
            if ($i > 0) {
                $sql .= ",";
            }
			document.form1.insert.value = 'true';
			document.form1.submit();
		}
	}
}
</script>
</head>
<body>
<?php 
$fieldHeight = 20;
$language_suffix = "en";
//FIXME: there seems to be an error in dyn_css.php concerning php vars.
if ($language == "'de'") {
    $language_suffix = "de";
}
$admin = new administration();
$own_gui_id_array = $admin->getGuisByOwner($logged_user_id, true);
$own_wms_id_array = array();
$sql = "SELECT wms_id FROM wms WHERE wms_owner = \$1";
$v = array($logged_user_id);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
    array_push($own_wms_id_array, $row['wms_id']);
}
$own_layer_id_array = $admin->getLayerByWms($selected_wms);
/*handle remove, update and insert*****************************************************************/
if ($insert) {
    if (count($selected_topic) > 0) {
        for ($i = 0; $i < count($selected_topic); $i++) {
            $exists = false;
 /**
  * Creates WFS 1.0 objects from a capabilities documents.
  * 
  * @return Wfs_1_0
  * @param $xml String
  */
 public function createFromXml($xml)
 {
     try {
         $myWfs = new Wfs_1_0();
         $admin = new administration();
         $values = $admin->parseXml($xml);
         $myWfs->getCapabilitiesDoc = $admin->char_encode($xml);
         $myWfs->id = $this->createId();
         foreach ($values as $element) {
             $tag = strtoupper($element[tag]);
             if ($tag == "WFS_CAPABILITIES" && $element[type] == "open") {
                 $myWfs->version = $element[attributes][version];
                 if ($myWfs->version !== "1.0.0") {
                     throw new Exception("Not a WFS 1.0.0 capabilities document.");
                 }
             }
             if ($tag == "NAME" && $element[level] == '3') {
                 $myWfs->name = $element[value];
             }
             if ($tag == "TITLE" && $element[level] == '3') {
                 $myWfs->title = $this->stripEndlineAndCarriageReturn($element[value]);
             }
             if ($tag == "ABSTRACT" && $element[level] == '3') {
                 $myWfs->summary = $this->stripEndlineAndCarriageReturn($element[value]);
             }
             if ($tag == "FEES") {
                 $myWfs->fees = $element[value];
             }
             if ($tag == "ACCESSCONSTRAINTS") {
                 $myWfs->accessconstraints = $element[value];
             }
             # getCapabilities
             if ($tag == "GETCAPABILITIES" && $element[type] == "open") {
                 $section = "getcapabilities";
             }
             if ($section == "getcapabilities" && $tag == "GET") {
                 $myWfs->getCapabilities = $element[attributes][onlineResource];
             }
             # descriptFeatureType
             if ($tag == "DESCRIBEFEATURETYPE" && $element[type] == "open") {
                 $section = "describefeaturetype";
                 $myWfs->describeFeatureType = $element[attributes][onlineResource];
             }
             if ($section == "describefeaturetype" && $tag == "POST") {
                 $myWfs->describeFeatureType = $element[attributes][onlineResource];
             }
             # getFeature
             if ($tag == "GETFEATURE" && $element[type] == "open") {
                 $section = "getfeature";
             }
             if ($section == "getfeature" && $tag == "POST") {
                 $myWfs->getFeature = $element[attributes][onlineResource];
             }
             if ($tag == "GETFEATURE" && $element[type] == "close") {
                 $section = "";
             }
             # transaction
             if ($tag == "TRANSACTION" && $element[type] == "open") {
                 $section = "transaction";
             }
             if ($section == "transaction" && $tag == "POST") {
                 $myWfs->transaction = $element[attributes][onlineResource];
             }
             if ($tag == "TRANSACTION" && $element[type] == "close") {
                 $section = "";
             }
             if ($tag == "FEATURETYPE" && $element[type] == "open") {
                 $section = "featuretype";
             }
             if ($section == "featuretype" && $tag == "NAME") {
                 $featuretype_name = $element[value];
             }
             if ($section == "featuretype" && $tag == "TITLE") {
                 $featuretype_title = $this->stripEndlineAndCarriageReturn($element[value]);
             }
             if ($section == "featuretype" && $tag == "ABSTRACT") {
                 $featuretype_abstract = $element[value];
             }
             if ($section == "featuretype" && $tag == "SRS") {
                 $featuretype_srs = $element[value];
                 // Do not add defective featuretypes
                 try {
                     $currentFeatureType = $this->createFeatureTypeFromUrl($myWfs, $featuretype_name);
                     if ($currentFeatureType !== null) {
                         $currentFeatureType->name = $featuretype_name;
                         $currentFeatureType->title = $featuretype_title;
                         $currentFeatureType->summary = $featuretype_abstract;
                         $currentFeatureType->srs = $featuretype_srs;
                         $myWfs->addFeatureType($currentFeatureType);
                     }
                 } catch (Exception $e) {
                     new mb_exception("Failed to load featuretype " . $featuretype_name);
                 }
             }
         }
         return $myWfs;
     } catch (Exception $e) {
         $e = new mb_exception($e);
         return null;
     }
 }
 /**
 * updateObjFromXML
 *
 * this function regets the information from the xml (update)
 * @return boolean true if successful, false otherwise
 */
 function updateObjFromXML($url)
 {
     $x = new connector($url);
     $data = $x->file;
     #$data = implode("",file($url));
     if (!$data) {
         $e = new mb_exception("Unable to open document: " . $url);
         return false;
     }
     $values = null;
     $tags = null;
     $admin = new administration();
     $this->wfs_getcapabilities_doc = $admin->char_encode($data);
     $this->wfs_featuretype = array();
     $this->wfs_upload_url = $url;
     # for temporary wfs a id has to be created...
     //$this->wfs_id = "id_" . substr(md5(rand()),0,6);
     $parser = xml_parser_create(CHARSET);
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, CHARSET);
     xml_parse_into_struct($parser, $this->wfs_getcapabilities_doc, $values, $tags);
     //xml_parse_into_struct($parser,$data,$values,$tags);
     xml_parser_free($parser);
     $section = false;
     $request = false;
     $featuretype_name = false;
     $featuretype_title = false;
     $featuretype_abstract = false;
     $featuretype_srs = false;
     foreach ($values as $element) {
         if (strtoupper($element[tag]) == "WFS_CAPABILITIES" && $element[type] == "open") {
             $this->wfs_version = $element[attributes][version];
         }
         if (strtoupper($element[tag]) == "NAME" && $element[level] == '3') {
             $this->wfs_name = $element[value];
         }
         /*		if(strtoupper($element[tag]) == "TITLE"  && $element[level] == '3'){
         			$this->wfs_title = $this->stripEndlineAndCarriageReturn($element[value]);
         		}
         		if(strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
         			$this->wfs_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
         		}
         		//new WFS 1.0.0 -- SB 2007-08-06
         		if(strtolower($element[tag]) == "fees"){
         			$this->fees = $element[value];
         		}
         		if(strtolower($element[tag]) == "accessconstraints"){
         			$this->accessconstraints = $element[value];
         		}
         */
         /*capability section*/
         if ($this->wfs_version == "1.0.0") {
             # getCapabilities
             if (strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open") {
                 $section = "getcapabilities";
             }
             if ($section == "getcapabilities" && strtoupper($element[tag]) == "POST") {
                 $this->wfs_getcapabilities = $element[attributes][onlineResource];
             }
             # descriptFeatureType
             if (strtoupper($element[tag]) == "DESCRIBEFEATURETYPE" && $element[type] == "open") {
                 $section = "describefeaturetype";
                 $this->wfs_describefeaturetype = $element[attributes][onlineResource];
             }
             if ($section == "describefeaturetype" && strtoupper($element[tag]) == "POST") {
                 $this->wfs_describefeaturetype = $element[attributes][onlineResource];
             }
             # getFeature
             if (strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "open") {
                 $section = "getfeature";
             }
             if ($section == "getfeature" && strtoupper($element[tag]) == "POST") {
                 $this->wfs_getfeature = $element[attributes][onlineResource];
             }
             if (strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "close") {
                 $section = "";
             }
             # transaction
             if (strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "open") {
                 $section = "transaction";
             }
             if ($section == "transaction" && strtoupper($element[tag]) == "POST") {
                 $this->wfs_transaction = $element[attributes][onlineResource];
             }
             if (strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "close") {
                 $section = "";
             }
         }
         if (strtoupper($element[tag]) == "FEATURETYPE" && $element[type] == "open") {
             $section = "featuretype";
         }
         if ($section == "featuretype" && strtoupper($element[tag]) == "NAME") {
             $featuretype_name = $element[value];
         }
         if ($section == "featuretype" && strtoupper($element[tag]) == "TITLE") {
             $featuretype_title = $this->stripEndlineAndCarriageReturn($element[value]);
         }
         if ($section == "featuretype" && strtoupper($element[tag]) == "ABSTRACT") {
             $featuretype_abstract = $this->{$element}[value];
         }
         if ($section == "featuretype" && strtoupper($element[tag]) == "SRS") {
             $featuretype_srs = $element[value];
             $this->addFeaturetype($featuretype_name, $featuretype_title, $featuretype_abstract, $featuretype_srs, $this->wfs_describefeaturetype, $this->wfs_version);
         }
     }
     return true;
 }
     } else {
         $resultObj["data"] = array("wmsArray" => array());
     }
     break;
 case 'getCustomTreeByApplication':
     $applicationId = $queryObj->parameters->applicationId;
     // get all of the users applications
     $allowedApplicationArray = $user->getApplicationsByPermission(0);
     if (in_array($applicationId, $allowedApplicationArray)) {
         $sql = "SELECT lft, rgt, my_layer_title, wms_id " . "FROM gui_treegde " . "WHERE fkey_gui_id = \$1 ORDER BY lft";
         $v = array($applicationId);
         $t = array("s");
         $res = db_prep_query($sql, $v, $t);
         $nodeArray = array();
         //check if wms exists in gui
         $n = new administration();
         $applicationArray = array($applicationId);
         $mywms = $n->getWmsByOwnGuis($applicationArray);
         while ($row = db_fetch_array($res)) {
             $wmsIdArray = explode(",", $row["wms_id"]);
             $wmsArray = array();
             foreach ($wmsIdArray as $wmsId) {
                 if (in_array($wmsId, $mywms)) {
                     if (is_numeric($wmsId)) {
                         $sqlWms = "SELECT wms_title FROM wms WHERE wms_id = \$1";
                         $vWms = array($wmsId);
                         $tWms = array("i");
                         $resWms = db_prep_query($sqlWms, $vWms, $tWms);
                         $rowWms = db_fetch_array($resWms);
                         $wmsArray[$wmsId] = $rowWms[0];
                     }
# 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.
ob_start();
include_once dirname(__FILE__) . "/../../conf/mapbender.conf";
include dirname(__FILE__) . "/../classes/class_administration.php";
$adm = new administration();
$con = db_connect(DBSERVER, OWNER, PW);
db_select_db(DB, $con);
$id = $_GET['id'];
$sql = "SELECT * FROM mb_meetingpoint WHERE mb_meetingpoint_id = \$1";
$v = array($id);
$t = array('s');
$res = db_prep_query($sql, $v, $t);
if ($row = db_fetch_array($res)) {
    $user = $adm->getUserNameByUserId($row['fkey_mb_user_id']);
    $password = $row['mb_user_password'];
    $gui_id = $row['fkey_gui_id'];
} else {
    exit;
}
$url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/login.php?";
Esempio n. 13
0
        return strcmp($apiToken, $_POST['token']) == 0 ? true : false;
    } else {
        return false;
    }
}
if (is_ajax() && is_valid()) {
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    }
    if (isset($_GET['type']) && isset($_GET['action'])) {
        /*
         * TODO
         * Ajotuer ici un control pour savoir si l'utilisateur en cours a le droit d'appeler les fonctions suivantes
         */
        switch ($_GET['type']) {
            case "admin":
                $a = new administration();
                switch ($_GET['action']) {
                    case "getFileFromChaudiere":
                        $a->getFileFromChaudiere();
                        break;
                    case "getHeaderFromOkoCsv":
                        $a->getHeaderFromOkoCsv();
                        break;
                    case "getSaisons":
                        $a->getSaisons();
                        break;
                    case "checkUpdate":
                        $a->checkUpdate();
                        break;
                    case "getVersion":
                        $a->getVersion();
 $sql_owner = "Update mb_user SET mb_user_owner = \$1 ";
 $sql_owner .= " WHERE mb_user_name = \$2 ";
 $v = array(1, $name);
 #$selected_user;
 $t = array('i', 's');
 $res_owner = db_prep_query($sql_owner, $v, $t);
 # removed, because a new user may be inserted in a group with too many privileges
 $sql_group = "Insert INTO mb_user_mb_group (fkey_mb_user_id, fkey_mb_group_id) VALUES ";
 $sql_group .= "(\$1, \$2) ";
 $v = array($selected_user, 20);
 $t = array('i', 'i');
 $res_group = db_prep_query($sql_group, $v, $t);
 // CB (begin)
 // adding new GUIs for new user (copies of gui and gui1 with owner rights)
 $gui = new gui();
 $admin = new administration();
 //create new name for gui
 $gui_id1 = $admin->getGuiIdByGuiName("gui");
 $gui_id2 = $admin->getGuiIdByGuiName("gui1");
 $gui_id3 = $admin->getGuiIdByGuiName("gui2");
 $gui_id4 = $admin->getGuiIdByGuiName("gui_digitize");
 $gui_newName1 = $name . "_gui";
 $gui_newName2 = $name . "_gui1";
 $gui_newName3 = $name . "_gui2";
 $gui_newName4 = $name . "_gui_digitize";
 //check if new gui names are already taken
 while ($gui->guiExists($gui_newName1)) {
     $gui_newName1 .= "_1";
 }
 while ($gui->guiExists($gui_newName2)) {
     $gui_newName2 .= "_1";
$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 {
    /*
    	$js .= "parent.mod_addWMS_refresh();";
    	echo <<<HTML
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Load WMS</title>
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="Content-Type" content="text/html; charset='$charset'">	
# 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_wms.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
$userId = Mapbender::session()->get("mb_user_id");
$command = $_GET["command"];
$guiId = $_GET["guiId"];
$groupId = $_GET["groupId"];
$admin = new administration();
$guiIdArray = $admin->getGuisByPermission($userId, false);
$resultObj = array();
if ($command == "getGroups") {
    $resultObj["group"] = array();
    $sql = "SELECT mb_group_id, mb_group_name, gettext(\$1, mb_group_description) as mb_group_description ";
    $sql .= "FROM mb_group, mb_user_mb_group ";
    $sql .= "WHERE fkey_mb_group_id = mb_group_id AND fkey_mb_user_id = \$2 ";
    $sql .= "ORDER BY mb_group_name";
    $v = array(Mapbender::session()->get("mb_lang"), $userId);
    $t = array("s", "i");
    $res = db_prep_query($sql, $v, $t);
    while ($row = db_fetch_array($res)) {
        $resultArray = array("description" => $row["mb_group_description"], "name" => $row["mb_group_name"], "id" => $row["mb_group_id"]);
        array_push($resultObj["group"], $resultArray);
    }
     var permission =  confirm("A mail will be sent to the owners of '" + document.form1.wmsList.options[ind].text + "', suggesting its deletion.");
     if(permission === true) {
        document.form2.suggest.value = 1;
        document.form2.wms_name.value = document.form1.wmsList.options[ind].text;
        document.form2.owners.value = email_str;
        document.form2.submit();
     }
   }
}
-->
</script>
</head>
<body>
<?php 
require_once dirname(__FILE__) . "/../classes/class_administration.php";
$admin = new administration();
$error_msg = '';
//if mail form has been filled in and sent
if ($_POST["mail"]) {
    if (!$admin->isValidEmail($_POST["replyto"])) {
        $error_msg .= "The reply-to address is not valid! Please correct it.";
    } else {
        $toAddr = array();
        $toName = array();
        $namesAndAddresses = explode(":::", $_POST["owners"]);
        for ($i = 0; $i < count($namesAndAddresses) - 1; $i++) {
            $nameAndAddress = explode(";;;", $namesAndAddresses[$i]);
            $toAddr[$i] = $nameAndAddress[0];
            $toName[$i] = $nameAndAddress[1];
        }
        $error = '';
db_select_db(DB, $con);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<?php 
echo '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">';
?>
</head>
<body>
<?php 
$admin = new administration();
//Test if ID was valid
if ($_REQUEST['wmsid']) {
    $wms_id = intval($_GET['wmsid']);
} else {
    echo "Invalid WMS ID.";
    die;
}
//Test if userid was valid
if ($_REQUEST['userid']) {
    $userid = intval($_REQUEST['userid']);
}
//else {
//	echo "Invalid User ID.";
//	die;
//}
function removeOwsproxy($obj)
{
    $n = new administration();
    if ($obj->wfs == "gui_confs") {
        return false;
    }
    return $n->setWfsOwsproxyString($obj->wfs, false);
}
require_once dirname(__FILE__) . "/../classes/class_wms.php";
require_once dirname(__FILE__) . "/../classes/class_mb_exception.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<?php 
echo '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">';
?>
</head>
<body>
<?php 
$admin = new administration();
$user = new User();
// update selected wms
$checkboxes = intval($_POST['cbs']);
for ($i = 0; $i < $checkboxes; $i++) {
    echo $i;
    if (!isset($_POST['cb' . $i]) || !isset($_POST['upl_id' . $i])) {
        continue;
    }
    $upd_wmsid = intval($_POST['cb' . $i]);
    $upload_id = intval($_POST['upl_id' . $i]);
    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");
<body>
<?php 
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: <b>' . $testMatch . '</b> is not valid.<br/>';
        die;
    }
    $languageCode = $testMatch;
    $testMatch = NULL;
    Mapbender::session()->set("mb_lang", $languageCode);
    //set session var to languageCode
    $localeObj = new Mb_locale(Mapbender::session()->get("mb_lang"));
}
$admin = new administration();
$user = new User();
//echo $user->id."<br>";
//only logged in user can see their subscribed services
$sql = "SELECT DISTINCT mb_wms_availability.fkey_wms_id FROM mb_wms_availability,mb_user_abo_ows WHERE mb_wms_availability.fkey_wms_id=mb_user_abo_ows.fkey_wms_id AND mb_user_abo_ows.fkey_mb_user_id=\$1";
$res = db_prep_query($sql, array($user->id), array("i"));
$cnt = 0;
$wms = array();
while (db_fetch_row($res)) {
    $wms[$cnt] = db_result($res, $cnt, "fkey_wms_id");
    $cnt++;
}
$status = array();
$upload_id = array();
for ($i = 0; $i < count($wms); $i++) {
    $wms_id[$wms[$i]] = $wms[$i];
 public function saveAsFile()
 {
     if (func_num_args() === 1) {
         $pathAndFilename = func_get_arg(0);
     } else {
         if ($this->filename) {
             $pathAndFilename = $this->filename;
         } else {
             new mb_exception(__FILE__ . ": saveAsFile(): must specify a filename!");
             return false;
         }
     }
     //delete all entries which are more than MAX_ENTRIES from RSS!
     return administration::saveFile($pathAndFilename, $this->__toString());
 }
 function createObjFromDBNoGui($wms_id, $withProxyUrls = true)
 {
     $sql = "Select * from wms where wms_id = \$1 ";
     $v = array($wms_id);
     $t = array('i');
     $res_wms = db_prep_query($sql, $v, $t);
     $count_wms = 0;
     while ($row2 = db_fetch_array($res_wms)) {
         $this->wms_id = $row2["wms_id"];
         $this->wms_version = $row2["wms_version"];
         $this->wms_title = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_title"]));
         $this->wms_abstract = administration::convertIncomingString($this->stripEndlineAndCarriageReturn($row2["wms_abstract"]));
         $wmsowsproxy = $row2["wms_owsproxy"];
         #$wmsowsproxy = "test";
         //exchange the method urls with owsproxy urls if needed - default is to do it, but sometimes this is not usefull!
         if ($wmsowsproxy != "" && $withProxyUrls) {
             $owsproxyurl = OWSPROXY . "/" . session_id() . "/" . $wmsowsproxy . "?";
             $this->wms_getmap = $owsproxyurl;
             $this->wms_getcapabilities = $owsproxyurl;
             $this->wms_getfeatureinfo = $owsproxyurl;
             $this->wms_getlegendurl = $owsproxyurl;
         } else {
             $this->wms_getmap = $row2["wms_getmap"];
             $this->wms_getcapabilities = $row2["wms_getcapabilities"];
             $this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
             $this->wms_getlegendurl = $row2["wms_getlegendurl"];
         }
         // TO DO: Capabilities document needs to
         // be encoded to the original encoding
         // if different from the database encoding
         $this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
         $this->wms_upload_url = $row2["wms_upload_url"];
         $this->wms_filter = $row2["wms_filter"];
         $this->wms_supportsld = $row2["wms_supportsld"];
         $this->wms_userlayer = $row2["wms_userlayer"];
         $this->wms_userstyle = $row2["wms_userstyle"];
         $this->wms_remotewfs = $row2["wms_remotewfs"];
         $this->wms_timestamp = $row2["wms_timestamp"];
         $this->wms_timestamp_create = $row2["wms_timestamp_create"];
         $this->fees = $row2["fees"];
         $this->accessconstraints = $row2["accessconstraints"];
         $this->contactperson = $row2["contactperson"];
         $this->contactposition = $row2["contactposition"];
         $this->contactvoicetelephone = $row2["contactvoicetelephone"];
         $this->contactfacsimiletelephone = $row2["contactfacsimiletelephone"];
         $this->contactorganization = $row2["contactorganization"];
         $this->address = $row2["address"];
         $this->city = $row2["city"];
         $this->stateorprovince = $row2["stateorprovince"];
         $this->postcode = $row2["postcode"];
         $this->country = $row2["country"];
         $this->contactelectronicmailaddress = $row2["contactelectronicmailaddress"];
         $this->wms_network_access = $row2["wms_network_access"];
         $this->fkey_mb_group_id = $row2["fkey_mb_group_id"];
         $this->uuid = $row2["uuid"];
         #some default
         $this->gui_wms_visible = 1;
         $this->gui_wms_opacity = 100;
         $this->gui_wms_epsg = $row["gui_wms_epsg"];
         $this->gui_wms_sldurl = $row["gui_wms_sldurl"];
         if ($this->wms_version == "1.0.0") {
             $this->gui_wms_mapformat = "PNG";
             $this->gui_wms_featureinfoformat = "MIME";
             $this->gui_wms_exceptionformat = "INIMAGE";
         } else {
             $this->gui_wms_mapformat = "image/png";
             $this->gui_wms_featureinfoformat = "text/html";
             $this->gui_wms_exceptionformat = "application/vnd.ogc.se_inimage";
         }
         $count_wms++;
     }
     ### formats
     $sql = "SELECT * FROM wms_format WHERE fkey_wms_id = \$1 ";
     $v = array($wms_id);
     $t = array('i');
     $res_wms = db_prep_query($sql, $v, $t);
     $count_format = 0;
     while ($row3 = db_fetch_array($res_wms)) {
         $this->data_type[$count_format] = $row3["data_type"];
         $this->data_format[$count_format] = $row3["data_format"];
         $count_format++;
     }
     $sql = "Select * from layer where fkey_wms_id = \$1 ORDER BY layer_pos";
     $v = array($wms_id);
     $t = array('i');
     $res_layer = db_prep_query($sql, $v, $t);
     $count_layer = 0;
     while ($row2 = db_fetch_array($res_layer)) {
         $this->addLayer($row2["layer_pos"], $row2["layer_parent"]);
         $layer_cnt = count($this->objLayer) - 1;
         $this->objLayer[$layer_cnt]->layer_uid = $row2["layer_id"];
         $this->objLayer[$layer_cnt]->layer_name = administration::convertIncomingString($row2["layer_name"]);
         $this->objLayer[$layer_cnt]->layer_title = administration::convertIncomingString($row2["layer_title"]);
         $this->objLayer[$layer_cnt]->layer_abstract = administration::convertIncomingString($row2["layer_abstract"]);
         $this->objLayer[$layer_cnt]->gui_layer_title = $this->objLayer[$layer_cnt]->layer_title;
         $this->objLayer[$layer_cnt]->layer_dataurl[0]->href = $row2["layer_dataurl"];
         //load all metadataUrl elements from mb_metadata
         $sql = "SELECT metadata_id, link, linktype, md_format FROM mb_metadata INNER JOIN (SELECT * from ows_relation_metadata WHERE fkey_layer_id = \$1) as relation ON  mb_metadata.metadata_id = relation.fkey_metadata_id AND mb_metadata.origin = 'capabilities'";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_metadataUrl = db_prep_query($sql, $v, $t);
         $count_metadataUrl = 0;
         while ($row4 = db_fetch_array($res_metadataUrl)) {
             $this->objLayer[$layer_cnt]->layer_metadataurl[$count_metadataUrl]->href = $row4["link"];
             $e = new mb_notice("nogui layer_metadataurl: " . $row4["link"]);
             $this->objLayer[$layer_cnt]->layer_metadataurl[$count_metadataUrl]->type = $row4["linktype"];
             $this->objLayer[$layer_cnt]->layer_metadataurl[$count_metadataUrl]->format = $row4["md_format"];
             $count_metadataUrl++;
         }
         //old one:
         //$this->objLayer[$layer_cnt]->layer_metadataurl[0]->href = $row2["layer_metadataurl"];
         $this->objLayer[$layer_cnt]->layer_searchable = $row2["layer_searchable"];
         $this->objLayer[$layer_cnt]->layer_pos = $row2["layer_pos"];
         $this->objLayer[$layer_cnt]->layer_queryable = $row2["layer_queryable"];
         $this->objLayer[$layer_cnt]->layer_minscale = $row2["layer_minscale"];
         $this->objLayer[$layer_cnt]->layer_maxscale = $row2["layer_maxscale"];
         $this->objLayer[$layer_cnt]->uuid = $row2["uuid"];
         if ($this->objLayer[$layer_cnt]->layer_minscale == "") {
             $this->objLayer[$layer_cnt]->layer_minscale = 0;
         }
         if ($this->objLayer[$layer_cnt]->layer_maxscale == "") {
             $this->objLayer[$layer_cnt]->layer_maxscale = 0;
         }
         $this->objLayer[$layer_cnt]->gui_layer_minscale = $this->objLayer[$layer_cnt]->layer_minscale;
         $this->objLayer[$layer_cnt]->gui_layer_maxscale = $this->objLayer[$layer_cnt]->layer_maxscale;
         $this->objLayer[$layer_cnt]->gui_layer_queryable = $this->objLayer[$layer_cnt]->layer_queryable;
         $this->objLayer[$layer_cnt]->gui_layer_wms_id = $this->wms_id;
         $sql = "Select * from layer_epsg where fkey_layer_id = \$1 ORDER BY fkey_layer_id";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_layer_epsg = db_prep_query($sql, $v, $t);
         $count_layer_epsg = 0;
         while ($row2 = db_fetch_array($res_layer_epsg)) {
             $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["epsg"] = $row2["epsg"];
             $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["minx"] = $row2["minx"];
             $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["miny"] = $row2["miny"];
             $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxx"] = $row2["maxx"];
             $this->objLayer[$layer_cnt]->layer_epsg[$count_layer_epsg]["maxy"] = $row2["maxy"];
             $count_layer_epsg++;
         }
         ### read out keywords
         $sql = "SELECT keyword FROM keyword, layer_keyword \nWHERE keyword_id = fkey_keyword_id AND fkey_layer_id = \$1";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_layer_keywords = db_prep_query($sql, $v, $t);
         $count_layer_keywords = 0;
         while ($row2 = db_fetch_array($res_layer_keywords)) {
             $this->objLayer[$layer_cnt]->layer_keyword[$count_layer_keywords] = $row2["keyword"];
             $count_layer_keywords++;
         }
         ### read out layer_md_topic_category_id
         $sql = "SELECT fkey_md_topic_category_id FROM layer_md_topic_category WHERE fkey_layer_id =  \$1";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_layer_md_topic_category = db_prep_query($sql, $v, $t);
         $count_layer_md_topic_category = 0;
         while ($row2 = db_fetch_array($res_layer_md_topic_category)) {
             $this->objLayer[$layer_cnt]->layer_md_topic_category_id[$count_layer_md_topic_category] = $row2["fkey_md_topic_category_id"];
             $count_layer_md_topic_category++;
         }
         ### read out layer_inspire_category_id
         $sql = "SELECT fkey_inspire_category_id FROM layer_inspire_category WHERE fkey_layer_id =  \$1";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_layer_inspire_category = db_prep_query($sql, $v, $t);
         $count_layer_inspire_category = 0;
         while ($row2 = db_fetch_array($res_layer_inspire_category)) {
             $this->objLayer[$layer_cnt]->layer_inspire_category_id[$count_layer_inspire_category] = $row2["fkey_inspire_category_id"];
             $count_layer_inspire_category++;
         }
         ### read out layer_custom_category_id
         $sql = "SELECT fkey_custom_category_id FROM layer_custom_category WHERE fkey_layer_id =  \$1";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_layer_custom_category = db_prep_query($sql, $v, $t);
         $count_layer_custom_category = 0;
         while ($row2 = db_fetch_array($res_layer_custom_category)) {
             $this->objLayer[$layer_cnt]->layer_custom_category_id[$count_layer_custom_category] = $row2["fkey_custom_category_id"];
             $count_layer_custom_category++;
         }
         ### handle styles
         $sql = "SELECT * FROM layer_style WHERE fkey_layer_id = \$1 ";
         $v = array($this->objLayer[$layer_cnt]->layer_uid);
         $t = array('i');
         $res_style = db_prep_query($sql, $v, $t);
         $count_layer_style = 0;
         while ($row2 = db_fetch_array($res_style)) {
             $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"] = $row2["name"];
             $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"] = $row2["title"];
             if ($wmsowsproxy != "") {
                 if ($row2["legendurl"] != '') {
                     $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"] = $owsproxyurl . "REQUEST=getlegendgraphic&VERSION=" . $this->wms_version . "&LAYER=" . $this->objLayer[$layer_cnt]->layer_name . "&FORMAT=" . $row2["legendurlformat"] . "&STYLE=" . $row2["name"];
                 }
             } else {
                 if ($row2["legendurl"] != '') {
                     $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"] = $row2["legendurl"];
                     #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
                 }
             }
             $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"] = $row2["legendurlformat"];
             $count_layer_style++;
         }
         $count_layer++;
     }
 }
#
# 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__) . "/../core/globalSettings.php";
require_once dirname(__FILE__) . "/../http/classes/class_administration.php";
require_once dirname(__FILE__) . "/../tools/mod_monitorCapabilities_defineGetMapBbox.php";
require_once dirname(__FILE__) . "/../http/classes/class_bbox.php";
require_once dirname(__FILE__) . "/../http/classes/class_mb_exception.php";
#do db close at the most reasonable point
$admin = new administration();
$user = null;
$group = null;
$application = null;
$cl = false;
// can be replaced by existing functionality
function getConjunctionCharacter($onlineresource)
{
    if (strstr($onlineresource, "?")) {
        $lastChar = substr($onlineresource, strlen($onlineresource) - 1, 1);
        if ($lastChar == "?" || $lastChar == "&") {
            return "";
        } else {
            return "&";
        }
    } else {
# 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.
include dirname(__FILE__) . "/../php/mb_validateSession.php";
include dirname(__FILE__) . "/../classes/class_administration.php";
$admin = new administration();
$ownwms = $admin->getWmsByWmsOwner($_SESSION["mb_user_id"]);
#need admin functions: getWmsLogTag, getWmsPrice, setWmsLogTag, setWmsPrice
#can set log only when proxy on, can set price only when log on
#read out the request
function array2str($array, $pre = '', $pad = '', $sep = ', ')
{
    $str = '';
    if (is_array($array)) {
        if (count($array)) {
            foreach ($array as $v) {
                $str .= $pre . $v . $pad . $sep;
            }
            $str = substr($str, 0, -strlen($sep));
        }
    } else {
 /**
  * Write catalog object to persistent storage
  * @param $gui
  * @return unknown_type
  */
 public function setCatObjToDB($gui)
 {
     global $con;
     $admin = new administration();
     //to char_encode XML
     db_begin();
     # INSERT INTO TABLE cat - auto insert cat_id
     $sql = "INSERT INTO cat( ";
     $sql .= "cat_version, cat_title, cat_abstract, ";
     $sql .= "cat_upload_url, fees, accessconstraints, providername, providersite, ";
     $sql .= "individualname, positionname, voice, facsimile, deliverypoint, ";
     $sql .= "city, administrativearea, postalcode, country, electronicmailaddress, ";
     $sql .= "cat_getcapabilities_doc, cat_owner, cat_timestamp) ";
     $sql .= "VALUES(\$1,\$2,\$3,\$4,\$5,\$6,\$7,\$8,\$9,\$10,\$11,\$12,\$13,\$14,\$15,\$16,\$17,\$18,\$19,\$20,\$21)";
     $v = array($this->cat_version, $this->cat_title, $this->cat_abstract, $this->cat_upload_url, $this->fees, $this->accessconstraints, $this->providername, $this->providersite, $this->contactperson, $this->contactposition, $this->contactvoicetelephone, $this->contactfacsimiletelephone, $this->delivery, $this->city, $this->address, $this->postcode, $this->country, $this->contactelectronicmailaddress, $admin->char_encode($this->cat_getcapabilities_doc), $_SESSION['mb_user_id'], strtotime("now"));
     $t = array('s', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 'i', 'i');
     $res = db_prep_query($sql, $v, $t);
     if (!$res) {
         db_rollback();
     }
     $cat_insert_id = db_insert_id($con, 'cat', 'cat_id');
     //GUI_CAT
     $sql = "INSERT INTO gui_cat (fkey_gui_id, fkey_cat_id) ";
     $sql .= "VALUES(\$1,\$2)";
     $v = array($gui, $cat_insert_id);
     $t = array('s', 'i');
     $res = db_prep_query($sql, $v, $t);
     if (!$res) {
         db_rollback();
     }
     //Insert operational values into cat_op_conf
     //CAT_OP_CONF
     foreach ($this->cat_op_values as $op_category => $op_name_array) {
         foreach ($op_name_array as $op_type => $op_value_array) {
             foreach ($op_value_array as $op_sub_type => $value) {
                 $op_type_value = $op_type;
                 if ($op_sub_type != 'dflt') {
                     //If not dflt, then it is either soap or xml - store this info as post_xml etc
                     $op_type_value .= '_' . $op_sub_type;
                 }
                 if (!isset($value)) {
                     $value = '';
                 }
                 //Store values
                 $sql = " INSERT INTO cat_op_conf(fk_cat_id, param_type, param_name, param_value) ";
                 $sql .= " VALUES (\$1, \$2, \$3, \$4)";
                 $v = array($cat_insert_id, $op_category, $op_type_value, $value);
                 $t = array('i', 's', 's', 's');
                 $res = db_prep_query($sql, $v, $t);
                 if (!$res) {
                     db_rollback();
                 }
             }
         }
     }
     //Commit Changes
     db_commit();
     $this->cat_id = $cat_insert_id;
 }
     var permission =  confirm("export: " + document.form1.guiList.options[ind].text + " ?");
     if(permission == true){
        document.form1.del.value = 1;
        document.form1.submit();
     }
   }
}
// -->
</script>
</head>
<body>

<?php 
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_gui.php";
$admin = new administration();
$permguis = $admin->getGuisByPermission(Mapbender::session()->get("mb_user_id"), true);
###export
if ($guiList) {
    $gui = gui::byName($guiList);
    try {
        $insert = $gui->toSql();
    } catch (Exception $e) {
        $insert = $e->message;
    }
    echo "<textarea rows=40 cols=80>";
    echo htmlentities($insert, ENT_QUOTES, CHARSET);
    echo "</textarea>";
}
###
if (!$guiList) {
     $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);
         $url = $wfsGetFeature . "REQUEST=getFeature&VERSION=1.0.0&SERVICE=WFS&MAXFEATURES=20" . "&typename=" . $wfsFeatureTypeName;
         //."&propertyname=".$wfsGetFeatureAttr;
         //"&filter=<ogc:Filter><ogc:Not><ogc:PropertyIsNull><ogc:PropertyName>".$wfsGetFeatureAttr."</ogc:PropertyName></ogc:PropertyIsNull></ogc:Not></ogc:Filter>";
         #echo $url;
         $e = new mb_exception("URL: " . $url);
         $x = new connector($url);
         $data = $x->file;
         //$data = file_get_contents($url);
         $parser = xml_parser_create();
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
         xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
         xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
         xml_parse_into_struct($parser, $data, $values, $tags);
         $code = xml_get_error_code($parser);
db_select_db(DB, $con);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<?php 
echo '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">';
?>
</head>
<body>
<?php 
$admin = new administration();
if ($_GET['wmsid']) {
    $wms_id = intval($_GET['wmsid']);
} else {
    echo "Invalid WMS ID.";
    die;
}
$sql = "SELECT upload_id, status, status_comment, timestamp_begin, timestamp_end, upload_url, updated FROM mb_monitor ";
$sql .= "WHERE fkey_wms_id = \$1 AND NOT status = '-2' ORDER BY upload_id DESC";
$v = array($wms_id);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
$cnt = 0;
while ($row = db_fetch_array($res)) {
    $upload_id[$cnt] = db_result($res, $cnt, "upload_id");
    $status[$cnt] = intval(db_result($res, $cnt, "status"));
      else{
         var gui_id=document.form1.guiList.options[listIndex].value;
			document.form1.action='../php/mod_loadwfs.php?<?php 
echo $urlParameters;
?>
';
			document.form1.submit();
      }
   }
}
</script>
</head>
<body>

<?php 
$admin = new administration();
$ownguis = $admin->getGuisByOwner(Mapbender::session()->get("mb_user_id"), true);
echo count($ownguis) . "<br>";
echo "<form name='form1' action='" . $self . "' method='post'>";
echo "<table cellpadding='0' cellspacing='0' border='0'>";
echo "<tr>";
echo "<td>";
echo "GUI";
echo "<br>";
$gui_id = array();
if (count($ownguis) > 0) {
    for ($i = 0; $i < count($ownguis); $i++) {
        $gui_id[$i] = $ownguis[$i];
    }
}
echo "<select size='8' name='guiList' style='width:200px' onClick='submit()'>";