Beispiel #1
0
 * This script returns a PNG file
 */
include_once '../config.php';
include_once '../functions/general.php';
/**
 * This script returns JSON
 */
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: application/json; charset=utf-8");
/**
 * Check unwanted requests
 */
if (!abcCheck($_REQUEST) || !isset($_REQUEST["url"]) || !isset($_REQUEST["layers"]) || !isset($_REQUEST["srs"])) {
    echo '{"success":false}';
    exit(0);
}
/**
 * Decode layers and url parameters
 */
$layers = rawurldecode($_REQUEST["layers"]);
$url = rawurldecode($_REQUEST["url"]);
$srs = $_REQUEST["srs"];
/*
 * Get the md5 hash of sourceUrl
 */
$md5 = md5($_REQUEST["layers"] . $_REQUEST["url"] . $_REQUEST["srs"]);
/*
 * Output file is a mapfile
Beispiel #2
0
 * requirements in conditions enabling the security of their systems and/or
 * data to be ensured and,  more generally, to use and operate it in the
 * same conditions as regards security.
 *
 * The fact that you are presently reading this means that you have had
 * knowledge of the CeCILL-B license and that you accept its terms.
 */
/*
 * Mandatory script !
 */
include_once 'config.php';
include_once 'functions/general.php';
/*
 * Avoid unwanted requests...
 */
if (!abcCheck($_REQUEST)) {
    exit(0);
}
/*
 * Force HTTP Header
 */
if (isset($_REQUEST["returntype"])) {
    /*
     * Force XML
     */
    if ($_REQUEST["returntype"] == "XML") {
        header("Pragma: no-cache");
        header("Expires: 0");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-cache, must-revalidate");
        header("Content-type: text/xml");
Beispiel #3
0
/**
 * Return a valid db connection if :
 *   - general parameters are set
 *   - optional checklist is defined
 * Else return null
 */
function getVerifiedConnection($request, $checklist, $check)
{
    if ($check) {
        if (!abcCheck($request)) {
            return null;
        }
    }
    /**
     * No DB parameters - null
     */
    if (!MSP_DB_HOST && !MSP_DB_NAME && !MSP_DB_USER && !MSP_DB_PASSWORD) {
        return null;
    }
    /**
     * Unset variables on checklist - null
     */
    foreach ($checklist as $key) {
        if (!isset($key)) {
            return null;
        }
    }
    return pg_connect("host=" . MSP_DB_HOST . " dbname=" . MSP_DB_NAME . " user="******" password=" . MSP_DB_PASSWORD);
}
Beispiel #4
0
/*
 * This script returns json
 */
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: application/json; charset=utf-8");
/*
 * Get input json
 */
$json = isset($_POST["json"]) ? json_decode($_POST["json"]) : NULL;
/*
 * Check abc
 */
if (abcCheck($_REQUEST) && $json != NULL) {
    /*
     * The tile Bing pattern :
     * http://ecn.t3.tiles.virtualearth.net/tiles/a02.jpeg?g=687&mkt={culture}
     *
     * The urls are sent as a serialized json string :
     *
     * {tiles: [[item1, item2, etc.],[itemn, itemm, etc.],..,[itemy, itemz, etc.]]}
     *             line 1              line 2                 line n
     *
     * where items are objects with the following properties
     * {
     *      url:
     *      srs:
     *      bounds:{
     *          bottom:
Beispiel #5
0
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: application/json; charset=utf-8");
/*
 * Get input url
 */
$url = isset($_REQUEST["url"]) ? $_REQUEST["url"] : '';
/*
 * Get input id
 */
$id = isset($_REQUEST["id"]) ? $_REQUEST["id"] : '';
/*
 * Try to get the url type through curl_getinfo()
 */
if (abcCheck($_REQUEST) && $url != '') {
    /*
     * Initialize info array
     */
    $infos = array();
    /*
     * Parse url to extract request=GetCapabilities
     */
    $elems = parse_url($url);
    if (isset($elems["query"])) {
        /*
         * Extract key/value pairs from url
         */
        $kvps = explode('&', html_entity_decode($elems["query"]));
        foreach ($kvps as $kvp) {
            $k = explode('=', $kvp);
Beispiel #6
0
 * knowledge of the CeCILL-B license and that you accept its terms.
 */
include_once '../config.php';
include_once '../functions/general.php';
/*
 * This script returns json
 */
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: application/json; charset=utf-8");
/*
 * Process only valid requests
 */
if (abcCheck($_REQUEST) || !isset($_REQUEST["s"])) {
    /*
     * Get Serialized stream
     */
    $stream = $_REQUEST["s"];
    $format = isset($_REQUEST["format"]) ? $_REQUEST["format"] : 'json';
    /*
     * Get an unique filename - unless specified in the request
     */
    $fileName = str_replace(" ", "", isset($_REQUEST["uid"]) ? $_REQUEST["uid"] : microtime(true)) . "." . $format;
    /*
     * Write stream to filename
     */
    if (!empty($stream)) {
        /*
         * Decode string
Beispiel #7
0
 * Display a SHP file through a WMS service
 */
include_once '../config.php';
include_once '../functions/general.php';
/**
 * This script returns JSON
 */
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: application/json; charset=utf-8");
/**
 * Check unwanted requests
 */
if (!abcCheck($_REQUEST) || !isset($_REQUEST["shp"])) {
    echo '{"success":false}';
    exit(0);
}
/**
 * It is assumed that the input shp key value is the shp filename
 * WITHOUT path and that it is stored under MSP_UPLOAD_DIR with
 * the shx and dbf files together
 */
$shp = MSP_UPLOAD_DIR . rawurldecode($_REQUEST["shp"]);
$srs = isset($_REQUEST["srs"]) ? $_REQUEST["srs"] : 'EPSG:4326';
$title = isset($_REQUEST["title"]) ? $_REQUEST["title"] : 'shapefile';
/*
 * Get the md5 hash of sourceUrl
 */
$md5 = md5($shp);