Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Dubrovsky committed Jul 1, 2012
0 parents commit 6c75bb9
Show file tree
Hide file tree
Showing 523 changed files with 36,225 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/nbproject
16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
# Mapito

Mapito is opensource project for editing and sharing spatial data. It is map manager, which create new map portal with any WMS layers in a few seconds.
Mapito is made available under a BSD-license.


## Getting Mapito

Mapito is available at https://github.com/jkdubr/Mapito.

## Requirments

PHP, MySQL, PostGIS, Geoserver

## Installing Mapito

10 changes: 10 additions & 0 deletions action/layerFolder_add.php
@@ -0,0 +1,10 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$layerManager=new LGLayerManager($user);
$layerManager->addLayerFolder($_POST);

header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
10 changes: 10 additions & 0 deletions action/layerFolder_remove.php
@@ -0,0 +1,10 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$layerManager = new LGLayerManager($user);
$layerManager->removeLayerFolder($_GET["layerFolderId"]);

header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
9 changes: 9 additions & 0 deletions action/layerFolder_update.php
@@ -0,0 +1,9 @@
<?php

require_once '../lib/php/main.lib.php';
$user = new LGUser();
$layerManager=new LGLayerManager($user);
$layerManager->updateLayerFolder($_POST);

header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
10 changes: 10 additions & 0 deletions action/layerPublic_add.php
@@ -0,0 +1,10 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$layerManager=new LGLayerManager($user);
$layerManager->addLayerPublicToPlan($_POST['layerId'], $_POST['planId']);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
11 changes: 11 additions & 0 deletions action/layerStyle_add.php
@@ -0,0 +1,11 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$layerStyleManager=new LGLayerStyleManager($user);
$layerStyleManager->addStyle($_REQUEST);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
12 changes: 12 additions & 0 deletions action/layerStyle_remove.php
@@ -0,0 +1,12 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();


$layerStyleManager=new LGLayerStyleManager($user);
$layerStyleManager->removeStyle($_REQUEST['layerStyleId']);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
12 changes: 12 additions & 0 deletions action/layerStyle_update.php
@@ -0,0 +1,12 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();


$layerStyleManager=new LGLayerStyleManager($user);
$layerStyleManager->updateStyle($_REQUEST);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
9 changes: 9 additions & 0 deletions action/layer_add.php
@@ -0,0 +1,9 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$layerManager=new LGLayerManager($user);
$layerManager->addLayer($_POST);
header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
11 changes: 11 additions & 0 deletions action/layer_remove.php
@@ -0,0 +1,11 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$layerManager=new LGLayerManager($user);
$layerManager->removeLayer($_GET["layerId"]);

header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
11 changes: 11 additions & 0 deletions action/layer_update.php
@@ -0,0 +1,11 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$layerManager = new LGLayerManager($user);
$layerManager->updateLayer($_POST);

header("Location: ".$_SERVER["HTTP_REFERER"]);
?>
11 changes: 11 additions & 0 deletions action/layer_updateLayersFromPostgis.php
@@ -0,0 +1,11 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$layerManager=new LGLayerManager($user);
$layerManager->updateLayersFromPostgis($_GET['planId']);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
10 changes: 10 additions & 0 deletions action/login.php
@@ -0,0 +1,10 @@
<?php
require_once '../lib/php/main.lib.php';

$user = new LGUser();
$user->login($_POST["mail"], $_POST["password"]);


header("Location: ".$_SERVER["HTTP_REFERER"]);

?>
8 changes: 8 additions & 0 deletions action/logout.php
@@ -0,0 +1,8 @@
<?php
require_once '../lib/php/main.lib.php';

$user = new LGUser();
$user->logout();
header("Location: ../index.php");

?>
12 changes: 12 additions & 0 deletions action/pgCol_add.php
@@ -0,0 +1,12 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$layerColManager = new LGLayerColManager($user);
$layerColManager->addCol($_POST["planId"], $_POST["layerId"], $_POST["colName"], $_POST["colType"]);



header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
12 changes: 12 additions & 0 deletions action/pgCol_remove.php
@@ -0,0 +1,12 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();


$layerColManager = new LGLayerColManager($user);
$layerColManager->removeCol($_POST["planId"], $_POST["layerId"], $_POST["colName"]);

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
34 changes: 34 additions & 0 deletions action/pgItem_insert_bio.php
@@ -0,0 +1,34 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$plan = new LGPlan($_GET["planId"]);



if ($user->getPrivilegeForPlan($plan->planId) > 1) {
$dbname = 'ligeo_' . $plan->name;

$pgsql_conn = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $dbname . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");
if (!$pgsql_conn) {
die("Error in connection: " . pg_last_error());
}





$sql = 'INSERT INTO ' . $_GET["dbtab"] . ' ("group",name,editable_svd,editable_title,hyp_max)' . ' VALUES (\'' . $_GET["group"] . '\', \'ostatni\',1,1,(SELECT hyp_max FROM '. $_GET["dbtab"] . ' WHERE "group" = \'' . $_GET["group"] .'\' GROUP BY hyp_max))'. ' ;';

$results = pg_query($pgsql_conn, $sql);

//vypocitej update


pg_close($pgsql_conn);
}

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
25 changes: 25 additions & 0 deletions action/pgItem_remove.php
@@ -0,0 +1,25 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();

