[Mapbender-commits] r2470 - branches/2.5/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed May 21 14:38:55 EDT 2008
Author: astrid_emde
Date: 2008-05-21 14:38:55 -0400 (Wed, 21 May 2008)
New Revision: 2470
Modified:
branches/2.5/http/php/mod_wfs_server.php
Log:
the url to update a wfs is constructed to a valid wfs request from the content of colum wfs_capabilities. Parameter are added
Modified: branches/2.5/http/php/mod_wfs_server.php
===================================================================
--- branches/2.5/http/php/mod_wfs_server.php 2008-05-21 18:37:34 UTC (rev 2469)
+++ branches/2.5/http/php/mod_wfs_server.php 2008-05-21 18:38:55 UTC (rev 2470)
@@ -24,27 +24,27 @@
case 'getAssignedConfs':
$obj->assignedConfs = getAssignedConfs($obj);
sendOutput($obj);
- break;
- case 'getUpdateUrl':
- $obj->url = getUpdateUrl($obj);
- sendOutput($obj);
- break;
+ break;
+ case 'getUpdateUrl':
+ $obj->url = getUpdateUrl($obj);
+ sendOutput($obj);
+ break;
case 'add':
addConfsToGui($obj);
sendOutput($obj);
break;
case 'remove':
removeConfsFromGui($obj);
- sendOutput($obj);
- break;
- case 'updateWfs':
- updateWfs($obj);
sendOutput($obj);
- break;
- case 'deleteWfs':
- deleteWfs($obj);
- sendOutput($obj);
break;
+ case 'updateWfs':
+ updateWfs($obj);
+ sendOutput($obj);
+ break;
+ case 'deleteWfs':
+ deleteWfs($obj);
+ sendOutput($obj);
+ break;
case 'setOwsproxy':
$ows = array();
$ows['string'] = setOwsproxy($obj);
@@ -70,7 +70,7 @@
/*
* Get all services (ids and titles) where the current user is owner
- *
+ *
* @return mixed[] services the ids and titles of the services
*/
function getServices(){
@@ -81,11 +81,11 @@
$adm = new administration();
$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
if(count($serviceList) == 0){
- return false;
+ return false;
}
$sql = "SELECT * FROM wfs WHERE wfs_id IN (";
$v = $serviceList;
- $t = array();
+ $t = array();
for ($i = 1; $i <= count($serviceList); $i++) {
if ($i > 1) {
$sql .= ", ";
@@ -103,13 +103,13 @@
}
/*
- * Get all configurations of the selcted wfs if the current user is owner
- *
- * @return mixed[]
+ * Get all configurations of the selcted wfs if the current user is owner
+ *
+ * @return mixed[]
*/
function getWfsConfData($wfsID){
global $con;
- // re-check permission
+ // re-check permission
$adm = new administration();
$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
if(in_array($wfsID, $serviceList)){
@@ -127,41 +127,41 @@
$cnt++;
}
if($cnt == 0){
- return false;
+ return false;
}
else{
return $wfsConf;
}
- }
- else if($wfsID==="gui_confs"){
- $wfsConf = array();
- $wfsConf['id'] = array();
- $wfsConf['abstract'] = array();
- $wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
- $cnt = 0;
- foreach($wfsConf['id'] as $wfscid){
- $sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
- $v = array($wfscid);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- while($row = db_fetch_array($res)){
- array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
- }
- $cnt++;
- }
- if($cnt == 0){
- return false;
- }
- else{
- return $wfsConf;
- }
}
+ else if($wfsID==="gui_confs"){
+ $wfsConf = array();
+ $wfsConf['id'] = array();
+ $wfsConf['abstract'] = array();
+ $wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
+ $cnt = 0;
+ foreach($wfsConf['id'] as $wfscid){
+ $sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
+ $v = array($wfscid);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
+ }
+ $cnt++;
+ }
+ if($cnt == 0){
+ return false;
+ }
+ else{
+ return $wfsConf;
+ }
+ }
}
/*
* Get all GUIs where the current user is owner. This are the GUIs where the user could publish his
* wfs configurations
- *
- * @return mixed[]
+ *
+ * @return mixed[]
*/
function getGuis(){
$adm = new administration();
@@ -175,19 +175,20 @@
/*
* get all wfs_confs of the selected WFS which are assigned to the selected gui
- * @param
- * @return mixed[]
+ * @param
+ * @return mixed[]
*/
function getAssignedConfs($obj){
global $con;
$assignedConfs = array();
$confs = getWfsConfData($obj->selectedWfs);
if($confs === false){
- return false;
+ return false;
}
$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
+ $e = new mb_exception("Error: aaaa " . $sql);
$v = array($obj->selectedGui);
- $t = array('s');
+ $t = array('s');
$res = db_prep_query($sql,$v,$t);
if(!$res){
$e = new mb_exception("Error: SQL: " . $sql . " -> Gui: " .$obj->selectedGui);
@@ -205,7 +206,7 @@
$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
$v = array($obj->gui,$obj->confs->$i);
$t = array('s','i');
- $res = db_prep_query($sql,$v,$t);
+ $res = db_prep_query($sql,$v,$t);
if(!$row = db_fetch_array($res)){
$sql1 = "INSERT INTO gui_wfs_conf (fkey_gui_id,fkey_wfs_conf_id) VALUES ($1,$2)";
$v1 = array($obj->gui, $obj->confs->$i);
@@ -224,82 +225,90 @@
$res = db_prep_query($sql,$v,$t);
}
}
-/*
- * updates an WFS
- *
- * @param object the un-encoded object
- * @return boolean success
- */
-function updateWfs($obj){
- $obj->success = false;
- $mywfs = new wfs();
- $mywfs->createObjFromDB($obj->wfs);
- if(!$mywfs->updateObjFromXML($obj->url)){
- return false;
- }
- if(!$mywfs->wfs2db("")){
- return false;
- }
- $obj->success = true;
- return true;
-}
-/*
- * deletes an WFS
- *
- * @param object the un-encoded object
- * @return boolean success
- */
-function deleteWfs($obj){
- //$obj->success = false;
- $sql = "DELETE FROM wfs WHERE wfs_id = $1";
- $v = array($obj->wfs);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $obj->success = true;
- return true;
-}
-
-/*
- * gets the specified url column from db
- *
- * @param object the un-encoded object
- * @return string requested url
- */
-
-function getUpdateUrl($obj){
- global $con;
- $sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
- $v = array($obj->wfs);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- while($row = db_fetch_array($res)){
- return $row[$obj->column];
- }
- return "";
-}
+/*
+ * updates an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function updateWfs($obj){
+ $obj->success = false;
+ $mywfs = new wfs();
+ $mywfs->createObjFromDB($obj->wfs);
+ if(!$mywfs->updateObjFromXML($obj->url)){
+ return false;
+ }
+ if(!$mywfs->wfs2db("")){
+ return false;
+ }
+ $obj->success = true;
+ return true;
+}
+/*
+ * deletes an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function deleteWfs($obj){
+ //$obj->success = false;
+ $sql = "DELETE FROM wfs WHERE wfs_id = $1";
+ $v = array($obj->wfs);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $obj->success = true;
+ return true;
+}
+/*
+ * gets the specified url column from db
+ *
+ * @param object the un-encoded object
+ * @return string requested url
+ */
+
+function getUpdateUrl($obj){
+ global $con;
+ $sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
+ $v = array($obj->wfs);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ while($row = db_fetch_array($res)){
+ $ContentOfColumn = $row[$obj->column];
+ if($obj->column == 'wfs_getcapabilities'){
+ $n = new administration();
+ $updateUrl = $n->checkURL($ContentOfColumn)."Version=".$row['wfs_version']."&Request=getCapabilities&SERVICE=WFS";
+ }else{
+ $updateUrl = $ContentOfColumn;
+ }
+
+ return $updateUrl;
+ }
+ return "";
+}
+
function getOwsproxy($obj){
- $n = new administration();
- if($obj->wfs=="gui_confs")
+ $n = new administration();
+ if($obj->wfs=="gui_confs")
return false;
- return $n->getWfsOwsproxyString($obj->wfs);
+ return $n->getWfsOwsproxyString($obj->wfs);
}
function setOwsproxy($obj){
$n = new administration();
- if($obj->wfs=="gui_confs")
- return false;
+ if($obj->wfs=="gui_confs")
+ return false;
return $n->setWfsOwsproxyString($obj->wfs,true);
}
function removeOwsproxy($obj){
$n = new administration();
- if($obj->wfs=="gui_confs")
- return false;
+ if($obj->wfs=="gui_confs")
+ return false;
return $n->setWfsOwsproxyString($obj->wfs,false);
}
/*
* encodes and delivers the data
- *
- * @param object the un-encoded object
+ *
+ * @param object the un-encoded object
*/
function sendOutput($out){
global $json;
More information about the Mapbender_commits
mailing list