changeset 1014:87eda2e9023f

Back out the stValidateRequestUserData() parameter change, use separate function instead for checking for if e-mail is required.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Nov 2015 18:25:05 +0200
parents 720078ca799e
children 6e8ae77e1a25
files admajax.php msite.inc.php pages/register.inc.php
diffstat 3 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Nov 05 00:05:50 2015 +0200
+++ b/admajax.php	Thu Nov 05 18:25:05 2015 +0200
@@ -1725,7 +1725,7 @@
       stExecSQLCond($sql, "OK, compo added.");
     }
     else
-    if ($type == "attendees" && stValidateRequestUserData(TRUE, $emdummy, FALSE))
+    if ($type == "attendees" && stValidateRequestUserData(TRUE, FALSE))
     {
       $sql = stGetAttendeeRegistrationSQL();
       stExecSQLCond($sql, "OK, attendee added.");
@@ -1777,7 +1777,7 @@
         stSetStatus(200, "Updated settings.");
       }
       else
-      if ($type == "attendees" && stValidateRequestUserData(TRUE, $emdummy, $id))
+      if ($type == "attendees" && stValidateRequestUserData(TRUE, $id))
       {
         $sql = stPrepareSQLUpdate("attendees",
           "WHERE id=".$id,
--- a/msite.inc.php	Thu Nov 05 00:05:50 2015 +0200
+++ b/msite.inc.php	Thu Nov 05 18:25:05 2015 +0200
@@ -600,13 +600,17 @@
 }
 
 
-function stValidateRequestUserData($admin, &$requireEmail, $id = FALSE)
+function stCheckRequireEmail()
+{
+  return stGetSetting("requireEMail");
+}
+
+
+function stValidateRequestUserData($admin, $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.")))
@@ -625,7 +629,7 @@
     $res = FALSE;
 
   $email = stGetRequestItem("email");
-  if (!$admin && $requireEmail && strlen($email) < 4)
+  if (!$admin && stCheckRequireEmail() && strlen($email) < 4)
   {
     stError("E-mail address not given, or it is too short.");
     $res = FALSE;
--- a/pages/register.inc.php	Thu Nov 05 00:05:50 2015 +0200
+++ b/pages/register.inc.php	Thu Nov 05 18:25:05 2015 +0200
@@ -156,7 +156,7 @@
   " <table class=\"register\">\n";
   stPrintFormTextInput("Handle:", "(elite)", 20, SET_LEN_USERNAME, "name");
   stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 30, SET_LEN_GROUPS, "groups");
-  stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 30, SET_LEN_EMAIL, "email");
+  stPrintFormTextInput("E-mail:", stCheckRequireEmail() ? "(required)" : "", 30, SET_LEN_EMAIL, "email");
   stPrintFormTextInput("Oneliner:", "(whatever)", 30, SET_LEN_ONELINER, "oneliner");
   stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check".
   //" [".hashToAnswer($botCheckHash)."]".
@@ -177,7 +177,7 @@
   stChkRequestItem("hash", $hash,
     array(CHK_GTEQ, VT_STR, 0, "Invalid data."));
 
-  stValidateRequestUserData(FALSE, $requireEmail, FALSE);
+  stValidateRequestUserData(FALSE, FALSE);
 
   $answer = stGetRequestItem("botcheck");
   if (hashToAnswer($hash) != intval($answer))