1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-07 08:05:25 +02:00

do this the proper way

git-svn-id: file:///svn/phpbb/trunk@8300 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2008-01-03 19:12:41 +00:00
parent 6b8f2fb4cc
commit edd6c34eda
2 changed files with 16 additions and 16 deletions

View File

@ -729,7 +729,7 @@ class acp_profile
'S_FIELD_NO_VIEW' => ($cp->vars['field_no_view']) ? true : false,
'L_LANG_SPECIFIC' => sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']),
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::profile_types[$field_type])],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$field_type])],
'FIELD_IDENT' => $cp->vars['field_ident'],
'LANG_NAME' => $cp->vars['lang_name'],
'LANG_EXPLAIN' => $cp->vars['lang_explain'])
@ -742,7 +742,7 @@ class acp_profile
'S_TEXT' => ($field_type == FIELD_TEXT) ? true : false,
'S_STRING' => ($field_type == FIELD_STRING) ? true : false,
'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper(custom_profile::profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'],
'L_DEFAULT_VALUE_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN'],
'LANG_DEFAULT_VALUE' => $cp->vars['lang_default_value'])
);
}
@ -769,7 +769,7 @@ class acp_profile
'S_BOOL' => ($field_type == FIELD_BOOL) ? true : false,
'S_DROPDOWN' => ($field_type == FIELD_DROPDOWN) ? true : false,
'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper(custom_profile::profile_types[$field_type]) . '_ENTRIES_EXPLAIN'],
'L_LANG_OPTIONS_EXPLAIN' => $user->lang[strtoupper(custom_profile::$profile_types[$field_type]) . '_ENTRIES_EXPLAIN'],
'LANG_OPTIONS' => ($field_type == FIELD_DROPDOWN) ? implode("\n", $cp->vars['lang_options']) : '',
'FIRST_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][0] : '',
'SECOND_LANG_OPTION' => ($field_type == FIELD_BOOL) ? $cp->vars['lang_options'][1] : '')
@ -786,7 +786,7 @@ class acp_profile
);
// Build options based on profile type
$function = 'get_' . custom_profile::profile_types[$field_type] . '_options';
$function = 'get_' . custom_profile::$profile_types[$field_type] . '_options';
$options = $cp->$function();
foreach ($options as $num => $option_ary)
@ -851,7 +851,7 @@ class acp_profile
$template->assign_block_vars('fields', array(
'FIELD_IDENT' => $row['field_ident'],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::profile_types[$row['field_type']])],
'FIELD_TYPE' => $user->lang['FIELD_' . strtoupper(custom_profile::$profile_types[$row['field_type']])],
'L_ACTIVATE_DEACTIVATE' => $user->lang[$active_lang],
'U_ACTIVATE_DEACTIVATE' => $this->u_action . "&action=$active_value&field_id=$id",
@ -873,7 +873,7 @@ class acp_profile
}
$s_select_type = '';
foreach (custom_profile::profile_types as $key => $value)
foreach (custom_profile::$profile_types as $key => $value)
{
$s_select_type .= '<option value="' . $key . '">' . $user->lang['FIELD_' . strtoupper($value)] . '</option>';
}

View File

@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
*/
class custom_profile
{
public $profile_types = array(FIELD_INT => 'int', FIELD_STRING => 'string', FIELD_TEXT => 'text', FIELD_BOOL => 'bool', FIELD_DROPDOWN => 'dropdown', FIELD_DATE => 'date');
public static $profile_types = array(FIELD_INT => 'int', FIELD_STRING => 'string', FIELD_TEXT => 'text', FIELD_BOOL => 'bool', FIELD_DROPDOWN => 'dropdown', FIELD_DATE => 'date');
private $profile_cache = array();
private $options_lang = array();
@ -453,7 +453,7 @@ class custom_profile
$value = $ident_ary['value'];
$field_type = $ident_ary['data']['field_type'];
switch (self::profile_types[$field_type])
switch (self::$profile_types[$field_type])
{
case 'int':
if ($value == '')
@ -616,7 +616,7 @@ class custom_profile
global $template;
$profile_row['field_value'] = $this->get_var('int', $profile_row, $profile_row['field_default_value'], $preview);
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
}
/**
@ -675,7 +675,7 @@ class custom_profile
unset($now);
$profile_row['field_value'] = 0;
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
}
/**
@ -689,7 +689,7 @@ class custom_profile
$value = $this->get_var('int', $profile_row, $profile_row['field_default_value'], $preview);
$profile_row['field_value'] = $value;
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
if ($profile_row['field_length'] == 1)
{
@ -718,7 +718,7 @@ class custom_profile
global $template;
$profile_row['field_value'] = $this->get_var('string', $profile_row, $profile_row['lang_default_value'], $preview);
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
}
/**
@ -735,7 +735,7 @@ class custom_profile
$profile_row['field_cols'] = $field_length[1];
$profile_row['field_value'] = $this->get_var('string', $profile_row, $profile_row['lang_default_value'], $preview);
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
}
/**
@ -754,7 +754,7 @@ class custom_profile
}
$profile_row['field_value'] = $value;
$template->assign_block_vars(self::profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
$template->assign_block_vars(self::$profile_types[$profile_row['field_type']], array_change_key_case($profile_row, CASE_UPPER));
foreach ($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']] as $option_id => $option_value)
{
@ -783,13 +783,13 @@ class custom_profile
);
// empty previously filled blockvars
foreach (self::profile_types as $field_case => $field_type)
foreach (self::$profile_types as $field_case => $field_type)
{
$template->destroy_block_vars($field_type);
}
// Assign template variables
$type_func = 'generate_' . self::profile_types[$profile_row['field_type']];
$type_func = 'generate_' . self::$profile_types[$profile_row['field_type']];
$this->$type_func($profile_row, $preview);
// Return templated data