function makeTileCacheFile($user, $extentLayer = NULL) { //return; global $basePath; global $postgisdb; global $postgishost; global $postgispw; global $hostName; global $postgisschema; $postgisdb = $user; $table = $extentLayer; $postgisObject = new postgis(); $srs = "900913"; $geomField = $postgisObject->getGeometryColumns($table, "f_geometry_column"); if ($extentLayer) { $sql = "SELECT xmin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMin,xmax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMax, ymin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMin,ymax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMax FROM " . $table; $result = $postgisObject->execQuery($sql); //print_r($postgisObject->PDOerror); $row = $postgisObject->fetchRow($result); } ob_start(); echo "[cache]\n"; echo "type=Disk\n"; echo "base={$basePath}/tmp/{$user}\n\n"; //echo "type=AWSS3\n"; //echo "access_key=AKIAIZUYE3I462NPVANQ\n"; //echo "secret_access_key=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\n"; $sql = "SELECT * FROM settings.geometry_columns_view"; //echo $sql; $result = $postgisObject->execQuery($sql); if ($postgisObject->PDOerror) { makeExceptionReport($postgisObject->PDOerror); } while ($row = $postgisObject->fetchRow($result)) { echo "[{$row['f_table_schema']}.{$row['f_table_name']}]\n"; echo "type=WMS\n"; echo "url=http://127.0.0.1/cgi-bin/mapserv?map={$basePath}/wms/mapfiles/{$user}_{$row['f_table_schema']}.map\n"; echo "extension=png\n"; echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n"; echo "maxResolution=156543.0339\n"; echo "metaTile=yes\n"; echo "metaSize=5,5\n"; echo "srs=EPSG:900913\n\n"; } $data = ob_get_clean(); @unlink("{$basePath}wms/cfgfiles/{$user}.tilecache.cfg"); $newFile = "{$basePath}wms/cfgfiles/{$user}.tilecache.cfg"; $fh = fopen($newFile, 'w'); fwrite($fh, $data); fclose($fh); }
<?php include "../conf/main.php"; include "../libs/functions.php"; include "../model/databases.php"; include "../model/dbchecks.php"; include '../model/settings_viewer.php'; $dbList = new databases(); try { $arr = $dbList->listAllDbs(); } catch (Exception $e) { echo $e->getMessage() . "\n"; die; } $postgisdb = "mygeocloud"; $postgis = new postgis(); $i = 1; foreach ($arr['data'] as $db) { if ($db != "template1" and $db != "template0" and $db != "postgres" and $db != "postgis_template") { $postgisdb = $db; //$dbc = new dbcheck(); $viewer = new Settings_viewer(); $arr = $viewer->get(); $sql = "INSERT INTO users(screenname,pw) VALUES('{$db}','{$arr['data']['pw']}')"; $postgis->execQuery($sql); echo $sql . "\n"; $i++; } //if ($i>10) die(); }
<?php die("What are u doing?"); include "../conf/main.php"; include "../libs/functions.php"; include "../models/Database.php"; //echo "test"; $dbList = new databases(); $arr = $dbList->listAllDbs(); $postgisdb = "mygeocloud"; $conn = new postgis(); foreach ($arr['data'] as $db) { if ($db != "template1" and $db != "template0" and $db != "postgres" and $db != "postgis_template" and $db != "mhoegh" and $db != "mygeocloud") { $sql = "DROP DATABASE {$db}"; $result = $conn->execQuery($sql, "PDO", "transaction"); echo "<p>{$conn->PDOerror[0]} SQL loaded in {$db}</p>"; $conn->PDOerror = NULL; echo "<p>---------------------</p>"; $conn->db = NULL; $conn = NULL; } }
<?php include "../server_header.inc"; $db = new postgis(); $db->execQuery("set client_encoding='UTF8'", "PDO"); $response = $db->sql($_REQUEST['q']); include_once "../server_footer.inc";
function __construct() { if (\app\inc\Input::getPath()->part(3) == "tilecache") { $postgisschema = \app\inc\Input::getPath()->part(4); } else { $postgisschema = \app\inc\Input::getPath()->part(3); } $db = \app\inc\Input::getPath()->part(2); $dbSplit = explode("@", $db); if (sizeof($dbSplit) == 2) { $db = $dbSplit[1]; } $path = App::$param['path'] . "/app/wms/mapfiles/"; $name = $db . "_" . $postgisschema . ".map"; $oMap = new \mapObj($path . $name); $request = new \OWSRequestObj(); if ($_SERVER['REQUEST_METHOD'] === 'GET') { foreach ($_GET as $k => $v) { if (strtolower($k) == "layers" || strtolower($k) == "layer" || strtolower($k) == "typename" || strtolower($k) == "typenames") { $layers = $v; } $request->setParameter($k, $v); } } else { $request->loadParams(); } if ($_SESSION['http_auth'] != $db) { \app\models\Database::setDb($db); $postgisObject = new \app\inc\Model(); foreach (explode(",", $layers) as $layer) { $auth = $postgisObject->getGeometryColumns($layer, "authentication"); $layerSplit = explode(".", $layer); $HTTP_FORM_VARS["TYPENAME"] = $layerSplit[1]; if ($auth == "Read/write") { include 'inc/http_basic_authen.php'; } else { include 'inc/http_basic_authen_subuser.php'; } } } if ($_GET['sql_layer']) { include '../libs/functions.php'; include '../conf/main.php'; $postgisdb = "mydb"; $request->setParameter("SLD_BODY", "<StyledLayerDescriptor version='1.1.0'><NamedLayer><Name>sql</Name><UserStyle><Title>xxx</Title><FeatureTypeStyle><Rule><LineSymbolizer><Stroke><CssParameter name='stroke'>#FFFF00</CssParameter><CssParameter name='stroke-width'>15</CssParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>\n "); $postgisObj = new postgis(); $postgisObj2 = new postgis(); $view = "public.hello"; $sqlView = "CREATE VIEW {$view} as " . urldecode($_GET['sql_layer']); $postgisObj->connect(); $postgisObj->execQuery($sqlView); $postgisObj->execQuery("CREATE SEQUENCE _serial START 1"); $arrayWithFields = $postgisObj2->getMetaData($view); foreach ($arrayWithFields as $key => $arr) { if ($arr['type'] == "geometry") { $fieldsArr[] = "transform(" . $key . ",900913) as the_geom"; } else { $fieldsArr[] = $key; } } $fieldsArr[] = "nextval('_serial') as _serial"; $sql = implode(",", $fieldsArr); $sql = "SELECT {$sql} FROM {$view}"; $request->setParameter("LAYERS", $_GET['LAYERS'] . ",sql"); $layer = ms_newLayerObj($oMap); $layer->updateFromString("\n\tLAYER\n\t\tNAME 'sql'\n\t\tSTATUS off\n\t\tPROCESSING 'CLOSE_CONNECTION=DEFER'\n\t\tDATA \"the_geom from ({$sql}) as foo using unique _serial using srid=900913\"\n\t\tTYPE POLYGON\n\t\tCONNECTIONTYPE POSTGIS\n\t\tCONNECTION 'user=postgres dbname=mydb host=127.0.0.1'\n\t\tMETADATA\n\t\t 'wms_title' 'sql'\n\t\t 'wms_srs' 'EPSG:4326'\n\t\t 'wms_name' 'sql'\n\t\tEND\n\t\tPROJECTION\n\t\t 'init=epsg:900913'\n\t\tEND\n\t\tCLASS\n\t\t NAME 'New style'\n\t\t STYLE\n\t\t\tOUTLINECOLOR 255 0 0\n\t\t END\n \t\tEND\n \tEND\n\t"); } ms_ioinstallstdouttobuffer(); $oMap->owsdispatch($request); if ($_GET['sql_layer']) { $sql = "DROP VIEW {$view}"; $result = $postgisObj->execQuery($sql); } $contenttype = ms_iostripstdoutbuffercontenttype(); if ($contenttype == 'image/png') { header('Content-type: image/png'); } else { header('Content-type: text/xml'); } ms_iogetStdoutBufferBytes(); ms_ioresethandlers(); }
die; } $conn->begin(); //Try to drop schema /* $result = $conn->execQuery("DROP SCHEMA settings CASCADE","PDO","transaction"); if (!$conn->PDOerror[0]) { echo "Schema dropped<br/>"; } else { echo "Something went wrong; {$conn->PDOerror[0]}"; $conn->rollback(); } */ //Try to create schema $result = $conn->execQuery($sqls['schema'], "PDO", "transaction"); if (!$conn->PDOerror[0]) { echo "Schema created<br/>"; } else { echo "Something went wrong; {$conn->PDOerror[0]}"; $conn->rollback(); } //Try to create view $result = $conn->execQuery($sqls['view'], "PDO", "transaction"); if (!$conn->PDOerror[0]) { echo "View created<br/>"; } else { echo "Something went wrong; {$conn->PDOerror[0]}"; $conn->rollback(); } if (!$conn->PDOerror[0]) {
<tbody><tr> <td class="boxtopblueleft"><img src="/gifs/apps/holbaektemaplaner/dottrans.gif" width="5px" height="5px"></td> <td class="boxmainblue"><img src="/gifs/apps/holbaektemaplaner/dottrans.gif" width="195px" height="1px"></td> <td class="boxtopblueright"><img src="/gifs/apps/holbaektemaplaner/dottrans.gif" width="5px" height="5px"></td> </tr> <tr> <td class="boxmainblue"></td> <td class="boxbluecontent"> <p class="h3">Staus</p> <div class="blueshade"></div> <p class="focusheader"> <?php $query = "SELECT komtil_id,status FROM kommuneplan.kpplandk2_view WHERE planid='" . urldecode($_REQUEST['planid']) . "'"; $result = $postgisObject->execQuery($query, "PG"); $row = pg_fetch_array($result); echo ucfirst($row['status']) . "<br /><br />"; if ($row['komtil_id']) { echo "Rammeområdet er oprettet ved:<br /><br />"; $query = "SELECT plannavn,html FROM kommuneplan.komtildk2_join WHERE planid='" . $row['komtil_id'] . "'"; $result = $postgisObject->execQuery($query, "PG"); $num_results = pg_numrows($result); for ($i = 0; $i < $num_results; $i++) { $row = pg_fetch_array($result); echo "<a href='" . $row['html'] . "'>" . $row['plannavn'] . "</a><br /> "; } } $query = "SELECT aendringer,plannavn,html FROM kommuneplan.komtildk2_join"; $result = $postgisObject->execQuery($query, "PG"); $num_results = pg_numrows($result);
<?php ini_set("display_errors", "On"); error_reporting(3); include '../../../../../conf/main.php'; include 'libs/functions.php'; $postgisdb = "cowitrack"; $db = new postgis(); $sql = "INSERT INTO dhl (id,mytime,the_geom,speed,accuracy) VALUES('" . strtolower($_POST['id']) . "',{$_POST['mytime']},geomfromtext('POINT({$_POST['lon']} {$_POST['lat']})',4326),{$_POST['speed']},{$_POST['accuracy']})"; if ($_POST['id']) { $db->execQuery($sql, "PDO"); } echo $sql;
<?php include '../../../../conf/main.php'; include 'libs/functions.php'; $postgisdb = "mobreg"; $postgisObject = new postgis(); $query = "SELECT * FROM public.save_check WHERE irowid={$_REQUEST['id']}"; $result = $postgisObject->execQuery($query); $rows = $postgisObject->fetchAll($result); if (!count($rows)) { $query2 = "INSERT INTO public.save_check (irowid,ok) VALUES({$_REQUEST['id']},1)"; } else { if ($rows[0]['ok'] == 0) { $query2 = "UPDATE public.save_check SET ok=1 WHERE irowid={$_REQUEST['id']}"; } elseif ($rows[0]['ok'] == 1) { $query2 = "UPDATE public.save_check SET ok=0 WHERE irowid={$_REQUEST['id']}"; } } echo $query2; $postgisObject->execQuery($query2);
$row = $postgisObject->fetchRow($res); //echo($row['count']); //die(); if ($row['count'] > 0) { $oStatus->bValid = 0; $postgisObject->numRows($res); } else { $oStatus->bValid = 1; } } $sUserID = VDFormat($_POST['UserID'], true); $sPassword = VDFormat($_POST['Password'], true); $sEmail = VDFormat($_POST['Email'], true); $sUserID = postgis::toAscii($sUserID, NULL, "_"); $sPassword = Settings_viewer::encryptPw($sPassword); $sQuery = "INSERT INTO {$sTable} (screenname,pw,email) VALUES('{$sUserID}','{$sPassword}','{$sEmail}')"; $postgisObject->execQuery($sQuery); $_SESSION['auth'] = true; $_SESSION['screen_name'] = $sUserID; //print_r($_SESSION); ?> </div> </div> </div> </body> </html> <?php if ($_SESSION['auth'] && $_SESSION['screen_name']) { die("<script>window.location='/user/login/p'</script>"); }
//print_r($response['data'][0]); $row = $response['data'][0]; if (empty($row)) { die; } /* $table = new table("public.lpdelplandk2_join"); $response = $table->getRecords("lokplan_id='{$_REQUEST['planid']}'"); print_r($response['data']); $rowsLpDel = $response['data']; */ $postgisObject = new postgis(); //$postgisObject->execQuery("set client_encoding='latin1'","PG"); $query = "SELECT * FROM lokalplaner.lpdelplandk2_join where lokplan_id='" . $row["planid"] . "' order by delnr"; //echo $query; $result = $postgisObject->execQuery($query, "PG"); $rowsLpDel = pg_fetch_all($result); if (!is_array($rowsLpDel)) { $rowsLpDel = array(); } $i = 1; ?> <!DOCTYPE html> <html > <head> <title>MyGeoCloud - Online GIS - Store geographical data and make online maps - WFS and WMS</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Store geographical data and make online maps" /> <meta name="keywords" content="GIS, geographical data, maps, web mapping, shape file, GPX, MapInfo, WMS, OGC" /> <meta name="author" content="Martin Hoegh" /> </head>
//************* $proj = "900913"; $units = "xy"; $postgisdb="hillerod"; //************* $postgisObject = new postgis(); $controlObject = new control(); $postgisObject -> setControlObject($controlObject); $postgisObject -> pg_query_function = "intersects"; $sql="SELECT * FROM settings.geometry_columns_view WHERE f_table_schema='kommuneplan'"; $result = $postgisObject->execQuery($sql); $slayer=pg_fetch_all($result); //print_r($rows); ?> <script> function update(){ clearForm(); document.theForm.submit(); } function spatialsearch(){ document.theForm.submit(); } function clearForm() { try {
foreach ($_GET as $k => $v) { $request->setParameter($k, $v); //logfile::write($k."=".$v."\n"); } //$request->setParameter("LAYERS","allans_test.fejlmeldinger"); if ($_GET['sql_layer']) { include '../libs/functions.php'; include '../conf/main.php'; $postgisdb = "mydb"; $request->setParameter("SLD_BODY", "<StyledLayerDescriptor version='1.1.0'><NamedLayer><Name>sql</Name><UserStyle><Title>xxx</Title><FeatureTypeStyle><Rule><LineSymbolizer><Stroke><CssParameter name='stroke'>#FFFF00</CssParameter><CssParameter name='stroke-width'>15</CssParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>\n"); $postgisObj = new postgis(); $postgisObj2 = new postgis(); $view = "public.hello"; $sqlView = "CREATE VIEW {$view} as " . urldecode($_GET['sql_layer']); $postgisObj->connect(); $postgisObj->execQuery($sqlView); $postgisObj->execQuery("CREATE SEQUENCE _serial START 1"); $arrayWithFields = $postgisObj2->getMetaData($view); foreach ($arrayWithFields as $key => $arr) { if ($arr['type'] == "geometry") { $fieldsArr[] = "transform(" . $key . ",900913) as the_geom"; } else { $fieldsArr[] = $key; } } $fieldsArr[] = "nextval('_serial') as _serial"; $sql = implode(",", $fieldsArr); $sql = "SELECT {$sql} FROM {$view}"; $request->setParameter("LAYERS", $_GET['LAYERS'] . ",sql"); $layer = ms_newLayerObj($oMap); $layer->updateFromString("\n\tLAYER\n\t\tNAME 'sql'\n\t\tSTATUS off\n\t\tPROCESSING 'CLOSE_CONNECTION=DEFER'\n\t\tDATA \"the_geom from ({$sql}) as foo using unique _serial using srid=900913\"\n\t\tTYPE POLYGON\n\t\tCONNECTIONTYPE POSTGIS\n\t\tCONNECTION 'user=postgres dbname=mydb host=127.0.0.1'\n\t\tMETADATA\n\t\t 'wms_title' 'sql'\n\t\t 'wms_srs' 'EPSG:4326'\n\t\t 'wms_name' 'sql'\n\t\tEND\n\t\tPROJECTION\n\t\t 'init=epsg:900913' \n\t\tEND\n\t\tCLASS\n\t\t NAME 'New style' \n\t\t STYLE\n\t\t\tOUTLINECOLOR 255 0 0 \n\t\t END\n \t\tEND\n \tEND\n\t");
function makeTileCacheFile($user, $extentLayer = NULL) { //return; global $basePath; global $postgisdb; global $postgishost; global $postgispw; global $hostName; global $postgisschema; $postgisdb = $user; $table = $extentLayer; $postgisObject = new postgis(); $srs = "900913"; $geomField = $postgisObject->getGeometryColumns($table, "f_geometry_column"); if ($extentLayer) { $sql = "SELECT xmin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMin,xmax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMax, ymin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMin,ymax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMax FROM " . $table; $result = $postgisObject->execQuery($sql); //print_r($postgisObject->PDOerror); $row = $postgisObject->fetchRow($result); } ob_start(); echo "[cache]\n"; echo "type=Disk\n"; echo "base={$basePath}/tmp/{$user}\n\n"; //echo "type=AWSS3\n"; //echo "access_key=AKIAIZUYE3I462NPVANQ\n"; //echo "secret_access_key=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\n"; //echo "db={$user}\n"; $sql = "SELECT * FROM settings.geometry_columns_view"; $result = $postgisObject->execQuery($sql); if ($postgisObject->PDOerror) { makeExceptionReport($postgisObject->PDOerror); } while ($row = $postgisObject->fetchRow($result)) { $layerArr[] = $row['f_table_schema'] . "." . $row['f_table_name']; $def = json_decode($row['def']); $def->meta_tiles == true ? $meta_tiles = "yes" : ($meta_tiles = "no"); $def->ttl < 120 ? $expire = 120 : ($expire = $def->ttl); echo "[{$row['f_table_schema']}.{$row['f_table_name']}]\n"; echo "type=WMS\n"; echo "url={$hostName}/wms/{$user}/{$row['f_table_schema']}/?"; echo "extension=png\n"; echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n"; echo "maxResolution=156543.0339\n"; echo "metaBuffer=20\n"; echo "metaTile={$meta_tiles}\n"; echo "metaSize=3,3\n"; echo "srs=EPSG:900913\n"; echo "expire={$expire}\n\n"; } echo "[{$postgisschema}]\n"; echo "layers=" . implode(",", $layerArr) . "\n"; echo "type=WMS\n"; echo "url={$hostName}/wms/{$user}/{$postgisschema}/?TRANSPARENT=FALSE&"; echo "extension=png\n"; echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n"; echo "maxResolution=156543.0339\n"; echo "metaBuffer=20\n"; echo "metaTile={$meta_tiles}\n"; echo "metaSize=3,3\n"; echo "srs=EPSG:900913\n"; echo "expire={$expire}\n\n"; $data = ob_get_clean(); @unlink("{$basePath}wms/cfgfiles/{$user}.tilecache.cfg"); $newFile = "{$basePath}wms/cfgfiles/{$user}.tilecache.cfg"; $fh = fopen($newFile, 'w'); fwrite($fh, $data); fclose($fh); }