$plan = new LGPlan($_GET["planId"]);
if ($user->getPrivilegeForPlan($plan->planId) > 1) {
$dbname = 'ligeo_' . $plan->name;

$pgsql_conn = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $dbname . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");
if (!$pgsql_conn) {
die("Error in connection: " . pg_last_error());
}

$sql = 'delete from ' . secure($_GET["dbtab"]) . ' where gid = ' . (int) $_GET["gid"] . ' ;';

$results = pg_query($pgsql_conn, $sql);


pg_close($pgsql_conn);
}

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
53 changes: 53 additions & 0 deletions action/pgItem_update.php
@@ -0,0 +1,53 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();


$plan = new LGPlan($_POST["planId"]);
if ($user->getPrivilegeForPlan($plan->planId) > 1) {
$dbname = 'ligeo_' . $plan->name;


$pgsql_conn = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $dbname . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");
if (!$pgsql_conn) {
die("Error in connection: " . pg_last_error());
}



$v = mydb_query('select * from layerWPS where layerId =' . $plan->planId . ' ');
$z = $v->fetch_array();

$wps = json_encode($z['content']);


$results = pg_query($pgsql_conn, 'SELECT * FROM ' . secure($_POST["dbtab"]) . ' LIMIT 1 ;');
$sqlArray = array();
for ($gt = 0; $gt < pg_num_fields($results); $gt++) {
if (pg_field_type($results, $gt) == "geometry") {

} elseif ($_FILES[pg_field_name($results, $gt)]["tmp_name"]) {
@mkdir('../../data/plan/' . $plan->planId . '/');
$filePath = 'data/plan/' . $plan->planId . '/' . time() . '.' . $_FILES[pg_field_name($results, $gt)]["name"];
file_put_contents('../../' . $filePath, file_get_contents($_FILES[pg_field_name($results, $gt)]["tmp_name"]));

$sqlArray[] = '"' . pg_field_name($results, $gt) . '"=\'' . $GLOBALS["LGSettings"]->map_url . $filePath . '\'';
} else {
$sqlArray[] = '"' . pg_field_name($results, $gt) . '"=\'' . secure($_POST[pg_field_name($results, $gt)]) . '\'';
}
}
$sql = 'UPDATE ' . secure($_POST["dbtab"]) . ' SET ' . implode(",", $sqlArray) . ' WHERE gid=' . (int) $_POST["gid"] . ' ;';
//echo $sql;
$results = pg_query($pgsql_conn, $sql);


//vypocitej update


pg_close($pgsql_conn);
}

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
55 changes: 55 additions & 0 deletions action/pgItem_update_bio.php
@@ -0,0 +1,55 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();


$plan = new LGPlan($_POST["planId"]);
if ($user->getPrivilegeForPlan($plan->planId) > 1) {
$dbname = 'ligeo_' . $plan->name;


$pgsql_conn = pg_connect("host=" . $GLOBALS["LGSettings"]->postgis_host . " dbname=" . $dbname . " user=" . $GLOBALS["LGSettings"]->postgis_user . " password=" . $GLOBALS["LGSettings"]->postgis_pass . "");
if (!$pgsql_conn) {
die("Error in connection: " . pg_last_error());
}



$v = mydb_query('select * from layerWPS where layerId =' . $plan->planId . ' ');
$z = $v->fetch_array();

$wps = json_encode($z['content']);


$results = pg_query($pgsql_conn, 'SELECT * FROM ' . secure($_POST["dbtab"]) . ' LIMIT 1 ;');
$sqlArray = array();
for ($gt = 0; $gt < pg_num_fields($results); $gt++) {
if (pg_field_type($results, $gt) == "geometry") {

} elseif ($_FILES[pg_field_name($results, $gt)]["tmp_name"]) {
@mkdir('../../data/plan/' . $plan->planId . '/');
$filePath = 'data/plan/' . $plan->planId . '/' . time() . '.' . $_FILES[pg_field_name($results, $gt)]["name"];
file_put_contents('../../' . $filePath, file_get_contents($_FILES[pg_field_name($results, $gt)]["tmp_name"]));

$sqlArray[] = '"' . pg_field_name($results, $gt) . '"=\'' . $GLOBALS["LGSettings"]->map_url . $filePath . '\'';
} elseif (secure($_POST[pg_field_name($results, $gt)]) == "") {

} else {
$sqlArray[] = '"' . pg_field_name($results, $gt) . '"=\'' . secure($_POST[pg_field_name($results, $gt)]) . '\'';
}
}
$sql = 'UPDATE ' . secure($_POST["dbtab"]) . ' SET ' . implode(",", $sqlArray) . ' WHERE gid=' . (int) $_POST["gid"] . ' ;';
//echo $sql;
$results = pg_query($pgsql_conn, $sql);


//vypocitej update


pg_close($pgsql_conn);
}

header("Location: " . $_SERVER["HTTP_REFERER"]);
?>
11 changes: 11 additions & 0 deletions action/plan_add.php
@@ -0,0 +1,11 @@
<?php

require_once '../lib/php/main.lib.php';

$user = new LGUser();
$planManager = new LGPlanManager($user);
$planManager->addPlan($_POST);


header("Location: ".$_SERVER["HTTP_REFERER"]);
?>

0 comments on commit 6c75bb9

Please sign in to comment.