Ejemplo n.º 1
0
use GisApp\Helpers;
require_once "admin/class.Helpers.php";
require_once "admin/settings.php";
$server_os = php_uname('s');
$def_lang = strtolower(filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_STRING));
session_start();
if ($def_lang > '') {
    $lang_fn = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT', FILTER_SANITIZE_STRING) . GISAPPURL . 'admin/languages/' . $def_lang . '.js';
    if (!file_exists($lang_fn)) {
        $def_lang = 'en';
    }
} else {
    $def_lang = "en";
}
$_SESSION['lang'] = $def_lang;
if (Helpers::isValidUserProj(Helpers::getMapFromUrl())) {
    //Setting some global variables
    $user = "" . $_SESSION['user_name'];
    $project = "" . $_SESSION['project'];
    $crs = "" . $_SESSION["crs"];
    $data = json_decode($_SESSION['data']);
    $settings = json_decode($_SESSION['settings']);
    $gis_projects = json_decode($_SESSION['gis_projects']);
    if (!property_exists($settings, "search")) {
        $settings->search = null;
    }
    if (!property_exists($settings, "layerSpecifics")) {
        $settings->layerSpecifics = null;
    }
    if (!property_exists($settings, "geoNames")) {
        $settings->geoNames = null;
Ejemplo n.º 2
0
    $format = $query_arr["format"];
    $cmd = $query_arr["cmd"];
    $ctype = "application/zip";
    if ($format == 'CSV') {
        $ctype = "text/csv";
    }
    //check if user is guest
    session_start();
    $user = null;
    if (isset($_SESSION["user_name"])) {
        $user = $_SESSION["user_name"];
    }
    if ($user != null && $user == 'guest') {
        throw new Exception("Guest users are not allowed to export data!");
    }
    //check user session and permissions
    if (!Helpers::isValidUserProj($map)) {
        throw new Exception("Session time out or unathorized access!");
    }
    //check command
    if ($cmd == 'prepare') {
        echo json_encode(["success" => true, "message" => prepareFile($layername, $map, $query_arr, $format)]);
    } elseif ($cmd == 'get') {
        $key = $query_arr["key"];
        sendFile($ctype, $key);
    }
} catch (Exception $e) {
    //header('Server Error', true, 500);
    echo json_encode(["success" => false, "message" => $e->getMessage()]);
    exit;
}