[Mapbender-commits] r1705 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 2 10:14:36 EDT 2007


Author: christoph
Date: 2007-10-02 10:14:36 -0400 (Tue, 02 Oct 2007)
New Revision: 1705

Modified:
   trunk/mapbender/http/classes/class_administration.php
Log:
new functions 

getWfsConfByPermission
getWfsOwsproxyString

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2007-10-02 14:00:23 UTC (rev 1704)
+++ trunk/mapbender/http/classes/class_administration.php	2007-10-02 14:14:36 UTC (rev 1705)
@@ -857,6 +857,51 @@
    		}
    		$res = db_prep_query($sql,$v,$t);
    	}
+	
+	/*
+	 * get the owsproxy-string of the current wfs
+	 * 
+	 * @param integer the wfs-id of the current wfs
+	 * @return mixed the owsproxy-string or false
+	 */
+	   	
+   	function getWfsOwsproxyString($wfs_id){
+   		$sql = "SELECT wfs_owsproxy FROM wfs WHERE wfs_id = $1 ";
+   		$v = array($wfs_id);
+   		$t = array("i");
+   		$res = db_prep_query($sql,$v,$t);
+   		if($row = db_fetch_array($res)){
+   			return $row["wfs_owsproxy"];
+   		}
+   		else{
+   			return false;
+   		}
+   	}
+   	
+	/*
+	 * sets or removes the owsproxy string of the current wfs
+	 * 
+	 * @param integer the wfs-id
+	 * @param boolean set (true) or remove (false) the owsproxy-string
+	 * 
+	 */
+   	function getWfsOwsproxyString($wfs_id, $status){
+   		$sql = "UPDATE wfs SET wfs_owsproxy = $1 WHERE wfs_id = $2 ";
+   		$t = array("s","i");
+   		if($status == true){
+   			$time = md5(microtime(1));
+			$v = array($time,$wfs_id);
+   		}
+   		else{
+   			$n = new mb_notice("removed owsproxy for wfs:".$wfs_id);
+   			$v = array("",$wfs_id);
+   		}
+   		
+   		$res = db_prep_query($sql,$v,$t);
+   		$newOwsString = $this->getWfsOwsproxyString($wfs_id);
+   		$n = new mb_notice("Class administration - setOWSString for wfs (".$wfs_id.") to: ". $this->getWfsOwsproxyString($wfs_id));
+   		return $newOwsString;
+   	}
 
    	function checkURL($url){
 		$pos_qm = strpos($url,"?");
@@ -977,15 +1022,15 @@
 		|\xF4[\x80-\x8F][\x80-\xBF]{2}    # plane 16
 		)+%xs', $string);
 	}
-
+	
 	function is_utf8_xml($xml) {
 		return preg_match('/<\?xml[^>]+encoding="utf-8"[^>]*\?>/is', $xml);
 	}
-
+	
 	function is_utf8 ($data) {
 		return ($this->is_utf8_xml($data) || $this->is_utf8_string($data));
 	}
-
+	
 	function char_encode($data) {
 		if (CHARSET == "UTF-8") {
 			if (!$this->is_utf8($data)) {
@@ -1013,7 +1058,7 @@
 		$e = new mb_notice("no conversion: is " . CHARSET);
 		return $data;
 	}
-
+	
 	/**
 	 * identifies the Featureservices where the current user is owner
 	 *
@@ -1030,6 +1075,48 @@
 			array_push($r,$row["wfs_id"]);
 		}
 		return $r;
-	}
+	 }
+	 
+	 /* identifies the Conf-FeatureServices where the current user is owner
+	 * 
+	 * @param integer userid the user-ID of the current user
+	 * @returen integer[] the IDs of the wfs_conf-table
+	 */
+	 function getWfsConfByPermission($userid){
+	 	
+	 	
+	 	$guisByPer = array();
+//	 	1.
+	 	$guisByPer = $this->getGuisByPermission($userid, true);
+	 	
+//	 	2. 
+		if(count($guisByPer)>0){
+			$v = array();
+			$t = array();
+			$sql = "SELECT wfs_conf.wfs_conf_id  FROM gui_wfs_conf, wfs_conf " .
+					"where wfs_conf.wfs_conf_id = gui_wfs_conf.fkey_wfs_conf_id " .
+					"and gui_wfs_conf.fkey_gui_id IN(";
+			for($i=0; $i<count($guisByPer); $i++){
+				if($i>0){ $sql .= ",";}
+				$sql .= "$".strval($i+1);
+				
+				array_push($v, $guisByPer[$i]);
+				array_push($t, "s");
+			}
+			$sql .= ") GROUP BY wfs_conf.wfs_conf_id ORDER BY wfs_conf.wfs_conf_id";
+			
+			
+			$res = db_prep_query($sql,$v,$t);
+			$ownWFSconfs = array();
+			$i=0;
+			while($row = db_fetch_array($res)){
+				
+				$ownWFSconfs[$i] = $row['wfs_conf_id'];
+				$i++;
+			}
+		}
+		return $ownWFSconfs;
+
+	 }
 }
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list