svn commit: r18 - trunk/mapbender/http/frames

uli at osgeo.org uli at osgeo.org
Thu Apr 13 15:51:45 EDT 2006


Author: uli
Date: 2006-04-13 19:51:45+0000
New Revision: 18

Added:
   trunk/mapbender/http/frames/frameset.html
   trunk/mapbender/http/frames/index.php
   trunk/mapbender/http/frames/login.php

Log:
import Mapbender source without history

Added: trunk/mapbender/http/frames/frameset.html
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/frames/frameset.html?view=auto&rev=18
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/frames/frameset.html	2006-04-13 19:51:45+0000
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<!-- 
+Licensing: See the GNU General Public License for more details.
+http://www.gnu.org/copyleft/gpl.html
+or:
+mapbender/licence/ 
+-->
+<meta name="author-mail" content="info at ccgis.de">
+<meta name="author" content="U. Rothstein">
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Mapbender_</title>
+</head>
+<body bgcolor="#ff0000">
+<iframe id="mapbender_app" name="mapbender_app" width="1000" height="800" src="http://localhost/frames/login.php"></iframe>
+</body>
+</html>

Added: trunk/mapbender/http/frames/index.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/frames/index.php?view=auto&rev=18
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/frames/index.php	2006-04-13 19:51:45+0000
@@ -0,0 +1,148 @@
+<?php
+#$Id: index.php,v 1.25 2006/03/09 12:25:36 uli_rothstein Exp $
+#$Header: /cvsroot/mapbender/mapbender/http/frames/index.php,v 1.25 2006/03/09 12:25:36 uli_rothstein Exp $
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+session_start();
+import_request_variables("PG");
+require("../php/mb_validateSession.php");
+$_SESSION["mb_user_gui"] = $_REQUEST["gui_id"];
+require_once("../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<!--
+Licensing: See the GNU General Public License for more details.
+http://www.gnu.org/copyleft/gpl.html
+or:
+mapbender/licence/
+-->
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>MB2 - <?php  echo  $_REQUEST["gui_id"];?></title>
+<?php
+	$sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = 'body' AND fkey_gui_id = '".$gui_id."' and var_type='file/css'";
+	$res = db_query($sql);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+	echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".$row["var_value"]."\" />\n";
+}
+?>
+<style type="text/css">
+<!--
+<?php
+	$sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = 'body' AND fkey_gui_id = '".$gui_id."' and var_type='text/css'";
+	$res = db_query($sql);
+	$cnt = 0;
+	while($row = db_fetch_array($res)){
+		echo $row["var_value"];
+	}
+?>
+-->
+</style>
+
+<script type='text/javascript' src="../javascripts/map_obj.js"></script>
+<script type='text/javascript' src="../javascripts/wfs_obj.js"></script>
+<?php
+echo "<script type='text/javascript' src='../javascripts/map.php?gui_id=".$_REQUEST["gui_id"]."&".strip_tags(SID)."&mb_myBBOX=".$_REQUEST["mb_myBBOX"]."'></script>";
+echo "<script type='text/javascript' src='../php/mod_createJSObjFromDB.php?". strip_tags (SID)."'></script>";
+/*********************************************/
+$frame = "";
+/*********************************************/
+
+include("../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db($DB,$con);
+
+require_once("../php/mb_validateInput.php");
+$gui = mb_validateInput($_REQUEST["gui_id"]);
+$sql = "SELECT DISTINCT e_mb_mod, e_pos FROM gui_element WHERE e_public = 1 AND fkey_gui_id = '".$gui."' ORDER BY e_pos";
+$res = db_query($sql);
+$cnt = 0;
+while($row = db_fetch_array($res)){
+	if($row["e_mb_mod"] != ""){
+		echo "<script type='text/javascript' src='../javascripts/".trim($row["e_mb_mod"])."?gui_id=".$gui."'></script> ";
+	}
+	$cnt++;
+}
+?>
+</head>
+<?php
+$sql = "SELECT * FROM gui_element WHERE e_public = 1 AND fkey_gui_id = '".$gui."' ORDER BY e_pos";
+$res = db_query($sql);
+$i = 0;
+while(db_fetch_row($res)){
+	echo "<".db_result($res,$i,"e_element")." ";
+	if(db_result($res,$i,"e_id") != ""){
+		echo " id='".db_result($res,$i,"e_id")."'";
+		echo " name='".db_result($res,$i,"e_id")."'";
+	}
+	if(db_result($res,$i,"e_attributes") != ""){
+		echo " ".stripslashes(preg_replace("/sessionID/",strip_tags(SID),db_result($res,$i,"e_attributes")));
+	}
+	if(db_result($res,$i,"e_src") != ""){
+		if(db_result($res,$i,"e_closetag") == "iframe" && db_result($res,$i,"e_id") != 'loadData'){
+      		echo " src = '".preg_replace("/sessionID/",strip_tags(SID),db_result($res,$i,"e_src"));
+				if(strpos(db_result($res,$i,"e_src"), "?")) {
+					echo "&";
+				}
+				else {
+	      			echo "?";
+      			}
+      			echo "e_id_css=".db_result($res,$i,"e_id")."&e_id=".db_result($res,$i,"e_id")."'";
+		}
+		else{
+			echo " src = '".preg_replace("/sessionID/",strip_tags(SID),db_result($res,$i,"e_src"))."'";
+		}
+	}
+	echo " style = '";
+	if(db_result($res,$i,"e_left") != "" && db_result($res,$i,"e_top") != ""){
+		echo "position:absolute;";
+		echo "left:".db_result($res,$i,"e_left").";";
+		echo "top:".db_result($res,$i,"e_top").";";
+	}
+	if(db_result($res,$i,"e_width") != "" && db_result($res,$i,"e_height") != ""){
+		echo "width:".db_result($res,$i,"e_width").";";
+		echo "height:".db_result($res,$i,"e_height").";";
+	}
+	if(db_result($res,$i,"e_z_index") != ""){
+    	echo "z-index:".db_result($res,$i,"e_z_index").";";
+	}
+	if(db_result($res,$i,"e_more_styles") != ""){
+    	echo db_result($res,$i,"e_more_styles");
+	}
+	echo "' >";
+	if(db_result($res,$i,"e_content") != ""){
+		echo " ".stripslashes(db_result($res,$i,"e_content"));
+	}
+	if(db_result($res,$i,"e_closetag") != "" && db_result($res,$i,"e_closetag") != "body"){
+		echo " </".db_result($res,$i,"e_closetag").">";
+	}
+	$i++;
+}
+?>
+<form id='sendData' name='sendData' action='' method='POST' target='loadData' style='position:absolute;left:800px'>
+<input type='hidden' name='data'>
+</form>
+</body>
+</html>
\ No newline at end of file

Added: trunk/mapbender/http/frames/login.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/frames/login.php?view=auto&rev=18
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/frames/login.php	2006-04-13 19:51:45+0000
@@ -0,0 +1,183 @@
+<?php
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ob_start(); 
+include_once("../../conf/mapbender.conf");
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+<head>
+<!-- 
+Licensing: See the GNU General Public License for more details.
+http://www.gnu.org/copyleft/gpl.html
+or:
+mapbender/licence/ 
+-->
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Login</title>
+<?php
+$css_folder = "";
+echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/" . $css_folder . "login.css\">";
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+require_once("../php/mb_validateInput.php");
+$name = mb_validateInput($_REQUEST["name"]);
+$password = mb_validateInput($_REQUEST["password"]);
+
+$loginMax = MAXLOGIN;
+
+if(!isset($name) || $name == ''){
+  echo "<script type='text/javascript'>";
+  echo "<!--". chr(13).chr(10);
+  echo "function setFocus(){";
+     echo "if(document.loginForm){";
+        echo "document.loginForm.name.focus();";
+     echo "}";
+  echo "}";
+  echo "// -->". chr(13).chr(10);
+  echo "</script>";
+}
+else{
+  echo "<script type='text/javascript'>";
+  echo "<!--". chr(13).chr(10);
+  echo "function setFocus(){";
+     echo "if(document.loginForm){";
+        echo "document.loginForm.password.focus();";
+     echo "}";
+  echo "}";
+  echo "// -->". chr(13).chr(10);
+  echo "</script>";
+}
+
+echo "</head>";
+echo "<body onload='setFocus()'>";
+
+
+session_start();
+if(isset($_REQUEST["password"]) && isset($_REQUEST["name"])){
+	session_unset();
+    session_destroy();
+}
+if(isset($_SESSION["mb_user_password"]) && isset($_SESSION["mb_user_name"])){
+   $name = $_SESSION["mb_user_name"];
+   $password = $_SESSION["mb_user_password"];
+}
+if(!isset($name) || $name == '' || !isset($password) || $password == ''){
+	echo "<form name='loginForm' action ='" . $PHP_SELF . "' method='POST'>";
+	echo "<table>";
+	echo "<tr><td>Name: </td><td><input type='text' name='name' class='login_text' value='".$name."'></td></tr>";
+	echo "<tr><td>Password: </td><td><input type='password' name='password' class='login_text'></td></tr>";
+	echo "<tr><td></td><td><input type='submit' class='login_submit' value='login' title='anmelden'>";
+	echo "&nbsp;&nbsp;<a href='../php/mod_forgottenPassword.php' title='Passwort vergessen?' target='_blank'>Forgot your password?</a>";
+	echo "</td></tr></table>";
+	echo "</form>";
+	session_unset();
+	session_destroy();
+}
+session_start();
+if(isset($name) && $name != '' && isset($password) && $password != ''){
+	$sql_count = "SELECT mb_user_login_count FROM mb_user WHERE mb_user_name = '".$name."'";
+	$res_count = db_query($sql_count);
+	
+	if($row = db_fetch_array($res_count)){
+		if($row["mb_user_login_count"] > $loginMax){
+			echo "Permission denied. Login failed ".$loginMax." times. Your account has been deactivated. Please contact your administrator!";
+			die();
+		}
+	}
+	
+	if(SYS_DBTYPE == "mysql") {
+		$passwd_tmp = "password('".$password."')";
+		
+	}
+	else {
+		if(MD5 == 'true'){
+			$passwd_tmp = "md5('".$password."')";
+		}else{
+			$passwd_tmp = $password;
+		}
+	}
+	
+	if(SYS_DBTYPE == "pgsql" && MD5 == 'false')
+		$sql = "SELECT * FROM mb_user WHERE mb_user_name = '".$name."' AND mb_user_password = '".$passwd_tmp."';";
+	else{
+		$sql = "SELECT * FROM mb_user WHERE mb_user_name = '".$name."' AND mb_user_password = ".$passwd_tmp.";";
+	}
+
+
+	$res = db_query($sql);
+	$row = db_fetch_array($res);
+	
+	// if given user data is found in database, set session data (db_fetch_array returns false if no row is found)
+	if ($row) {
+		include_once("../../conf/session.conf");
+	}
+	
+	if($_SESSION["mb_user_id"]){
+		if($row["mb_user_login_count"] < $loginMax){
+			$sql_del_cnt =  "UPDATE mb_user SET mb_user_login_count = 0 WHERE mb_user_name = '".$name."'";
+			db_query($sql_del_cnt);
+			
+			#Session variables, defined in session.conf
+			#include("../../conf/mapbender.conf");
+			#check guis
+			require_once("../php/mb_getGUIs.php");
+			$arrayGUIs = mb_getGUIs($row["mb_user_id"]);
+			$_SESSION["mb_user_guis"] = $arrayGUIs;
+			$_SESSION["mb_login"] = $login;
+			# a gui is explicitly ordered
+			if((isset($_REQUEST["mb_user_myGui"]) || isset($_SESSION["mb_user_myGui"])) && in_array($_REQUEST["mb_user_myGui"], $arrayGUIs)){
+				unset($arrayGUIs);
+				if(isset($_REQUEST["mb_user_myGui"])){ $arrayGUIs[0] = $_REQUEST["mb_user_myGui"];}
+				else{ $arrayGUIs[0] = $_SESSION["mb_user_myGui"];}
+			}
+			#only one gui is provided
+			if(count($arrayGUIs) == 1){
+				$myURL = "Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php?".strip_tags (SID)."&gui_id=".$arrayGUIs[0];            
+				# params for the initial call
+				if(isset($_REQUEST["mb_myBBOX"])){
+					$myURL .= "&mb_myBBOX=".$_REQUEST["mb_myBBOX"];
+				}
+				header ($myURL);
+				exit;
+			}
+			# list all guis of this user and his groups
+			else{	   
+				require_once("../php/mb_listGUIs.php");
+				mb_listGUIs($arrayGUIs);
+			}
+		}
+	}
+	else{
+		$sql_set_cnt = "UPDATE mb_user SET mb_user_login_count = (mb_user_login_count + 1) WHERE mb_user_name = '".$name."'";
+		db_query($sql_set_cnt);				
+		header ("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/login.php?name=".$name);
+		exit();
+	}
+}
+ob_end_flush();
+?>
+</body>
+</html>




More information about the Mapbender_commits mailing list