[Mapbender-commits] r5907 - in trunk/mapbender/http: classes php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Apr 11 06:32:25 EDT 2010


Author: verenadiewald
Date: 2010-04-11 06:32:24 -0400 (Sun, 11 Apr 2010)
New Revision: 5907

Added:
   trunk/mapbender/http/php/mod_sendUserMail.php
Removed:
   trunk/mapbender/http/php/mod_registerUser_server.php
Modified:
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/php/mod_editFilteredUser.php
Log:
restructuring of functionality setting password

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2010-04-11 09:31:30 UTC (rev 5906)
+++ trunk/mapbender/http/classes/class_user.php	2010-04-11 10:32:24 UTC (rev 5907)
@@ -19,6 +19,7 @@
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_RPCEndpoint.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
 
 /**
  * A Mapbender user as described in the table mb_user.
@@ -46,7 +47,15 @@
 	var $postalCode;
 	var $country ="";
 	var $url ="";
-
+	var $realName = "";
+	var $street = "";
+	var $houseNumber = "";
+	var $reference = "";
+	var $forAttentionOf = "";
+  	var $validFrom = "";
+  	var $validTo = "";
+  	var $passwordTicket = "";
+  
     static $displayName = "User";
     static $internalName = "user";
 	
@@ -102,8 +111,15 @@
 							"city" => $this->city,	
 							"postalCode" => $this->postalCode,	
 							"country" => $this->country,	
-							"url" => $this->url	
-
+							"url" => $this->url,
+        					"realName" => $this->realName,
+        					"street" => $this->street,
+        					"housenumber" => $this->housenumber,	
+        					"reference" => $this->reference,
+        					"forAttentionOf" => $this->forAttentionOf,
+        					"validFrom" => $this->validFrom,
+        					"validTo" => $this->validTo,
+        					"passwordTicket" => $this->passwordTicket
         );
 		return $result;
 	}
@@ -196,6 +212,14 @@
 		$this->country = $changes->country ? $changes->country : $this->country;
 		$this->url = $changes->url ? $changes->url : $this->url;
 		$this->id = $changes->id ? $changes->id : $this->id;
+		$this->realName = $changes->realName ? $changes->realName : $this->realName;
+		$this->street = $changes->street ? $changes->street : $this->street;
+		$this->houseNumber = $changes->houseNumber ? $changes->houseNumber : $this->houseNumber;
+		$this->reference = $changes->reference ? $changes->reference : $this->reference;
+		$this->forAttentionOf = $changes->forAttentionOf ? $changes->forAttentionOf : $this->forAttentionOf;
+		$this->validFrom = $changes->validFrom ? $changes->validFrom : $this->validFrom;
+		$this->validTo = $changes->validTo ? $changes->validTo : $this->validTo;
+		$this->passwordTicket = $changes->passwordTicket ? $changes->passwordTicket : $this->passwordTicket;
 
         return true;
 	}
@@ -219,6 +243,14 @@
 			"mb_user_postal_code = $14, ".
 			"mb_user_country = $15, ".
 			"mb_user_online_resource = $16 ".
+		 	"mb_user_realname = $18 ".
+			"mb_user_street = $19 ".
+			"mb_user_housenumber = $20 ".
+			"mb_user_reference =$21 ".
+			"mb_user_for_attention_of = $22 ".
+			"mb_user_valid_from = $23 ".
+			"mb_user_valid_to = $24 ".
+			"mb_user_password_ticket = $25 ".
 			"WHERE mb_user_id = $17;";
 
 
@@ -238,9 +270,17 @@
 									$this->postalCode,
 									$this->country,
 									$this->url,
-									$this->id);
+									$this->id,
+									$this->realName,
+		        					$this->street,
+		        					$this->housenumber,	
+		        					$this->reference,
+		        					$this->forAttentionOf,
+		        					$this->validFrom,
+		        					$this->validTo,
+        							$this->passwordTicket);
 
-			$t = array("s", "i", "s", "s", "s", "s", "i",  "s", "s",  "s", "s", "s",  "s", "i",  "s", "s", "i");
+			$t = array("s", "i", "s", "s", "s", "s", "i",  "s", "s",  "s", "s", "s",  "s", "i",  "s", "s", "i", "s", "s", "s", "s", "s", "s", "s", "s");
 
 			$update_result = db_prep_query($sql_update,$v,$t);
 			if(!$update_result)
@@ -289,8 +329,16 @@
 			$this->postalCode = $row['mb_user_postal_code'];
 			$this->country = $row['mb_user_country'];
 			$this->url = $row['mb_user_online_resource'];
-
-		}else{
+			$this->realName = $row['mb_user_realname'];
+        	$this->street = $row['mb_user_street'];
+        	$this->housenumber = $row['mb_user_housenumber'];	
+        	$this->reference = $row['mb_user_reference'];
+        	$this->forAttentionOf = $row['mb_user_for_attention_of'];
+        	$this->validFrom = $row['mb_user_valid_from'];
+        	$this->validTo = $row['mb_user_valid_to'];
+        	$this->passwordTicket = $row['mb_user_password_ticket'];
+		}
+		else {
 			 throw new Exception("no such User");
 		}
 		return true;
@@ -354,6 +402,27 @@
 		}
 		return true;
 	}
+	
+	public function sendUserLoginMail () {
+		$admin = new administration();
+		
+		$userMessage = "Your Mapbender login data:\n";
+		$userMessage .= "Your login name is: ".$this->name."\n";
+		$userMessage .= "Please set your password using the following link: \n";
+		$mbUrl = substr(LOGIN, 0, -9);
+		$userMessage .= $mbUrl."../javascripts/mod_confirmLogin.php?user_id=".$this->id."&user_name=".$this->name."&user_ticket=".$this->passwordTicket."\n";
+		$userMessage .= "Follow this link to login to Mapbender: \n";
+		$userMessage .= LOGIN."\n";
+		
+		$userMail = $admin->getEmailByUserId($this->id);
+		if(!$admin->sendEmail("", "", $userMail, $this->name, utf8_decode("Your Mapbender account"), utf8_decode($userMessage), $error_msg)) {
+			return "Registry data could not be send. Please check mail address.";
+		}
+		else {
+			return "Registry data has been sent successfully.";
+		}
+	}
+	
     /*
     * @return Array of Users
     * @param $filter UNUSED! string that must be contained in the username

Modified: trunk/mapbender/http/php/mod_editFilteredUser.php
===================================================================
--- trunk/mapbender/http/php/mod_editFilteredUser.php	2010-04-11 09:31:30 UTC (rev 5906)
+++ trunk/mapbender/http/php/mod_editFilteredUser.php	2010-04-11 10:32:24 UTC (rev 5907)
@@ -55,10 +55,10 @@
 		return false;
 	}
 	var parameters = {
-		command : "sendMailToCustomer",
+		command : "sendMailToUser",
 		userId : document.form1.selected_user.options[document.form1.selected_user.selectedIndex].value
 	};
-	$.post("../php/mod_registerUser_server.php", parameters, function (json, status) {
+	$.post("../php/mod_sendUserMail.php", parameters, function (json, status) {
 		if(status == 'success') {
 			alert(json);
 		}

Deleted: trunk/mapbender/http/php/mod_registerUser_server.php
===================================================================
--- trunk/mapbender/http/php/mod_registerUser_server.php	2010-04-11 09:31:30 UTC (rev 5906)
+++ trunk/mapbender/http/php/mod_registerUser_server.php	2010-04-11 10:32:24 UTC (rev 5907)
@@ -1,64 +0,0 @@
-<?php
-# $Id: 
-# http://www.mapbender.org/index.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.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-$command = $_REQUEST["command"];
-
-if($command == 'sendMailToCustomer') {
-
-	$admin = new administration();
-	$mailToAddr = $admin->getEmailByUserId($_REQUEST['userId']);
-	$mailToName = $admin->getUsernameByUserId($_REQUEST['userId']);
-	
-	$sql = "SELECT * FROM mb_user ";
-	$sql .= "WHERE mb_user_id = $1";
-    $v = array($_REQUEST['userId']);
-	$t = array("i");
-	$res = db_prep_query($sql,$v,$t);
-    $row = db_fetch_array($res);
-    if ($row) {
-		$userId = $row["mb_user_id"];
-		$userName = $row["mb_user_name"];
-		$email = $row["mb_user_email"];
-		$ticket = $row["mb_user_password_ticket"];
-		
-		$customerMessage = "You are now registered as a Mapbender User.\n";
-		$customerMessage .= "Your login name is: ".$userName."\n";
-		$customerMessage .= "Please set your own password using the following link: \n";
-		$mbUrl = substr(LOGIN, 0, -9);
-		$customerMessage .= $mbUrl."../javascripts/mod_confirmLogin.php?user_id=".$userId."&user_name=".$userName."&user_ticket=".$ticket."\n";
-		$customerMessage .= "Follow this link to login to Mapbender: \n";
-		$customerMessage .= LOGIN."\n";
-		
-		if(!$admin->sendEmail("", "", $mailToAddr, $mailToName, utf8_decode("Your Mapbender account"), utf8_decode($customerMessage), $error_msg)) {
-			echo "Registry data could not be send. Please check mail address.";
-		}
-		else {
-			echo "Registry data has been sent successfully to new Mapbender user.";
-		}
-		
-	}
-	else {
-		echo "User does not exists.";
-	}
-		
-}
-?>
\ No newline at end of file

Copied: trunk/mapbender/http/php/mod_sendUserMail.php (from rev 5904, trunk/mapbender/http/php/mod_registerUser_server.php)
===================================================================
--- trunk/mapbender/http/php/mod_sendUserMail.php	                        (rev 0)
+++ trunk/mapbender/http/php/mod_sendUserMail.php	2010-04-11 10:32:24 UTC (rev 5907)
@@ -0,0 +1,31 @@
+<?php
+# $Id: 
+# http://www.mapbender.org/index.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.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+
+$command = $_REQUEST["command"];
+
+if($command == 'sendMailToUser') {
+	$user = new user();
+	$user->id = $_REQUEST['userId'];
+	$sendMail = $user->sendUserLoginMail();
+	echo $sendMail;
+}
+?>
\ No newline at end of file



More information about the Mapbender_commits mailing list