$ajaxResponse->setSuccess(false);
    $ajaxResponse->setMessage($message);
    $ajaxResponse->send();
    die;
}
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;
}
switch ($ajaxResponse->getMethod()) {
    case "getWmc":
        $wmcIdArray = getWmc();
        $wmcList = implode(",", $wmcIdArray);
        $sql = <<<SQL
\t
SELECT mb_user_wmc.wmc_serial_id as wmc_id, mb_user_wmc.wmc_title, mb_user_wmc.wmc_timestamp, wmc_load_count.load_count FROM mb_user_wmc 
LEFT JOIN wmc_load_count ON wmc_load_count.fkey_wmc_serial_id = mb_user_wmc.wmc_serial_id WHERE wmc_serial_id IN ({$wmcList});

SQL;
        $res = db_query($sql);
        $resultObj = array("header" => array("WMC ID", "Titel", "Timestamp", "Load Count", ""), "data" => array());
        while ($row = db_fetch_row($res)) {
            // convert NULL to '', NULL values cause datatables to crash
            $walk = array_walk($row, create_function('&$s', '$s=strval($s);'));
            $link = "<a class='cancelClickEvent' target='_blank' href='../php/mod_showMetadata.php?" . "languageCode=" . Mapbender::session()->get("mb_lang") . "&resource=wmc&id=" . $row[0] . "'>" . _mb("Metadata") . "</a>";
#
# 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__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
require_once dirname(__FILE__) . "/../classes/class_wfs_configuration.php";
require_once dirname(__FILE__) . "/../classes/class_wfs_conf.php";
$ajaxResponse = new AjaxResponse($_REQUEST);
$command = $ajaxResponse->getMethod();
switch ($command) {
    case "getWfsConfsFromId":
        $wfsConfIdString = $ajaxResponse->getParameter("wfsConfIdString");
        if (!$wfsConfIdString) {
            $ajaxResponse->setSuccess($false);
            $ajaxResponse->setMessage("missing wfsConfIdString");
            $ajaxResponse->send();
            break;
        }
        $wfsConfIdString = trim($wfsConfIdString, ',');
        $wfsConfIds = explode(',', $wfsConfIdString);
        $result = array();
        foreach ($wfsConfIds as $wfsId) {
            $currentWfsConf = WfsConfiguration::createFromDb($wfsId);
            if ($currentWfsConf !== null) {
<?php

require dirname(__FILE__) . "/../../core/globalSettings.php";
$request = new AjaxResponse($_REQUEST);
$method = $request->getMethod();
try {
    switch ($method) {
        case "intersect":
            $geometries = $request->getParameter("geometries");
            $clickPoint = $request->getparameter("clickPoint");
            $resultGeometries = array();
            $i = 0;
            foreach ($geometries as $geometry) {
                $sql = "SELECT ST_Intersects ('{$clickPoint}'::geometry, '{$geometry}'::geometry);";
                $dbresult = db_query($sql);
                $row = db_fetch_array($dbresult);
                $result = $row["st_intersects"] == "f" ? false : true;
                if ($result) {
                    $resultGeometries[$i] = $geometry;
                }
                $i++;
            }
            $request->setSuccess(true);
            $request->setResult(array("geometries" => $resultGeometries));
            break;
        default:
            $e = new mb_exception(__FILE__ . ": RPC called with invalid Method '{$method}'");
            $request->setSuccess(false);
            $request->setMessage(__FILE__ . ": RPC called with invalid Method '{$method}'");
    }
} catch (Exception $E) {
# 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__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_gml2.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
$ajaxResponse = new AjaxResponse($_POST);
if ($ajaxResponse->getMethod() != "createUsemap") {
    $ajaxResponse->setSuccess(false);
    $ajaxResponse->setMessage("method invalid");
    $ajaxResponse->send();
    exit;
}
$url = $ajaxResponse->getParameter('url');
//urldecode($_REQUEST["url"]);
$g = new gml2();
$g->parsegml($url);
$um_title = array();
$um_x = array();
$um_y = array();
for ($i = 0; $i < $g->getMemberCount(); $i++) {
    $um_title[] = utf8_decode($g->getValueBySeparatedKey($i, "name"));
    $um_x[] = $g->getXfromMemberAsString($i, 0);
<?php

/*
 * License:
 * Copyright (c) 2009, Open Source Geospatial Foundation
 * 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
 */
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_wmc.php";
require_once dirname(__FILE__) . "/../classes/class_json.php";
require_once dirname(__FILE__) . "/../classes/class_lzw_decompress.php";
$ajaxResponse = new AjaxResponse($_POST);
if ($ajaxResponse->getMethod() != "saveWMC") {
    $ajaxResponse->setSuccess(false);
    $ajaxResponse->setMessage("method invalid");
    $ajaxResponse->send();
    exit;
}
$json = new Mapbender_JSON();
// get data from POST and SESSION
$userId = Mapbender::session()->get("mb_user_id");
$mapObject = $ajaxResponse->getParameter('mapObject');
$lzwCompressed = $ajaxResponse->getParameter('lzwCompressed');
$saveInSession = $ajaxResponse->getParameter('saveInSession');
$extensionData = $json->decode($ajaxResponse->getParameter('extensionData'));
$attributes = $ajaxResponse->getParameter('attributes');
$overwrite = $ajaxResponse->getParameter('overwrite');
$overwrite = $overwrite == "1" ? true : false;