1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-10 13:11:48 +02:00

Signup - check required fields that may not return $_POST

This commit is contained in:
e107steved 2009-04-23 19:13:18 +00:00
parent 9dd8ef496d
commit 7b6636e354
2 changed files with 10 additions and 9 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/user_extended_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/user_extended_class.php,v $
| $Revision: 1.22 $ | $Revision: 1.23 $
| $Date: 2009-01-11 21:06:46 $ | $Date: 2009-04-23 19:13:18 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -193,7 +193,8 @@ class e107_user_extended
// Validate all user-modifable extended user fields which are presented. // Validate all user-modifable extended user fields which are presented.
// $inArray is the input data (usually from $_POST or $_POST['ue'], although doesn't have to be) - may have 'surplus' values // $inArray is the input data (usually from $_POST or $_POST['ue'], although doesn't have to be) - may have 'surplus' values
// $hideArray is a set of possible 'hide' flags // $hideArray is a set of possible 'hide' flags
function userExtendedValidateAll($inArray, $hideArray) // $isSignup TRUE causes required fields to be specifically checked, else only data passed is checked
function userExtendedValidateAll($inArray, $hideArray, $isSignup=FALSE)
{ {
global $tp; global $tp;
$eufVals = array(); // 'Answer' array $eufVals = array(); // 'Answer' array
@ -201,9 +202,9 @@ class e107_user_extended
foreach ($this->fieldDefinitions as $k => $defs) foreach ($this->fieldDefinitions as $k => $defs)
{ {
$f = 'user_'.$defs['user_extended_struct_name']; $f = 'user_'.$defs['user_extended_struct_name'];
if (isset($inArray[$f])) if (isset($inArray[$f]) || ($isSignup && ($defs['user_extended_struct_required'] == 1)))
{ // Only allow valid keys { // Only allow valid keys
$val = $inArray[$f]; $val = varset($inArray[$f], FALSE);
$err = $this->user_extended_validate_entry($val, $defs); $err = $this->user_extended_validate_entry($val, $defs);
if ($err === true) if ($err === true)
{ // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined { // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined

View File

@ -9,9 +9,9 @@
* User signup * User signup
* *
* $Source: /cvs_backup/e107_0.8/signup.php,v $ * $Source: /cvs_backup/e107_0.8/signup.php,v $
* $Revision: 1.34 $ * $Revision: 1.35 $
* $Date: 2009-03-22 21:07:33 $ * $Date: 2009-04-23 19:13:18 $
* $Author: e107coders $ * $Author: e107steved $
* *
*/ */
@ -484,7 +484,7 @@ if (isset($_POST['register']))
$eufVals = array(); $eufVals = array();
if (isset($_POST['ue'])) if (isset($_POST['ue']))
{ {
$eufVals = $usere->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'],array())); // Validate the extended user fields $eufVals = $usere->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'],array()), TRUE); // Validate the extended user fields
} }