}
     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];
                     }
                 }
             }
# 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";
?>
<html>
<head><title></title></head>
<body>
<table>
<?php 
$n = new administration();
$myguis = $n->getGuisByPermission(Mapbender::session()->get("mb_user_id"), true);
$mywms = $n->getWmsByOwnGuis($myguis);
$v = array();
$t = array();
$sql = "SELECT * FROM wms WHERE wms_id IN(";
for ($i = 0; $i < count($mywms); $i++) {
    if ($i > 0) {
        $sql .= ",";
    }
    $sql .= "\$" . strval($i + 1);
    array_push($v, $mywms[$i]);
    array_push($t, "i");
}
$sql .= ")";
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
    if ($row["wms_owsproxy"] != "") {
	//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 .= ",";
            }
            $sql .= "\$" . $c;
            array_push($v, $wms_id_own[$i]);
            array_push($t, 'i');
</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";
}
$logged_user_name = Mapbender::session()->get("mb_user_name");
$logged_user_id = Mapbender::session()->get("mb_user_id");
$admin = new administration();
$own_gui_id_array = $admin->getGuisByOwner($logged_user_id, true);
$own_wms_id_array = $admin->getWmsByOwnGuis($own_gui_id_array);
$cnt_wms = count($own_wms_id_array);
/*handle remove, update and insert*****************************************************************/
if ($insert) {
    if (count($selected_topic) > 0) {
        for ($i = 0; $i < count($selected_topic); $i++) {
            $exists = false;
            $sql_insert = "SELECT * FROM wms_md_topic_category WHERE fkey_wms_id = \$1 and fkey_md_topic_category_id = \$2";
            $v = array($selected_wms, $selected_topic[$i]);
            $t = array('i', 'i');
            $res_insert = db_prep_query($sql_insert, $v, $t);
            while (db_fetch_row($res_insert)) {
                $exists = true;
            }
            if ($exists == false) {
                $sql_insert = "INSERT INTO wms_md_topic_category (fkey_wms_id, fkey_md_topic_category_id) VALUES(\$1, \$2)";