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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Dec 17 01:58:58 PST 2019


Author: armin11
Date: 2019-12-17 01:58:57 -0800 (Tue, 17 Dec 2019)
New Revision: 10371

Modified:
   trunk/mapbender/http/classes/class_administration.php
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/php/mod_createUser.php
   trunk/mapbender/http/php/mod_linkedDataProxy.php
Log:
fix for sending mails with activation link when self registrating is invoked

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2019-12-16 14:58:38 UTC (rev 10370)
+++ trunk/mapbender/http/classes/class_administration.php	2019-12-17 09:58:57 UTC (rev 10371)
@@ -24,6 +24,7 @@
 $phpversion = phpversion();
 if (strpos($phpversion, "7.") === 0) {
     //use new mailer
+$e = new mb_exception($phpversion);
     require(dirname(__FILE__) . "/phpmailer-6.0.2/src/PHPMailer.php");
     require(dirname(__FILE__) . "/phpmailer-6.0.2/src/SMTP.php");
     require(dirname(__FILE__) . "/phpmailer-6.0.2/src/Exception.php");
@@ -98,8 +99,8 @@
      * @param integer maximum line length
      */
 	function sendEmail($fromAddr, $fromName, $toAddr, $toName, $subject, $body, &$error_msg, $wordWrapLength = 50){
+		global $mailHost, $mailUsername, $mailPassword;
 
-		global $mailHost, $mailUsername, $mailPassword;
 		if($fromAddr == ''){
 			$fromAddr = MAILADMIN;
 		}
@@ -107,7 +108,6 @@
 		if($fromName == ''){
 			$fromName = MAILADMINNAME;
 		}
-
 		if ($this->isValidEmail($fromAddr) && $this->isValidEmail($toAddr)) {
 			$phpversion = $this->getPhpVersion();
 			if (strpos($phpversion, "7.") === 0) {
@@ -154,7 +154,9 @@
 
 			return true;
 		}
+
 		else {
+			$e = new mb_exception("classes/class_administration.php - sendEmail - email address not valid!");
 			return false;
 		}
 	}

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2019-12-16 14:58:38 UTC (rev 10370)
+++ trunk/mapbender/http/classes/class_user.php	2019-12-17 09:58:57 UTC (rev 10371)
@@ -530,10 +530,10 @@
 		$userMessage .= _mb("Follow this link to login to Mapbender").": \n";
 		$userMessage .= LOGIN."\n";
 		$userMail = $admin->getEmailByUserId($this->id);
-		if(!$admin->sendEmail("", "", $userMail, $this->name, utf8_decode(_mb("Your Mapbender Geoportal account")), utf8_decode($userMessage), $error_msg)) {
-			return _mb("Registry data could not be send. Please check mail address.");
+		if(!$admin->sendEmail('', '', $userMail, $this->name, utf8_decode(_mb("Your Mapbender Geoportal account")), utf8_decode($userMessage), $error_msg)) {
+			return _mb("Registration data could not be send. Please check the given mail address.");
 		}
-		return _mb("Registry data has been sent successfully.");
+		return _mb("Registration data has been sent successfully - please control your mail Account to activate your account!");
 	}
 	
     /*

Modified: trunk/mapbender/http/php/mod_createUser.php
===================================================================
--- trunk/mapbender/http/php/mod_createUser.php	2019-12-16 14:58:38 UTC (rev 10370)
+++ trunk/mapbender/http/php/mod_createUser.php	2019-12-17 09:58:57 UTC (rev 10371)
@@ -23,7 +23,7 @@
 	echo "This module is disabled. Please check your mapbender.conf.";
 	die;
 }
-
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_gui.php");
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
 require_once(dirname(__FILE__)."/../classes/class_user.php");
@@ -161,8 +161,8 @@
 		$res_del_from_group = db_prep_query($sql_del_from_group,$v,$t);	 
 		//send mail with activation key to user!
 		$userNew = new User($selected_user);
-		$userNew->sendUserLoginMail();
-		echo "<script language='JavaScript'>alert('Email with activation key has been sent!');</script>";
+		$registrationMessage = $userNew->sendUserLoginMail();
+		echo "<script language='JavaScript'>alert('".$registrationMessage."');</script>";
 	}
 }
 
@@ -272,7 +272,8 @@
 	echo "<td></td>";
 	echo "<td>";
 if($selected_user == 'new' || !isset($selected_user)){
-	echo "<input type='button' class='myButton' value='save'  onclick='validate(\""._mb('Save')."\")'>";
+	//echo "<input type='button' class='myButton' value='save'  onclick='validate(\""._mb('Save')."\")'>";
+	echo "<input type='button' class='myButton' value='"._mb('Save')."'  onclick='validate(\"save\")'>";
 }
 	echo "</td>";
 echo "</tr>";

Modified: trunk/mapbender/http/php/mod_linkedDataProxy.php
===================================================================
--- trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-12-16 14:58:38 UTC (rev 10370)
+++ trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-12-17 09:58:57 UTC (rev 10371)
@@ -948,6 +948,7 @@
 	$returnObject->success = false;
     	$returnObject->message = "Wfs object could not be created from db!";
     } else {
+$e = new mb_exception($wfs->providerName." - ".$wfs->summary." - ".$wfs->electronicMailAddress." - ".$wfs->fees);
 	//repair some missing wfs data
 	if (!isset($wfs->summary) || $wfs->summary == null || $wfs->summary == "") {
 		$wfs->summary = "WFS description is missing!";
@@ -958,9 +959,6 @@
 	if (!isset($wfs->electronicMailAddress) || $wfs->electronicMailAddress == null || $wfs->electronicMailAddress == "") {
 		$wfs->electronicMailAddress = "test at test.org";
 	}
-	if (!isset($wfs->electronicMailAddress) || $wfs->electronicMailAddress == null || $wfs->electronicMailAddress == "") {
-		$wfs->electronicMailAddress = "test at test.org";
-	}
 	if (!isset($wfs->fees) || $wfs->fees == null || $wfs->fees == "") {
 		$wfs->fees = "No fees are given in WFS Capabilities!";
 	}



More information about the Mapbender_commits mailing list