1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

User extended fields validation working again on signup

This commit is contained in:
secretr
2012-06-02 14:36:22 +00:00
parent 0ccd0f7622
commit a30c2941da
3 changed files with 16 additions and 9 deletions

View File

@@ -281,21 +281,23 @@ class e107_user_extended
global $tp;
$eufVals = array(); // 'Answer' array
$hideFlags = array();
foreach ($this->fieldDefinitions as $k => $defs)
{
$category = $defs['user_extended_struct_parent'];
if (($category == 0) || (check_class($this->catDefinitions[$category]['user_extended_struct_applicable']) && check_class($this->catDefinitions[$category]['user_extended_struct_write'])))
if (($category == 0) || ($isSignup && (int) $this->catDefinitions[$category]['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $this->catDefinitions[$category]['user_extended_struct_write'] === (int) e_UC_MEMBER) || (check_class($this->catDefinitions[$category]['user_extended_struct_applicable']) && check_class($this->catDefinitions[$category]['user_extended_struct_write'])))
{ // Category applicable to user
if (check_class($defs['user_extended_struct_applicable']) && check_class($defs['user_extended_struct_write']))
if (($isSignup && (int) $defs['user_extended_struct_applicable'] === (int) e_UC_MEMBER && (int) $defs['user_extended_struct_write'] === (int) e_UC_MEMBER) || (check_class($defs['user_extended_struct_applicable']) && check_class($defs['user_extended_struct_write'])))
{ // User can also update field
$f = 'user_'.$defs['user_extended_struct_name'];
if (isset($inArray[$f]) || ($isSignup && ($defs['user_extended_struct_required'] == 1)))
{ // Only allow valid keys
$val = varset($inArray[$f], FALSE);
$err = $this->user_extended_validate_entry($val, $defs);
$err = $this->user_extended_validate_entry($val, $defs);
if ($err === true)
{ // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined
$eufVals['errortext'][$f] = str_replace('--SOMETHING--',$tp->toHtml($defs['user_extended_struct_text'],FALSE,'defs'),LAN_USER_75);
$eufVals['errortext'][$f] = str_replace('--SOMETHING--',$tp->toHtml(defset($defs['user_extended_struct_text'], $defs['user_extended_struct_text']),FALSE,'defs'),LAN_USER_75);
$eufVals['errors'][$f] = ERR_GENERIC;
}
elseif ($err)

View File

@@ -1376,6 +1376,10 @@ class validatorClass
{
$curLine = str_replace('%t', constant($constPrefix.$n), $curLine); // Standard messages
}
if(empty($vars['failed'][$f]))
{
$vars['failed'][$f] = LAN_VALIDATE_191;
}
$curLine = str_replace('%v', htmlentities($vars['failed'][$f]),$curLine);
$curLine = str_replace('%f', $f, $curLine);
if ($checkNice & isset($niceNames[$f]['niceName']))

View File

@@ -468,15 +468,15 @@ if (isset($_POST['register']))
// Validate Extended User Fields.
$eufVals = array();
if (isset($_POST['ue']))
//if (isset($_POST['ue']))
{
$eufVals = $usere->userExtendedValidateAll($_POST['ue'], varset($_POST['hide'],array()), TRUE); // Validate the extended user fields
$eufVals = $usere->userExtendedValidateAll(varset($_POST['ue'], array()), varset($_POST['hide'],array()), TRUE); // Validate the extended user fields
}
// Determine whether we have an error
$error = ((isset($allData['errors']) && count($allData['errors'])) || (isset($eufVals['errors']) && count($eufVals['errors'])) || count($extraErrors));
// All validated here - handle any errors
if ($error)
{
@@ -490,10 +490,11 @@ if (isset($_POST['register']))
{
$temp[] = validatorClass::makeErrorList($allData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
}
if (varsettrue($eufData['errors']))
if (varsettrue($eufVals['errors']))
{
$temp[] = validatorClass::makeErrorList($eufData,'USER_ERR_','%n - %x - %t: %v', '<br />', $userMethods->userVettingInfo);
$temp[] = validatorClass::makeErrorList($eufVals,'USER_ERR_','%n - %t: %v', '<br />');
}
message_handler('P_ALERT', implode('<br />', $temp));
}
} // End of data validation