svn commit: r135 - trunk/mapbender/http/php
arnulf at osgeo.org
arnulf at osgeo.org
Sun Apr 23 17:25:50 EDT 2006
Author: arnulf
Date: 2006-04-23 21:25:50+0000
New Revision: 135
Modified:
trunk/mapbender/http/php/mod_createJSObjFromXML.php (contents, props changed)
trunk/mapbender/http/php/mod_createUser.php (contents, props changed)
Log:
cleaned, added SVN headers
Modified: trunk/mapbender/http/php/mod_createJSObjFromXML.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_createJSObjFromXML.php?view=diff&rev=135&p1=trunk/mapbender/http/php/mod_createJSObjFromXML.php&p2=trunk/mapbender/http/php/mod_createJSObjFromXML.php&r1=134&r2=135
==============================================================================
--- trunk/mapbender/http/php/mod_createJSObjFromXML.php (original)
+++ trunk/mapbender/http/php/mod_createJSObjFromXML.php 2006-04-23 21:25:50+0000
@@ -1,6 +1,6 @@
<?php
-# $Id: mod_createJSObjFromXML.php,v 1.11 2006/03/09 11:24:27 uli_rothstein Exp $
-# $Header: /cvsroot/mapbender/mapbender/http/php/mod_createJSObjFromXML.php,v 1.11 2006/03/09 11:24:27 uli_rothstein Exp $
+# $Id$
+#
# Copyright (C) 2002 CCGIS
#
# This program is free software; you can redistribute it and/or modify
@@ -16,9 +16,9 @@
# 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.
+
require_once("../../conf/mapbender.conf");
?>
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
@@ -34,7 +34,7 @@
require_once("../classes/class_wms.php");
$mywms = new wms();
$mywms->createObjFromXML(html_entity_decode($_REQUEST['caps']));
-if(!$mywms->wms_status){ echo "alert('Error: no valid capabilities-document" . html_entity_decode($_REQUEST['caps']) . "! Please check whether this server complies to OGC WMS specification.'); </script>"; die; }
+if(!$mywms->wms_status){ echo "alert('Error: The Capabilities Document " . html_entity_decode($_REQUEST['caps']) . " could not be accessed. Please check whether the server is responding and accessible to Mapbender.'); </script>"; die; }
$mywms->optimizeWMS();
$mywms->createJsObjFromWMS("TRUE");
echo "parent.mod_addWMS_refresh();";
Modified: trunk/mapbender/http/php/mod_createUser.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_createUser.php?view=diff&rev=135&p1=trunk/mapbender/http/php/mod_createUser.php&p2=trunk/mapbender/http/php/mod_createUser.php&r1=134&r2=135
==============================================================================
--- trunk/mapbender/http/php/mod_createUser.php (original)
+++ trunk/mapbender/http/php/mod_createUser.php 2006-04-23 21:25:50+0000
@@ -1,6 +1,7 @@
<?php
-# $Id: mod_createUser.php,v 1.13 2006/03/09 11:24:35 astrid_emde Exp $
-# $Header: /cvsroot/mapbender/mapbender/http/php/mod_createUser.php,v 1.13 2006/03/09 11:24:35 astrid_emde Exp $
+# $Id$
+# http://www.mapbender.org/index.php/CreateUser
+#
# Copyright (C) 2002 CCGIS
#
# This program is free software; you can redistribute it and/or modify
@@ -28,7 +29,7 @@
<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
?>
-<title>createUser</title>
+<title>Create New Mapbender User</title>
<style type="text/css">
<!--
body{
@@ -68,169 +69,151 @@
<script language="JavaScript">
function validate(val){
- var ok = validateInput();
- if(ok == 'true'){
- var permission = false;
- if(val == 'save'){
- permission = confirm("Save changes?");
- }
- if(permission == true){
- if(document.forms[0].password.value == myPW){
- document.forms[0].password.value = '';
- }
- document.forms[0].action.value = val;
- document.forms[0].submit();
- }
- }
+ var ok = validateInput();
+ if(ok == 'true'){
+ var permission = false;
+ if(val == 'save'){
+ permission = confirm("Save changes?");
+ }
+ if(permission == true){
+ if(document.forms[0].password.value == myPW){
+ document.forms[0].password.value = '';
+ }
+ document.forms[0].action.value = val;
+ document.forms[0].submit();
+ }
+ }
}
+
function validateInput(){
- var str_alert = "Input incorrect!";
- if(document.forms[0].name.value == ''){
- alert(str_alert);
- document.forms[0].name.focus();
- return 'false';
- }
- if(document.forms[0].password.value == ''){
- alert(str_alert);
- document.forms[0].password.focus();
- return 'false';
- }
- else if(document.forms[0].password.value != document.forms[0].v_password.value){
- alert("Password verification failed. Please enter the same password twice.");
- document.forms[0].password.focus();
- return 'false';
- }
- return 'true';
+ var str_alert = "Input incorrect!";
+ if(document.forms[0].name.value == ''){
+ var str_alert = "Please enter a name.";
+ alert(str_alert);
+ document.forms[0].name.focus();
+ return 'false';
+ }
+ if(document.forms[0].password.value == ''){
+ var str_alert = "Please enter a password.";
+ alert(str_alert);
+ document.forms[0].password.focus();
+ return 'false';
+ }
+ else if(document.forms[0].password.value != document.forms[0].v_password.value){
+ alert("Password verification failed. Please enter the same password twice.");
+ document.forms[0].password.focus();
+ return 'false';
+ }
+ return 'true';
}
-
</script>
-
</head>
<body>
-<?php
+<?php
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db(DB,$con);
#save
if($action == 'save'){
-$owner_id =1;
-$resolution = 72;
-$login_count = 0;
-
- $sql = "SELECT mb_user_id FROM mb_user WHERE mb_user_name = '".$name."' ";
- $res = db_query($sql);
- if(db_fetch_row($res)){
- echo "<script language='JavaScript'>alert('Username must be unique!');</script>";
- }
- else{
- $sql = "Insert INTO mb_user (mb_user_name, mb_user_password,mb_user_owner, mb_user_description, mb_user_email, mb_user_phone, mb_user_department, mb_user_resolution) VALUES ";
- $sql.= "('".$name."',";
-
-
- if(SYS_DBTYPE == "mysql") {
- $sql .= "password('".$password."')";
+ $owner_id =1;
+ $resolution = 72;
+ $login_count = 0;
+ $sql = "SELECT mb_user_id FROM mb_user WHERE mb_user_name = '".$name."' ";
+ $res = db_query($sql);
+ if(db_fetch_row($res)){
+ echo "<script language='JavaScript'>alert('Username must be unique!');</script>";
}
- else {
- if (MD5 == 'false'){
- $sql .= "'".$password."'";
- }else{
- $sql .= "md5('".$password."')";
+ else{
+ $sql = "Insert INTO mb_user (mb_user_name, mb_user_password,mb_user_owner, mb_user_description, mb_user_email, mb_user_phone, mb_user_department, mb_user_resolution) VALUES ";
+ $sql.= "('".$name."',";
+ if(SYS_DBTYPE == "mysql") {
+ $sql .= "password('".$password."')";
}
+ else {
+ if (MD5 == 'false'){
+ $sql .= "'".$password."'";
+ }
+ else{
+ $sql .= "md5('".$password."')";
+ }
+ }
+ $sql.=",".$owner_id.",'".$description."', '".$email."', '".$phone."', '".$department."', ".$resolution.");";
+ $res = db_query($sql);
+ $selected_user = db_insert_id('platzhalter','mb_user','mb_user_id');
+ $sql_owner = "Update mb_user SET mb_user_owner = ";
+ $sql_owner.= "1"; #$selected_user;
+ $sql_owner.= " WHERE mb_user_name ='".$name."'";
+ $res_owner = db_query($sql_owner);
+ # removed, because a new user may be inserted in a group with too many privileges
+ $sql_group = "Insert INTO mb_user_mb_group (fkey_mb_user_id, fkey_mb_group_id) VALUES ";
+ $sql_group.= "(".$selected_user.", 20);";
+ $res_group = db_query($sql_group);
+ // CB (begin)
+ // adding new GUIs for new user (copies of gui and gui1 with owner rights)
+ $gui = new gui();
+ $admin = new administration();
+ //create new name for gui
+ $gui_id1 = $admin->getGuiIdByGuiName("gui");
+ $gui_id2 = $admin->getGuiIdByGuiName("gui1");
+ $gui_newName1 = $name . "_gui";
+ $gui_newName2 = $name . "_gui1";
+ //check if new gui names are already taken
+ while ($gui->guiExists($gui_newName1)) {
+ $gui_newName1 .= "_1";
+ }
+ while ($gui->guiExists($gui_newName2)) {
+ $gui_newName2 .= "_1";
+ }
+ //create gui_(name) and gui1_(name)
+ $gui->copyGui($gui_id1[0], $gui_newName1,true);
+ $gui->copyGui($gui_id2[0], $gui_newName2,true);
+ $new_guiId1 = $admin->getGuiIdByGuiName($gui_newName1);
+ $new_guiId2 = $admin->getGuiIdByGuiName($gui_newName2);
+ //grant owner rights for new guis to this user only!
+ $admin->delAllUsersOfGui($new_guiId1[0]);
+ $admin->delAllUsersOfGui($new_guiId2[0]);
+ $admin->insertUserAsGuiOwner($new_guiId1[0], $selected_user);
+ $admin->insertUserAsGuiOwner($new_guiId2[0], $selected_user);
+ // delete gui from groups
+ // (gui and gui1 are associated with groups 20 and 21, new guis belong to mb_user only)
+ $sql_del_from_group = "DELETE FROM gui_mb_group WHERE fkey_gui_id = '".$new_guiId1[0]."' OR fkey_gui_id = '".$new_guiId2[0]."' ";
+ $res_del_from_group = db_query($sql_del_from_group);
}
-
- $sql.=",".$owner_id.",'".$description."', '".$email."', '".$phone."', '".$department."', ".$resolution.");";
-
- $res = db_query($sql);
- $selected_user = db_insert_id('platzhalter','mb_user','mb_user_id');
-
- $sql_owner = "Update mb_user SET mb_user_owner = ";
- $sql_owner.= "1"; #$selected_user;
- $sql_owner.= " WHERE mb_user_name ='".$name."'";
- $res_owner = db_query($sql_owner);
-
- # removed, because a new user may be inserted in a group with too much rights
- $sql_group = "Insert INTO mb_user_mb_group (fkey_mb_user_id, fkey_mb_group_id) VALUES ";
- $sql_group.= "(".$selected_user.", 20);";
- $res_group = db_query($sql_group);
-
- // CB (begin)
- // adding new GUIs for new user (copies of gui and gui1 with owner rights)
- //
-
- $gui = new gui();
- $admin = new administration();
-
- //create new name for gui
- $gui_id1 = $admin->getGuiIdByGuiName("gui");
- $gui_id2 = $admin->getGuiIdByGuiName("gui1");
- $gui_newName1 = $name . "_gui";
- $gui_newName2 = $name . "_gui1";
-
- //check if new gui names are already taken
- while ($gui->guiExists($gui_newName1)) {
- $gui_newName1 .= "_1";
- }
- while ($gui->guiExists($gui_newName2)) {
- $gui_newName2 .= "_1";
- }
-
- //create gui_(name) and gui1_(name)
- $gui->copyGui($gui_id1[0], $gui_newName1,true);
- $gui->copyGui($gui_id2[0], $gui_newName2,true);
- $new_guiId1 = $admin->getGuiIdByGuiName($gui_newName1);
- $new_guiId2 = $admin->getGuiIdByGuiName($gui_newName2);
-
- //grant owner rights for new guis to this user only!
- $admin->delAllUsersOfGui($new_guiId1[0]);
- $admin->delAllUsersOfGui($new_guiId2[0]);
- $admin->insertUserAsGuiOwner($new_guiId1[0], $selected_user);
- $admin->insertUserAsGuiOwner($new_guiId2[0], $selected_user);
-
- //delete gui from groups
- // (gui and gui1 are associated with groups 20 and 21, new guis belong to mb_user only)
- $sql_del_from_group = "DELETE FROM gui_mb_group WHERE fkey_gui_id = '".$new_guiId1[0]."' OR fkey_gui_id = '".$new_guiId2[0]."' ";
- $res_del_from_group = db_query($sql_del_from_group);
-
- // CB (end)
- //
- }
}
if (!isset($name) || $selected_user == 'new'){
- $name = "";
- $password = "";
- $description = "";
- $email = "";
- $phone = "";
- $department = "";
+ $name = "";
+ $password = "";
+ $description = "";
+ $email = "";
+ $phone = "";
+ $department = "";
}
-
-/*HTML*****************************************************************************************************/
-
+/* HTML */
echo "<form name='form1' action='" . $PHP_SELF . "' method='post'>";
echo "<table border='0'>";
if(isset($selected_user) && $selected_user != 0){
- $sql = "SELECT * FROM mb_user WHERE mb_user_id = ".$selected_user." ORDER BY mb_user_name ";
- $res = db_query($sql);
- if(db_fetch_row($res)){
- $name = db_result($res,0,"mb_user_name");
- $password = db_result($res,0,"mb_user_password");
- $owner_id = db_result($res,0,"mb_user_owner");
- $description = db_result($res,0,"mb_user_description");
- $login_count = db_result($res,0,"mb_user_login_count");
- $email = db_result($res,0,"mb_user_email");
- $phone = db_result($res,0,"mb_user_phone");
- $department = db_result($res,0,"mb_user_department");
- $resolution = db_result($res,0,"mb_user_resolution");
- }
- $sql = "SELECT mb_user_name FROM mb_user WHERE mb_user_id = " . $owner_id;
- $res = db_query($sql);
- if(db_fetch_row($res)){
- $owner_name = db_result($res,0,"mb_user_name");
- }
+ $sql = "SELECT * FROM mb_user WHERE mb_user_id = ".$selected_user." ORDER BY mb_user_name ";
+ $res = db_query($sql);
+ if(db_fetch_row($res)){
+ $name = db_result($res,0,"mb_user_name");
+ $password = db_result($res,0,"mb_user_password");
+ $owner_id = db_result($res,0,"mb_user_owner");
+ $description = db_result($res,0,"mb_user_description");
+ $login_count = db_result($res,0,"mb_user_login_count");
+ $email = db_result($res,0,"mb_user_email");
+ $phone = db_result($res,0,"mb_user_phone");
+ $department = db_result($res,0,"mb_user_department");
+ $resolution = db_result($res,0,"mb_user_resolution");
+ }
+ $sql = "SELECT mb_user_name FROM mb_user WHERE mb_user_id = " . $owner_id;
+ $res = db_query($sql);
+ if(db_fetch_row($res)){
+ $owner_name = db_result($res,0,"mb_user_name");
+ }
}
#name
echo "<tr>";
@@ -242,61 +225,60 @@
#password
echo "<tr>";
- echo "<td>Password*: </td>";
- echo "<td>";
- echo "<input type='password' size='30' name='password' value='";
- if(isset($selected_user) && $selected_user != 'new'){
- echo $myPW;
- }
- echo "'>";
- echo "</td>";
+ echo "<td>Password*: </td>";
+ echo "<td>";
+ echo "<input type='password' size='30' name='password' value='";
+ if(isset($selected_user) && $selected_user != 'new'){
+ echo $myPW;
+ }
+ echo "'>";
+ echo "</td>";
echo "</tr>";
#password
echo "<tr>";
- echo "<td>Confirm password*: </td>";
- echo "<td>";
- echo "<input type='password' size='30' name='v_password' value='";
- echo "'>";
- echo "</td>";
+ echo "<td>Confirm password*: </td>";
+ echo "<td>";
+ echo "<input type='password' size='30' name='v_password' value='";
+ echo "'>";
+ echo "</td>";
echo "</tr>";
#description
echo "<tr>";
- echo "<td>Description: </td>";
- echo "<td>";
- echo "<input type='text' size='30' name='description' value='".$description."'>";
- echo "</td>";
+ echo "<td>Description: </td>";
+ echo "<td>";
+ echo "<input type='text' size='30' name='description' value='".$description."'>";
+ echo "</td>";
echo "</tr>";
#email
echo "<tr>";
- # echo "<td>Email: </td>";
- echo "<td>Email <A HREF='http://wms1.ccgis.de/ewiki/index.php?id=CreateUser' target='_blank'><b>(Why?): </b></A><BR></td>";
- echo "<td>";
- echo "<input type='text' size='30' name='email' value='".$email."'>";
- echo "</td>";
+ echo "<td>Email <A HREF='http://wms1.ccgis.de/ewiki/index.php?id=CreateUser' target='_blank'><b>(Why?): </b></A><BR></td>";
+ echo "<td>";
+ echo "<input type='text' size='30' name='email' value='".$email."'>";
+ echo "</td>";
echo "</tr>";
#phone
echo "<tr>";
- echo "<td>Phone: </td>";
- echo "<td>";
- echo "<input type='text' size='30' name='phone' value='".$phone."'>";
- echo "</td>";
+ echo "<td>Phone: </td>";
+ echo "<td>";
+ echo "<input type='text' size='30' name='phone' value='".$phone."'>";
+ echo "</td>";
echo "</tr>";
#department
echo "<tr>";
- echo "<td>Department: </td>";
- echo "<td>";
- echo "<input type='text' size='30' name='department' value='".$department."'>";
- echo "</td>";
+ echo "<td>Department: </td>";
+ echo "<td>";
+ echo "<input type='text' size='30' name='department' value='".$department."'>";
+ echo "</td>";
echo "</tr>";
echo"</table>";
if($selected_user == 'new' || !isset($selected_user)){
-echo "<input type='button' value='save' onclick='validate(\"save\")'>";
+ echo "<input type='button' value='save' onclick='validate(\"save\")'>";
}
?>
<input type='hidden' name='action' value=''>
More information about the Mapbender_commits
mailing list