# HG changeset patch # User Matti Hamalainen # Date 1446740705 -7200 # Node ID 87eda2e9023fccd35c4cbbdac43a184b668e32bc # Parent 720078ca799e5dd18ea00698ab533988b29c0864 Back out the stValidateRequestUserData() parameter change, use separate function instead for checking for if e-mail is required. diff -r 720078ca799e -r 87eda2e9023f admajax.php --- 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, diff -r 720078ca799e -r 87eda2e9023f msite.inc.php --- 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; diff -r 720078ca799e -r 87eda2e9023f pages/register.inc.php --- 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 @@ " \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))