diff msite.inc.php @ 1012:fd957c37fd80

Add a new boolean reference variable to stValidateRequestUserData() arguments that returns if e-mail is required.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Nov 2015 23:12:57 +0200
parents ffacd904fd1f
children 87eda2e9023f
line wrap: on
line diff
--- a/msite.inc.php	Wed Nov 04 22:11:21 2015 +0200
+++ b/msite.inc.php	Wed Nov 04 23:12:57 2015 +0200
@@ -600,11 +600,13 @@
 }
 
 
-function stValidateRequestUserData($admin, $id = FALSE)
+function stValidateRequestUserData($admin, &$requireEmail, $id = FALSE)
 {
   $res = TRUE;
   $chk = 0;
 
+  $requireEmail = stGetSetting("requireEMail") || stGetSetting("confirmEMail");
+
   if (stChkRequestItem("name", $name,
       array(CHK_ISGT, VT_STR, 0, "Handle / name not given."),
       array(CHK_LTEQ, VT_STR, SET_LEN_USERNAME, "Handle / name is too long, should be less than ".SET_LEN_USERNAME." characters.")))
@@ -623,7 +625,7 @@
     $res = FALSE;
 
   $email = stGetRequestItem("email");
-  if (!$admin && stGetSetting("requireEMail") && strlen($email) < 4)
+  if (!$admin && $requireEmail && strlen($email) < 4)
   {
     stError("E-mail address not given, or it is too short.");
     $res = FALSE;