Line 149 | Line 149 |
---|
case FIELD_DROPDOWN: $field_value = (int) $field_value;
|
case FIELD_DROPDOWN: $field_value = (int) $field_value;
|
| // retrieve option lang data if necessary if (!isset($this->options_lang[$field_data['field_id']]) || !isset($this->options_lang[$field_data['field_id']][$field_data['lang_id']]) || !sizeof($this->options_lang[$file_data['field_id']][$field_data['lang_id']])) { $this->get_option_lang($field_data['field_id'], $field_data['lang_id'], FIELD_DROPDOWN, false); }
if (!isset($this->options_lang[$field_data['field_id']][$field_data['lang_id']][$field_value])) { return 'FIELD_INVALID_VALUE'; }
|
if ($field_value == $field_data['field_novalue'] && $field_data['field_required']) {
| if ($field_value == $field_data['field_novalue'] && $field_data['field_required']) {
|
Line 302 | Line 313 |
---|
switch ($cp_result) { case 'FIELD_INVALID_DATE':
|
switch ($cp_result) { case 'FIELD_INVALID_DATE':
|
| case 'FIELD_INVALID_VALUE':
|
case 'FIELD_REQUIRED': $error = sprintf($user->lang[$cp_result], $row['lang_name']); break;
| case 'FIELD_REQUIRED': $error = sprintf($user->lang[$cp_result], $row['lang_name']); break;
|
Line 443 | Line 455 |
---|
$db->sql_freeresult($result);
$user_fields = array();
|
$db->sql_freeresult($result);
$user_fields = array();
|
| $user_ids = $user_id;
|
// Go through the fields in correct order foreach (array_keys($this->profile_cache) as $used_ident)
| // Go through the fields in correct order foreach (array_keys($this->profile_cache) as $used_ident)
|
Line 451 | Line 465 |
---|
{ $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident];
|
{ $user_fields[$user_id][$used_ident]['value'] = $row['pf_' . $used_ident]; $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident];
|
| }
foreach ($user_ids as $user_id) { if (!isset($user_fields[$user_id][$used_ident]) && $this->profile_cache[$used_ident]['field_show_novalue']) { $user_fields[$user_id][$used_ident]['value'] = ''; $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident]; }
|
} }
| } }
|
Line 509 | Line 532 |
---|
switch ($this->profile_types[$field_type]) { case 'int':
|
switch ($this->profile_types[$field_type]) { case 'int':
|
if ($value === '')
| if (($value === '' || $value === null) && !$ident_ary['data']['field_show_novalue'])
|
{ return NULL; }
| { return NULL; }
|
Line 518 | Line 541 |
---|
case 'string': case 'text':
|
case 'string': case 'text':
|
if (!$value)
| if (!$value && !$ident_ary['data']['field_show_novalue'])
|
{ return NULL; }
| { return NULL; }
|
Line 536 | Line 559 |
---|
$month = (isset($date[1])) ? (int) $date[1] : 0; $year = (isset($date[2])) ? (int) $date[2] : 0;
|
$month = (isset($date[1])) ? (int) $date[1] : 0; $year = (isset($date[2])) ? (int) $date[2] : 0;
|
if (!$day && !$month && !$year)
| if (!$day && !$month && !$year && !$ident_ary['data']['field_show_novalue'])
|
{ return NULL; }
| { return NULL; }
|
Line 559 | Line 582 |
---|
$this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false); }
|
$this->get_option_lang($field_id, $lang_id, FIELD_DROPDOWN, false); }
|
if ($value == $ident_ary['data']['field_novalue'])
| if ($value == $ident_ary['data']['field_novalue'] && !$ident_ary['data']['field_show_novalue'])
|
{ return NULL; }
| { return NULL; }
|
Line 568 | Line 591 |
---|
// User not having a value assigned if (!isset($this->options_lang[$field_id][$lang_id][$value]))
|
// User not having a value assigned if (!isset($this->options_lang[$field_id][$lang_id][$value]))
|
| { if ($ident_ary['data']['field_show_novalue']) { $value = $ident_ary['data']['field_novalue']; } else
|
{ return NULL;
|
{ return NULL;
|
| }
|
}
return $this->options_lang[$field_id][$lang_id][$value];
| }
return $this->options_lang[$field_id][$lang_id][$value];
|
Line 581 | Line 611 |
---|
if (!isset($this->options_lang[$field_id][$lang_id])) { $this->get_option_lang($field_id, $lang_id, FIELD_BOOL, false);
|
if (!isset($this->options_lang[$field_id][$lang_id])) { $this->get_option_lang($field_id, $lang_id, FIELD_BOOL, false);
|
| }
if (!$value && $ident_ary['data']['field_show_novalue']) { $value = $ident_ary['data']['field_default_value'];
|
}
if ($ident_ary['data']['field_length'] == 1)
| }
if ($ident_ary['data']['field_length'] == 1)
|
Line 613 | Line 648 |
---|
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; $user_ident = $profile_row['field_ident'];
|
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident']; $user_ident = $profile_row['field_ident'];
|
// checkbox - only testing for isset
| // checkbox - set the value to "true" if it has been set to 1
|
if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2) {
|
if ($profile_row['field_type'] == FIELD_BOOL && $profile_row['field_length'] == 2) {
|
$value = (isset($_REQUEST[$profile_row['field_ident']])) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
| $value = (isset($_REQUEST[$profile_row['field_ident']]) && request_var($profile_row['field_ident'], $default_value) == 1) ? true : ((!isset($user->profile_fields[$user_ident]) || $preview) ? $default_value : $user->profile_fields[$user_ident]);
|
} else if ($profile_row['field_type'] == FIELD_INT) {
| } else if ($profile_row['field_type'] == FIELD_INT) {
|