1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-14 11:35:33 +02:00

- for bart to work on...

git-svn-id: file:///svn/phpbb/trunk@4916 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2004-06-15 18:01:59 +00:00
parent 8022b6f6b2
commit 5cb3baf33b
3 changed files with 365 additions and 374 deletions

View File

@ -18,7 +18,7 @@
Taking into consideration Taking into consideration
... admin is NOT able to change the field type later ... admin is NOT able to change the field type later
Admin is able to preview/test the input and output of a profile field at every time. Admin is able to preview/test the input and output of a profile field at any time.
If the admin adds a field, he have to enter at least the default board language params. Without doing so, he If the admin adds a field, he have to enter at least the default board language params. Without doing so, he
is not able to activate the field. is not able to activate the field.
@ -26,9 +26,10 @@
If the default board language is changed, a check has to be made if the profile field language entries are If the default board language is changed, a check has to be made if the profile field language entries are
still valid. still valid.
TODO M-3:
* Show at profile view (yes/no) * Show at profile view (yes/no)
* Viewtopic Integration (Load Switch, Able to show fields with additional template vars populated if enabled) * Viewtopic Integration (Load Switch, Able to show fields with additional template vars populated if enabled)
* Custom Validation (Regex)? * Custom Validation (Regex) - not in 2.2
* Try to build the edit screen with the existing create screen... * Try to build the edit screen with the existing create screen...
*/ */
@ -51,49 +52,6 @@ include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx); include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
// lang_admin - temporary placed here...
$user->lang += array(
'FIELD_INT' => 'Numbers',
'FIELD_STRING' => 'Single Textfield',
'FIELD_TEXT' => 'Textarea',
'FIELD_BOOL' => 'Boolean (Yes/No)',
'FIELD_DROPDOWN'=> 'Dropdown Box',
'FIELD_DATE' => 'Date',
'CUSTOM_PROFILE_FIELDS' => 'Custom Profile Fields',
'NO_FIELD_TYPE' => 'No Field type specified',
'FIRST_OPTION' => 'First Option',
'SECOND_OPTION' => 'Second Option',
'EMPTY_FIELD_NAME' => 'Empty field name',
'EMPTY_USER_FIELD_NAME' => 'Empty Field Name presented to the user',
'FIELD_IDENT_ALREADY_EXIST' => 'Field identifier %s already exist, please choose another Field Name.',
'NEXT_PAGE' => 'Next Page',
'PREVIOUS_PAGE' => 'Previous Page',
'STEP_1_TITLE' => 'Add Profile Field',
'STEP_2_TITLE' => 'Profile type specific options',
'STEP_3_TITLE' => 'Remaining Language Definitions',
'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user',
'REQUIRED_FIELD' => 'Required Field',
'DISPLAY_AT_REGISTRATION' => 'Display at registration screen',
'ROWS' => 'Rows',
'COLUMNS' => 'Columns',
'STEP_X_FROM_X' => 'Step %1$d from %2$d',
'STRING_DEFAULT_VALUE' => 'Default Value',
'TEXT_DEFAULT_VALUE' => 'Default Value',
'STRING_DEFAULT_VALUE_EXPLAIN' => 'Enter a default phrase to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
'TEXT_DEFAULT_VALUE_EXPLAIN'=> 'Enter a default text to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
'BOOL_ENTRIES' => 'Entries',
'DROPDOWN_ENTRIES' => 'Entries',
'BOOL_ENTRIES_EXPLAIN' => 'Enter your options now',
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line',
'HIDE_PROFILE_FIELD' => 'Hide Profile Field',
'HIDE_PROFILE_FIELD_EXPLAIN'=> 'Only Administrators and Moderators are able to see this profile field',
'ADDED_PROFILE_FIELD' => 'Successfully added custom profile field',
'CREATE_NEW_FIELD' => 'Create New Field'
);
if (!$auth->acl_get('a_user')) if (!$auth->acl_get('a_user'))
{ {
trigger_error($user->lang['NO_ADMIN']); trigger_error($user->lang['NO_ADMIN']);
@ -104,7 +62,7 @@ $submit = (isset($_POST['submit'])) ? TRUE : FALSE;
$create = (isset($_POST['create'])) ? TRUE : FALSE; $create = (isset($_POST['create'])) ? TRUE : FALSE;
$error = $notify = array(); $error = $notify = array();
adm_page_header('CUSTOM_PROFILE_FIELDS'); adm_page_header($user->lang['CUSTOM_PROFILE_FIELDS']);
$default_values = array( $default_values = array(
'field_length' => array(FIELD_STRING => 10, FIELD_TEXT => '5|80', FIELD_INT => 5, FIELD_DATE => 10, FIELD_BOOL => 1, FIELD_DROPDOWN => 0), 'field_length' => array(FIELD_STRING => 10, FIELD_TEXT => '5|80', FIELD_INT => 5, FIELD_DATE => 10, FIELD_BOOL => 1, FIELD_DROPDOWN => 0),
@ -123,32 +81,34 @@ $cp = new custom_profile_admin();
// Build Language array // Build Language array
// Based on this, we decide which elements need to be edited later and which language items are missing // Based on this, we decide which elements need to be edited later and which language items are missing
$lang_ids = $lang_entry = $lang_diff = array(); $lang_defs = array();
$result = $db->sql_query('SELECT lang_id FROM ' . LANG_TABLE); $sql = 'SELECT lang_id, lang_iso
FROM ' . LANG_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$lang_ids[] = $row['lang_id']; $lang_defs['id'][] = $row['lang_id'];
$lang_defs['iso'][$row['lang_iso']] = $row['lang_id'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$sql = 'SELECT field_id, lang_id $sql = 'SELECT field_id, lang_id
FROM phpbb_profile_lang FROM ' . PROFILE_LANG_TABLE . '
ORDER BY lang_id'; ORDER BY lang_id';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$lang_entry[$row['field_id']][] = $row['lang_id']; $lang_defs['entry'][$row['field_id']][] = $row['lang_id'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
foreach ($lang_entry as $field_id => $field_ary) foreach ($lang_defs['entry'] as $field_id => $field_ary)
{ {
$lang_diff[$field_id] = array_diff($lang_ids, $field_ary); $lang_defs['diff'][$field_id] = array_diff($lang_defs['id'], $field_ary);
} }
unset($lang_ids);
if ($mode == '') if ($mode == '')
{ {
@ -175,8 +135,11 @@ if ($mode == 'create')
// Get all relevant informations about entered values within all steps // Get all relevant informations about entered values within all steps
// step 1 $exclude = array(
$exclude[1] = array('lang_name', 'lang_explain', 'field_name'); 1 => array('lang_name', 'lang_explain', 'field_name'),
2 => array('field_length', 'pf_preview', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value', 'field_required', 'field_show_on_reg', 'field_hide'),
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
);
// Text-based fields require lang_default_value to be excluded // Text-based fields require lang_default_value to be excluded
if ($field_type == FIELD_STRING || $field_type == FIELD_TEXT) if ($field_type == FIELD_STRING || $field_type == FIELD_TEXT)
@ -190,13 +153,12 @@ if ($mode == 'create')
$exclude[1][] = 'lang_options'; $exclude[1][] = 'lang_options';
} }
$cp->vars['lang_name'] = request_var('lang_name', ''); $cp->vars['lang_name'] = request_var('lang_name', '');
$cp->vars['lang_explain'] = request_var('lang_explain', ''); $cp->vars['lang_explain'] = request_var('lang_explain', '');
$cp->vars['lang_default_value'] = request_var('lang_default_value', ''); $cp->vars['lang_default_value'] = request_var('lang_default_value', '');
$cp->vars['lang_options'] = request_var('lang_options', ''); $cp->vars['lang_options'] = request_var('lang_options', '');
// step 2 // step 2
$exclude[2] = array('field_length', 'pf_preview', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value', 'field_required', 'field_show_on_reg', 'field_hide');
foreach ($exclude[2] as $key) foreach ($exclude[2] as $key)
{ {
$var = request_var($key, $default_values[$key][$field_type]); $var = request_var($key, $default_values[$key][$field_type]);
@ -249,20 +211,11 @@ if ($mode == 'create')
} }
} }
} }
/*
if (($field_type == FIELD_TEXT || $field_type == FIELD_STRING) && $key == 'options')
{
$allow_html = (isset($_REQUEST['allow_html'])) ? 1 : 0;
$allow_bbcode = (isset($_REQUEST['allow_bbcode'])) ? 1 : 0;
$allow_smilies = (isset($_REQUEST['allow_smilies'])) ? 1 : 0;
}
*/
$cp->vars[$key] = $var; $cp->vars[$key] = $var;
} }
// step 3 - all arrays // step 3 - all arrays
$exclude[3] = array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options');
foreach ($exclude[3] as $key) foreach ($exclude[3] as $key)
{ {
$cp->vars[$key] = request_var($key, ''); $cp->vars[$key] = request_var($key, '');
@ -281,8 +234,8 @@ if ($mode == 'create')
$error[] = $user->lang['EMPTY_USER_FIELD_NAME']; $error[] = $user->lang['EMPTY_USER_FIELD_NAME'];
} }
$sql = "SELECT field_ident $sql = 'SELECT field_ident
FROM phpbb_profile_fields FROM ' . PROFILE_FIELDS_TABLE . "
WHERE field_ident = '$field_ident'"; WHERE field_ident = '$field_ident'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -322,46 +275,20 @@ if ($mode == 'create')
continue; continue;
} }
foreach ($key_ary as $key) $s_hidden_fields .= build_hidden_fields($key_ary);
{
$var = $_POST[$key];
if (!$var)
{
continue;
}
if (is_array($var))
{
foreach ($var as $num => $__var)
{
if (is_array($__var))
{
foreach ($__var as $_num => $___var)
{
$s_hidden_fields .= '<input type="hidden" name="' . $key . '[' . $num . '][' . $_num . ']" value="' . stripslashes(htmlspecialchars($___var)) . '" />' . "\n";
}
}
else
{
$s_hidden_fields .= '<input type="hidden" name="' . $key . '[' . $num . ']" value="' . stripslashes(htmlspecialchars($__var)) . '" />' . "\n";
}
}
}
else
{
$s_hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . stripslashes(htmlspecialchars($var)) . '" />' . "\n";
}
}
} }
if (!sizeof($error) && $save && $step == 3) if (!sizeof($error))
{ {
save_profile_field($field_type, $field_ident); if ($step == 3 && (sizeof($lang_defs['iso']) == 1 || $save))
{
save_profile_field($field_type, $field_ident);
}
} }
?> ?>
<p><?php echo sprintf($user->lang['STEP_X_FROM_X'], $step, 3); ?></p> <p><?php echo $user->lang['STEP_' . $step . '_EXPLAIN']; ?></p>
<form name="add_profile_field" method="post" action="admin_profile.<?php echo "$phpEx$SID&amp;mode=$mode&amp;step=$step"; ?>"> <form name="add_profile_field" method="post" action="admin_profile.<?php echo "$phpEx$SID&amp;mode=$mode&amp;step=$step"; ?>">
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
@ -390,22 +317,22 @@ if ($mode == 'create')
// Build common create options // Build common create options
?> ?>
<tr> <tr>
<td class="row1"><b>Field Type: </b><br /><span class="gensmall">You are not able to change this value later.</span></td> <td class="row1"><b><?php echo $user->lang['FIELD_TYPE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FIELD_TYPE_EXPLAIN']; ?></span></td>
<td class="row2"><b><?php echo $user->lang['FIELD_' . strtoupper($cp->profile_types[$field_type])]; ?></b></td> <td class="row2"><b><?php echo $user->lang['FIELD_' . strtoupper($cp->profile_types[$field_type])]; ?></b></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><b>Field Name: </b><br /><span class="gensmall">The Field Name is a name for you to identify the profile field, it is not displayed to the user. You are able to use this name as template variable later.</span></td> <td class="row1"><b><?php echo $user->lang['FIELD_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FIELD_NAME_EXPLAIN']; ?></span></td>
<td class="row2"><input class="post" type="text" name="field_name" size="20" value="<?php echo $cp->vars['field_name']; ?>" /></td> <td class="row2"><input class="post" type="text" name="field_name" size="20" value="<?php echo $cp->vars['field_name']; ?>" /></td>
</tr> </tr>
<tr> <tr>
<th align="center" colspan="2">Language specific options [<b><?php echo $config['default_lang']; ?></b>]</th> <th align="center" colspan="2"><?php echo sprintf($user->lang['LANG_SPECIFIC_OPTIONS'], $config['default_lang']); ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1"><b>Field Name: </b><br /><span class="gensmall">The Field Name presented to the user</span></td> <td class="row1"><b><?php echo $user->lang['USER_FIELD_NAME']; ?>: </b></td>
<td class="row2"><input class="post" type="text" name="lang_name" size="20" value="<?php echo $cp->vars['lang_name']; ?>" /></td> <td class="row2"><input class="post" type="text" name="lang_name" size="20" value="<?php echo $cp->vars['lang_name']; ?>" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1"><b>Field Description: </b><br /><span class="gensmall">The Explanation for this field presented to the user</span></td> <td class="row1"><b><?php echo $user->lang['FIELD_DESCRIPTION']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['FIELD_DESCRIPTION_EXPLAIN']; ?></span></td>
<td class="row2"><textarea name="lang_explain" rows="3" cols="80"><?php echo $cp->vars['lang_explain']; ?></textarea></td> <td class="row2"><textarea name="lang_explain" rows="3" cols="80"><?php echo $cp->vars['lang_explain']; ?></textarea></td>
</tr> </tr>
<?php <?php
@ -414,7 +341,7 @@ if ($mode == 'create')
{ {
?> ?>
<tr> <tr>
<td class="row1"><b><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_DEFAULT_VALUE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN']; ?></span></td> <td class="row1"><b><?php echo $user->lang['DEFAULT_VALUE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_DEFAULT_VALUE_EXPLAIN']; ?></span></td>
<td class="row2"><?php echo ($field_type == FIELD_STRING) ? '<input class="post" type="text" name="lang_default_value" size="20" value="' . $cp->vars['lang_default_value'] . '" />' : '<textarea name="lang_default_value" rows="5" cols="80">' . $cp->vars['lang_default_value'] . '</textarea>'; ?></td> <td class="row2"><?php echo ($field_type == FIELD_STRING) ? '<input class="post" type="text" name="lang_default_value" size="20" value="' . $cp->vars['lang_default_value'] . '" />' : '<textarea name="lang_default_value" rows="5" cols="80">' . $cp->vars['lang_default_value'] . '</textarea>'; ?></td>
</tr> </tr>
<?php <?php
@ -429,14 +356,14 @@ if ($mode == 'create')
} }
?> ?>
<tr> <tr>
<td class="row1"><b><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_ENTRIES']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_ENTRIES_EXPLAIN']; ?></span></td> <td class="row1"><b><?php echo $user->lang['ENTRIES']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang[strtoupper($cp->profile_types[$field_type]) . '_ENTRIES_EXPLAIN']; ?></span></td>
<td class="row2"><?php echo ($field_type == FIELD_DROPDOWN) ? '<textarea name="lang_options" rows="5" cols="80">' . $cp->vars['lang_options'] . '</textarea>' : '<table border=0><tr><td><input name="lang_options[0]" size="20" value="' . $cp->vars['lang_options'][0] . '" class="post" /></td><td>[ ' . $user->lang['FIRST_OPTION'] . ' ]</td></tr><tr><td><input name="lang_options[1]" size="20" value="' . $cp->vars['lang_options'][1] . '" class="post" /></td><td>[ ' . $user->lang['SECOND_OPTION'] . ' ]</td></tr></table>'; ?></td> <td class="row2"><?php echo ($field_type == FIELD_DROPDOWN) ? '<textarea name="lang_options" rows="5" cols="80">' . $cp->vars['lang_options'] . '</textarea>' : '<table border=0><tr><td><input name="lang_options[0]" size="20" value="' . $cp->vars['lang_options'][0] . '" class="post" /></td><td>[ ' . $user->lang['FIRST_OPTION'] . ' ]</td></tr><tr><td><input name="lang_options[1]" size="20" value="' . $cp->vars['lang_options'][1] . '" class="post" /></td><td>[ ' . $user->lang['SECOND_OPTION'] . ' ]</td></tr></table>'; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
<tr> <tr>
<td width="100%" colspan="2" class="cat"><input class="btnlite" type="submit" name="next" value="<?php echo $user->lang['NEXT_PAGE']; ?>" /></td> <td width="100%" colspan="2" class="cat" align="right"><input class="btnlite" type="submit" name="next" value="<?php echo $user->lang['NEXT_PAGE']; ?>" /></td>
</tr> </tr>
<?php echo $s_hidden_fields; ?> <?php echo $s_hidden_fields; ?>
</table> </table>
@ -468,34 +395,14 @@ if ($mode == 'create')
{ {
?> ?>
<tr> <tr>
<td class="row1"><b><?php echo $option_ary['L_NAME']; ?></b><?php echo (isset($option_ary['L_EXPLAIN'])) ? '<br /><span class="gensmall">' . $option_ary['L_EXPLAIN'] . '</span>' : ''; ?></td> <td class="row1"><b><?php echo $option_ary['TITLE']; ?>: </b><?php echo (isset($option_ary['EXPLAIN'])) ? '<br /><span class="gensmall">' . $option_ary['EXPLAIN'] . '</span>' : ''; ?></td>
<td class="row2"><?php echo $option_ary['FIELD']; ?></td> <td class="row2"><?php echo $option_ary['FIELD']; ?></td>
</tr> </tr>
<?php <?php
} }
/*
// Options (HTML, BBCode, Smilies) for various fields...
if ($field_type == FIELD_STRING || $field_type == FIELD_TEXT)
{
?>
<tr>
<td class="row1"><b>Allow HTML: </b></td>
<td class="row2"><input type="checkbox" name="allow_html" value="1"<?php echo ($cp->vars['options'] & 1 << 1) ? ' checked="checked"' : ''; ?> /></td>
</tr>
<tr>
<td class="row1"><b>Allow BBCode: </b></td>
<td class="row2"><input type="checkbox" name="allow_bbcode" value="1"<?php echo ($cp->vars['options'] & 1 << 2) ? ' checked="checked"' : ''; ?> /></td>
</tr>
<tr>
<td class="row1"><b>Allow Smilies: </b></td>
<td class="row2"><input type="checkbox" name="allow_smilies" value="1"<?php echo ($cp->vars['options'] & 1 << 3) ? ' checked="checked"' : ''; ?> /></td>
</tr>
<?php
}
*/
?> ?>
<tr> <tr>
<td width="100%" colspan="2" class="cat"><input class="btnlite" type="submit" name="update" value="<?php echo $user->lang['UPDATE']; ?>" />&nbsp;<input class="btnlite" type="submit" name="prev" value="<?php echo $user->lang['PREVIOUS_PAGE']; ?>" />&nbsp;<input class="btnlite" type="submit" name="next" value="<?php echo $user->lang['NEXT_PAGE']; ?>" /></td> <td width="100%" colspan="2" class="cat"><table border="0" width="100%"><tr><td align="left"><input class="btnlite" type="submit" name="prev" value="<?php echo $user->lang['PREVIOUS_PAGE']; ?>" /></td><td align="right"><input class="btnlite" type="submit" name="update" value="<?php echo $user->lang['UPDATE_PREVIEW']; ?>" />&nbsp;<input class="btnmain" type="submit" name="next" value="<?php echo $user->lang['SAVE']; ?>" /></td></tr></table></td>
</tr> </tr>
<?php echo $s_hidden_fields; ?> <?php echo $s_hidden_fields; ?>
</table> </table>
@ -503,30 +410,31 @@ if ($mode == 'create')
<br /><br /> <br /><br />
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<tr> <tr>
<th align="center" colspan="2">Preview Profile Field</th> <th align="center" colspan="2"><?php echo $user->lang['PREVIEW_PROFILE_FIELD']; ?></th>
</tr> </tr>
<?php <?php
if (!empty($user_error) || $update) if (!empty($user_error) || $update)
{ {
?> <tr> ?> <tr>
<td class="row3" colspan="2"><?php echo (!empty($user_error)) ? '<span style="color:red">' . $user_error . '</span>' : '<span style="color:green">Everything OK</span>'; ?></td> <td class="row3" colspan="2"><?php echo (!empty($user_error)) ? '<span style="color:red">' . $user_error . '</span>' : '<span style="color:green">' . $user->lang['EVERYTHING_OK'] . '</span>'; ?></td>
</tr> </tr>
<?php <?php
} }
$field_data = array( $field_data = array(
'lang_name' => $cp->vars['lang_name'], 'lang_name' => $cp->vars['lang_name'],
'lang_explain' => $cp->vars['lang_explain'], 'lang_explain' => $cp->vars['lang_explain'],
'lang_id' => 1, 'lang_id' => $lang_defs['iso'][$config['default_lang']],
'field_id' => 1, 'field_id' => 1,
'lang_default_value' => $cp->vars['lang_default_value'],
'field_default_value' => $cp->vars['field_default_value'],
'field_ident' => 'preview',
'field_type' => $field_type,
'field_length' => $cp->vars['field_length'], 'lang_default_value' => $cp->vars['lang_default_value'],
'field_maxlen' => $cp->vars['field_maxlen'], 'field_default_value' => $cp->vars['field_default_value'],
'lang_options' => $cp->vars['lang_options'] 'field_ident' => 'preview',
'field_type' => $field_type,
'field_length' => $cp->vars['field_length'],
'field_maxlen' => $cp->vars['field_maxlen'],
'lang_options' => $cp->vars['lang_options']
); );
preview_field($field_data); preview_field($field_data);
@ -547,14 +455,14 @@ if ($mode == 'create')
{ {
?> ?>
<tr> <tr>
<td align="center" class="row3" colspan="2"><?php echo ($lang_ary['lang_iso'] == $config['default_lang']) ? 'Default Language [' . $config['default_lang'] . ']' : 'Language [' . $lang_ary['lang_iso'] . ']'; ?></td> <td align="center" class="row3" colspan="2"><?php echo ($lang_ary['lang_iso'] == $config['default_lang']) ? sprintf($user->lang['DEFAULT_ISO_LANGUAGE'], $config['default_lang']) : sprintf($user->lang['ISO_LANGUAGE'], $lang_ary['lang_iso']) ?></td>
</tr> </tr>
<?php <?php
foreach ($lang_ary['fields'] as $field_name => $field_ary) foreach ($lang_ary['fields'] as $field_name => $field_ary)
{ {
?> ?>
<tr> <tr>
<td class="row1"><b><?php echo $field_ary['L_NAME']; ?></b><?php echo (isset($field_ary['L_EXPLAIN'])) ? '<br /><span class="gensmall">' . $field_ary['L_EXPLAIN'] . '</span>' : ''; ?></td> <td class="row1"><b><?php echo $field_ary['TITLE']; ?>: </b><?php echo (isset($field_ary['EXPLAIN'])) ? '<br /><span class="gensmall">' . $field_ary['EXPLAIN'] . '</span>' : ''; ?></td>
<td class="row2"><?php echo $field_ary['FIELD']; ?></td> <td class="row2"><?php echo $field_ary['FIELD']; ?></td>
</tr> </tr>
<?php <?php
@ -562,7 +470,7 @@ if ($mode == 'create')
} }
?> ?>
<tr> <tr>
<td width="100%" colspan="2" class="cat"><input class="btnlite" type="submit" name="prev" value="<?php echo $user->lang['PREVIOUS_PAGE']; ?>" />&nbsp;<input type="submit" name="save" class="btnmain" value="Save" /></td> <td width="100%" colspan="2" class="cat"><table border="0" width="100%"><tr><td align="left"><input class="btnlite" type="submit" name="prev" value="<?php echo $user->lang['PREVIOUS_PAGE']; ?>" /></td><td align="right"><div style="align:right"><input type="submit" name="save" class="btnmain" value="<?php echo $user->lang['SAVE']; ?>" /></td></tr></table></td>
</tr> </tr>
<?php echo $s_hidden_fields; ?> <?php echo $s_hidden_fields; ?>
</table> </table>
@ -572,10 +480,11 @@ if ($mode == 'create')
} }
} }
// Delete field
if ($mode == 'delete') if ($mode == 'delete')
{ {
$confirm = (isset($_REQUEST['confirm'])) ? true : false; $confirm = (isset($_POST['confirm'])) ? true : false;
$cancel = (isset($_REQUEST['cancel'])) ? true : false; $cancel = (isset($_POST['cancel'])) ? true : false;
$field_id = request_var('field_id', 0); $field_id = request_var('field_id', 0);
if (!$field_id) if (!$field_id)
@ -585,38 +494,46 @@ if ($mode == 'delete')
if ($confirm) if ($confirm)
{ {
$sql = 'SELECT field_ident FROM phpbb_profile_fields WHERE field_id = ' . $field_id; $sql = 'SELECT field_ident
FROM ' . PROFILE_FIELDS_TABLE . "
WHERE field_id = $field_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$field_ident = $db->sql_fetchfield('field_ident', 0, $result); $field_ident = $db->sql_fetchfield('field_ident', 0, $result);
$db->sql_freeresult($result);
$db->sql_query('DELETE FROM phpbb_profile_fields WHERE field_id = ' . $field_id); $db->sql_query('DELETE FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id");
$db->sql_query('DELETE FROM phpbb_profile_fields_lang WHERE field_id = ' . $field_id); $db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id");
$db->sql_query('DELETE FROM phpbb_profile_lang WHERE field_id = ' . $field_id); $db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id");
$db->sql_query('ALTER TABLE ' . CUSTOM_PROFILE_DATA . ' DROP ' . $field_ident); $db->sql_query('ALTER TABLE ' . PROFILE_DATA_TABLE . " DROP $field_ident");
$order = 0; $order = 0;
$sql = 'SELECT * $sql = 'SELECT *
FROM phpbb_profile_fields FROM ' . PROFILE_FIELDS_TABLE . '
ORDER BY field_order'; ORDER BY field_order';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
++$order; $order++;
if ($row['field_order'] != $order) if ($row['field_order'] != $order)
{ {
$db->sql_query("UPDATE phpbb_profile_fields SET field_order = $order WHERE field_id = " . $row['field_id']); $sql = 'UPDATE ' .
PROFILE_FIELDS_TABLE . "
SET field_order = $order
WHERE field_id = {$row['field_id']}";
$db->sql_query($sql);
} }
} }
trigger_error('Successfully deleted profile field.'); // TODO: add_log
trigger_error($user->lang['DELETED_PROFILE_FIELD']);
} }
else if (!$confirm && !$cancel) else if (!$cancel)
{ {
$l_message = '<form method="post" action="admin_profile.' . $phpEx . $SID . '&amp;mode=delete&amp;field_id=' . $field_id . '">' . 'CONFIRM_DELETE_PROFILE_FIELD' . '<br /><br /><input class="btnlite" type="submit" name="confirm" value="' . $user->lang['YES'] . '" />&nbsp;&nbsp;<input class="btnlite" type="submit" name="cancel" value="' . $user->lang['NO'] . '" /></form>'; $l_message = '<form method="post" action="admin_profile.' . $phpEx . $SID . '&amp;mode=delete&amp;field_id=' . $field_id . '">' . $user->lang['CONFIRM_DELETE_PROFILE_FIELD'] . '<br /><br /><input class="btnlite" type="submit" name="confirm" value="' . $user->lang['YES'] . '" />&nbsp;&nbsp;<input class="btnlite" type="submit" name="cancel" value="' . $user->lang['NO'] . '" /></form>';
adm_page_message($user->lang['CONFIRM'], $l_message, false); adm_page_message($user->lang['CONFIRM'], $l_message, false, false);
adm_page_footer(); adm_page_footer();
} }
@ -640,13 +557,18 @@ if ($mode == 'activate')
$default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result); $default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
if (!in_array($default_lang_id, $lang_entry[$field_id])) if (!in_array($default_lang_id, $lang_defs['entry'][$field_id]))
{ {
trigger_error('DEFAULT_LANGUAGE_NOT_FILLED'); trigger_error('DEFAULT_LANGUAGE_NOT_FILLED');
} }
$db->sql_query("UPDATE phpbb_profile_fields SET field_active = 1 WHERE field_id = $field_id"); $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
trigger_error('PROFILE_FIELD_ACTIVATED'); SET field_active = 1
WHERE field_id = $field_id";
$db->sql_query($sql);
// TODO: add_log
trigger_error($user->lang['PROFILE_FIELD_ACTIVATED']);
} }
if ($mode == 'deactivate') if ($mode == 'deactivate')
@ -658,16 +580,21 @@ if ($mode == 'deactivate')
trigger_error('INVALID_MODE'); trigger_error('INVALID_MODE');
} }
$db->sql_query("UPDATE phpbb_profile_fields SET field_active = 0 WHERE field_id = $field_id"); $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
trigger_error('PROFILE_FIELD_DEACTIVATED'); SET field_active = 0
WHERE field_id = $field_id";
$db->sql_query($sql);
// TODO: add_log
trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED']);
} }
if ($mode == 'move_up' || $mode == 'move_down') if ($mode == 'move_up' || $mode == 'move_down')
{ {
$field_order = intval($_GET['order']); $field_order = request_var('order', 0);
$order_total = $field_order * 2 + (($mode == 'move_up') ? -1 : 1); $order_total = $field_order * 2 + (($mode == 'move_up') ? -1 : 1);
$sql = "UPDATE phpbb_profile_fields $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . "
SET field_order = $order_total - field_order SET field_order = $order_total - field_order
WHERE field_order IN ($field_order, " . (($mode == 'move_up') ? $field_order - 1 : $field_order + 1) . ')'; WHERE field_order IN ($field_order, " . (($mode == 'move_up') ? $field_order - 1 : $field_order + 1) . ')';
$db->sql_query($sql); $db->sql_query($sql);
@ -680,14 +607,6 @@ if ($mode == 'manage')
?> ?>
<form name="profile_fields" method="post" action="admin_profile.<?php echo "$phpEx$SID"; ?>"> <form name="profile_fields" method="post" action="admin_profile.<?php echo "$phpEx$SID"; ?>">
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%">
<!--
<tr>
<th align="center" colspan="6"><?php echo $user->lang['CUSTOM_PROFILE_FIELDS']; ?></th>
</tr>
<tr>
<td class="spacer" colspan="6" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
//-->
<tr> <tr>
<th nowrap="nowrap">Name</th> <th nowrap="nowrap">Name</th>
<th nowrap="nowrap">Template Variable</th> <th nowrap="nowrap">Template Variable</th>
@ -697,10 +616,11 @@ if ($mode == 'manage')
</tr> </tr>
<?php <?php
$sql = 'SELECT * $sql = 'SELECT *
FROM phpbb_profile_fields FROM ' . PROFILE_FIELDS_TABLE . '
ORDER BY field_order'; ORDER BY field_order';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row_class = '';
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$row_class = ($row_class == 'row1') ? 'row2' : 'row1'; $row_class = ($row_class == 'row1') ? 'row2' : 'row1';
@ -714,7 +634,7 @@ if ($mode == 'manage')
<td class="<?php echo $row_class; ?>"><?php echo $row['field_ident']; ?></td> <td class="<?php echo $row_class; ?>"><?php echo $row['field_ident']; ?></td>
<td class="<?php echo $row_class; ?>"><?php echo $user->lang['FIELD_' . strtoupper($cp->profile_types[$row['field_type']])]; ?></td> <td class="<?php echo $row_class; ?>"><?php echo $user->lang['FIELD_' . strtoupper($cp->profile_types[$row['field_type']])]; ?></td>
<td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=<?php echo $active_value; ?>&amp;field_id=<?php echo $id; ?>"><?php echo $user->lang[$active_lang]; ?></a></td> <td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=<?php echo $active_value; ?>&amp;field_id=<?php echo $id; ?>"><?php echo $user->lang[$active_lang]; ?></a></td>
<td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=edit&amp;field_id=<?php echo $id; ?>"><?php echo ((sizeof($lang_diff[$row['field_id']])) ? '<span style="color:red">' . $user->lang['EDIT'] . '</span>' : $user->lang['EDIT']) . '</a>' . ((sizeof($lang_diff[$row['field_id']])) ? '</span>' : ''); ?></td> <td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=edit&amp;field_id=<?php echo $id; ?>"><?php echo ((sizeof($lang_defs['diff'][$row['field_id']])) ? '<span style="color:red">' . $user->lang['EDIT'] . '</span>' : $user->lang['EDIT']) . '</a>' . ((sizeof($lang_defs['diff'][$row['field_id']])) ? '</span>' : ''); ?></td>
<td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=delete&amp;field_id=<?php echo $id; ?>"><?php echo $user->lang['DELETE']; ?></a></td> <td class="<?php echo $row_class; ?>"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=delete&amp;field_id=<?php echo $id; ?>"><?php echo $user->lang['DELETE']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=move_up&amp;order=<?php echo $row['field_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> | <a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=move_down&amp;order=<?php echo $row['field_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td> <td class="<?php echo $row_class; ?>" align="center"><a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=move_up&amp;order=<?php echo $row['field_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> | <a href="admin_profile.<?php echo $phpEx . $SID; ?>&amp;mode=move_down&amp;order=<?php echo $row['field_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td>
</tr> </tr>
@ -801,10 +721,14 @@ function build_language_options($field_type, $mode = 'new')
{ {
$lang_options[1]['lang_iso'] = $config['default_lang']; $lang_options[1]['lang_iso'] = $config['default_lang'];
$lang_options[1]['fields'][$field] = array( $lang_options[1]['fields'][$field] = array(
'L_NAME' => 'CP_' . strtoupper($field) . '_TITLE', 'TITLE' => $user->lang['CP_' . strtoupper($field)],
'L_EXPLAIN' => 'CP_' . strtoupper($field) . '_EXPLAIN',
'FIELD' => '<b>' . ((is_array($cp->vars[$field])) ? implode('<br />', $cp->vars[$field]) : str_replace("\n", '<br />', $cp->vars[$field])) . '</b>' 'FIELD' => '<b>' . ((is_array($cp->vars[$field])) ? implode('<br />', $cp->vars[$field]) : str_replace("\n", '<br />', $cp->vars[$field])) . '</b>'
); );
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[1]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
}
} }
} }
@ -824,8 +748,7 @@ function build_language_options($field_type, $mode = 'new')
case 'two_options': case 'two_options':
$lang_options[$lang_id]['fields'][$field] = array( $lang_options[$lang_id]['fields'][$field] = array(
'L_NAME' => 'CP_' . strtoupper($field) . '_TITLE', 'TITLE' => $user->lang['CP_' . strtoupper($field)],
'L_EXPLAIN' => 'CP_' . strtoupper($field) . '_EXPLAIN',
'FIELD' => '<table border=0><tr><td><span class="genmed">' . $user->lang['FIRST_OPTION'] . ': </span></td><td><input name="l_' . $field . '[' . $lang_id . '][]" size="20" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" class="post" /></td></tr><tr><td><span class="genmed">' . $user->lang['SECOND_OPTION'] . ': </span></td><td><input name="l_' . $field . '[' . $lang_id . '][]" size="20" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" class="post" /></td></tr></table>' 'FIELD' => '<table border=0><tr><td><span class="genmed">' . $user->lang['FIRST_OPTION'] . ': </span></td><td><input name="l_' . $field . '[' . $lang_id . '][]" size="20" value="' . ((isset($value[$lang_id][0])) ? $value[$lang_id][0] : $var[0]) . '" class="post" /></td></tr><tr><td><span class="genmed">' . $user->lang['SECOND_OPTION'] . ': </span></td><td><input name="l_' . $field . '[' . $lang_id . '][]" size="20" value="' . ((isset($value[$lang_id][1])) ? $value[$lang_id][1] : $var[1]) . '" class="post" /></td></tr></table>'
); );
break; break;
@ -833,22 +756,30 @@ function build_language_options($field_type, $mode = 'new')
case 'optionfield': case 'optionfield':
$lang_options[$lang_id]['fields'][$field] = array( $lang_options[$lang_id]['fields'][$field] = array(
'L_NAME' => 'CP_' . strtoupper($field) . '_TITLE', 'TITLE' => $user->lang['CP_' . strtoupper($field)],
'L_EXPLAIN' => 'CP_' . strtoupper($field) . '_EXPLAIN',
'FIELD' => '<textarea name="l_' . $field . '[' . $lang_id . ']" rows="7" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea>' 'FIELD' => '<textarea name="l_' . $field . '[' . $lang_id . ']" rows="7" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea>'
); );
break; break;
} }
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
}
} }
else else
{ {
$var = ($mode == 'new') ? $cp->vars[$field] : $cp->vars[$field][$lang_id]; $var = ($mode == 'new') ? $cp->vars[$field] : $cp->vars[$field][$lang_id];
$lang_options[$lang_id]['fields'][$field] = array( $lang_options[$lang_id]['fields'][$field] = array(
'L_NAME' => 'CP_' . strtoupper($field) . '_TITLE', 'TITLE' => $user->lang['CP_' . strtoupper($field)],
'L_EXPLAIN' => 'CP_' . strtoupper($field) . '_EXPLAIN',
'FIELD' => ($field_type == 'string') ? '<input class="post" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" size="20" />' : '<textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea>' 'FIELD' => ($field_type == 'string') ? '<input class="post" type="text" name="l_' . $field . '[' . $lang_id . ']" value="' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '" size="20" />' : '<textarea name="l_' . $field . '[' . $lang_id . ']" rows="3" cols="80">' . ((isset($value[$lang_id])) ? $value[$lang_id] : $var) . '</textarea>'
); );
if (isset($user->lang['CP_' . strtoupper($field) . '_EXPLAIN']))
{
$lang_options[$lang_id]['fields'][$field]['EXPLAIN'] = $user->lang['CP_' . strtoupper($field) . '_EXPLAIN'];
}
} }
} }
} }
@ -858,18 +789,12 @@ function build_language_options($field_type, $mode = 'new')
function save_profile_field($field_type, $field_ident) function save_profile_field($field_type, $field_ident)
{ {
global $cp, $db, $config, $user; global $cp, $db, $config, $user, $lang_defs;
// Collect all informations, if something is going wrong, abort the operation // Collect all informations, if something is going wrong, abort the operation
$profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array(); $profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array();
$sql = 'SELECT lang_id $default_lang_id = $lang_defs['iso'][$config['default_lang']];
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $config['default_lang'] . "'";
$result = $db->sql_query($sql);
$default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result);
$db->sql_freeresult($result);
$result = $db->sql_query('SELECT MAX(field_order) as max_field_order FROM phpbb_profile_fields'); $result = $db->sql_query('SELECT MAX(field_order) as max_field_order FROM phpbb_profile_fields');
$new_field_order = (int) $db->sql_fetchfield('max_field_order', 0, $result); $new_field_order = (int) $db->sql_fetchfield('max_field_order', 0, $result);
@ -890,14 +815,14 @@ function save_profile_field($field_type, $field_ident)
'field_show_on_reg' => $cp->vars['field_show_on_reg'], 'field_show_on_reg' => $cp->vars['field_show_on_reg'],
'field_hide' => $cp->vars['field_hide'], 'field_hide' => $cp->vars['field_hide'],
'field_order' => $new_field_order + 1, 'field_order' => $new_field_order + 1,
'field_active' => 0 'field_active' => 1
); );
$db->sql_query('INSERT INTO phpbb_profile_fields ' . $db->sql_build_array('INSERT', $profile_fields)); $db->sql_query('INSERT INTO phpbb_profile_fields ' . $db->sql_build_array('INSERT', $profile_fields));
$field_id = $db->sql_nextid(); $field_id = $db->sql_nextid();
$sql = 'ALTER TABLE ' . CUSTOM_PROFILE_DATA . " ADD $field_ident "; $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident ";
switch ($field_type) switch ($field_type)
{ {
case FIELD_STRING: case FIELD_STRING:
@ -927,11 +852,11 @@ function save_profile_field($field_type, $field_ident)
$profile_sql[] = $sql; $profile_sql[] = $sql;
$sql_ary = array( $sql_ary = array(
'field_id' => $field_id, 'field_id' => $field_id,
'lang_id' => $default_lang_id, 'lang_id' => $default_lang_id,
'lang_name' => $cp->vars['lang_name'], 'lang_name' => $cp->vars['lang_name'],
'lang_explain' => $cp->vars['lang_explain'], 'lang_explain' => $cp->vars['lang_explain'],
'lang_default_value' => $cp->vars['lang_default_value'] 'lang_default_value' => $cp->vars['lang_default_value']
); );
$profile_sql[] = 'INSERT INTO phpbb_profile_lang ' . $db->sql_build_array('INSERT', $sql_ary); $profile_sql[] = 'INSERT INTO phpbb_profile_lang ' . $db->sql_build_array('INSERT', $sql_ary);
@ -950,20 +875,20 @@ function save_profile_field($field_type, $field_ident)
if (!isset($empty_lang[$lang_id])) if (!isset($empty_lang[$lang_id]))
{ {
$profile_lang[] = array( $profile_lang[] = array(
'field_id' => $field_id, 'field_id' => $field_id,
'lang_id' => $lang_id, 'lang_id' => $lang_id,
'lang_name' => $cp->vars['l_lang_name'][$lang_id], 'lang_name' => $cp->vars['l_lang_name'][$lang_id],
'lang_explain' => $cp->vars['l_lang_explain'][$lang_id], 'lang_explain' => $cp->vars['l_lang_explain'][$lang_id],
'lang_default_value' => $cp->vars['l_lang_default_value'][$lang_id] 'lang_default_value' => $cp->vars['l_lang_default_value'][$lang_id]
); );
} }
} }
} }
$cp->vars['l_lang_name'] = request_var('l_lang_name', ''); $cp->vars['l_lang_name'] = request_var('l_lang_name', '');
$cp->vars['l_lang_explain'] = request_var('l_lang_explain', ''); $cp->vars['l_lang_explain'] = request_var('l_lang_explain', '');
$cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', ''); $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', '');
$cp->vars['l_lang_options'] = request_var('l_lang_options', ''); $cp->vars['l_lang_options'] = request_var('l_lang_options', '');
if (!empty($cp->vars['lang_options'])) if (!empty($cp->vars['lang_options']))
{ {
@ -975,11 +900,11 @@ function save_profile_field($field_type, $field_ident)
foreach ($cp->vars['lang_options'] as $option_id => $value) foreach ($cp->vars['lang_options'] as $option_id => $value)
{ {
$sql_ary = array( $sql_ary = array(
'field_id' => $field_id, 'field_id' => $field_id,
'lang_id' => $default_lang_id, 'lang_id' => $default_lang_id,
'option_id' => $option_id, 'option_id' => $option_id,
'field_type' => $field_type, 'field_type' => $field_type,
'value' => $value 'value' => $value
); );
$profile_sql[] = 'INSERT INTO phpbb_profile_fields_lang ' . $db->sql_build_array('INSERT', $sql_ary); $profile_sql[] = 'INSERT INTO phpbb_profile_fields_lang ' . $db->sql_build_array('INSERT', $sql_ary);
} }
@ -1004,11 +929,11 @@ function save_profile_field($field_type, $field_ident)
foreach ($lang_ary as $option_id => $value) foreach ($lang_ary as $option_id => $value)
{ {
$profile_lang_fields[] = array( $profile_lang_fields[] = array(
'field_id' => $field_id, 'field_id' => $field_id,
'lang_id' => $lang_id, 'lang_id' => $lang_id,
'option_id' => $option_id, 'option_id' => $option_id,
'field_type' => $field_type, 'field_type' => $field_type,
'value' => $value 'value' => $value
); );
} }
} }
@ -1035,8 +960,45 @@ function save_profile_field($field_type, $field_ident)
} }
// $db->sql_transaction('commit'); // $db->sql_transaction('commit');
// TODO: add_log
trigger_error($user->lang['ADDED_PROFILE_FIELD']); trigger_error($user->lang['ADDED_PROFILE_FIELD']);
} }
function build_hidden_fields($key_ary)
{
$hidden_fields = '';
foreach ($key_ary as $key)
{
$var = isset($_POST[$key]) ? $_POST[$key] : false;
if (!$var)
{
continue;
}
if (is_array($var))
{
foreach ($var as $num => $__var)
{
if (is_array($__var))
{
foreach ($__var as $_num => $___var)
{
$hidden_fields .= '<input type="hidden" name="' . $key . '[' . $num . '][' . $_num . ']" value="' . stripslashes(htmlspecialchars($___var)) . '" />' . "\n";
}
}
else
{
$hidden_fields .= '<input type="hidden" name="' . $key . '[' . $num . ']" value="' . stripslashes(htmlspecialchars($__var)) . '" />' . "\n";
}
}
}
else
{
$hidden_fields .= '<input type="hidden" name="' . $key . '" value="' . stripslashes(htmlspecialchars($var)) . '" />' . "\n";
}
}
return $hidden_fields;
}
?> ?>

View File

@ -13,7 +13,6 @@
// TODO for M-3: // TODO for M-3:
// //
// * add real language support [admin]
// * simplify the class (logical seperation between display and insert/update) // * simplify the class (logical seperation between display and insert/update)
class custom_profile class custom_profile
@ -21,13 +20,37 @@ class custom_profile
var $profile_types = array(1 => 'int', 2 => 'string', 3 => 'text', 4 => 'bool', 5 => 'dropdown', 6 => 'date'); var $profile_types = array(1 => 'int', 2 => 'string', 3 => 'text', 4 => 'bool', 5 => 'dropdown', 6 => 'date');
var $options_lang = array(); var $options_lang = array();
// Build language options cache, useful for viewtopic display
function build_cache()
{
global $db, $user;
$this->cache = array();
$sql = 'SELECT l.*, f.*
FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
WHERE l.lang_id = ' . $user->get_iso_lang_id() . '
AND f.field_active = 1
AND f.field_hide = 0
AND l.field_id = f.field_id
GROUP BY f.field_id
ORDER BY f.field_order';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$this->cache[$row['field_ident']] = $row;
}
$db->sql_freeresult($result);
}
// Functions performing operations on register/profile/profile admin // Functions performing operations on register/profile/profile admin
function submit_cp_field($mode, &$cp_data, &$cp_error) function submit_cp_field($mode, &$cp_data, &$cp_error)
{ {
global $auth, $db; global $auth, $db;
$sql = 'SELECT * $sql = 'SELECT *
FROM phpbb_profile_fields FROM ' . PROFILE_FIELDS_TABLE . '
WHERE field_active = 1 WHERE field_active = 1
' . (($mode == 'register') ? ' AND field_show_on_reg = 1' : '') . ' . (($mode == 'register') ? ' AND field_show_on_reg = 1' : '') .
(($auth->acl_gets('a_', 'm_') && $mode == 'profile') ? '' : ' AND field_hide = 0') . ' (($auth->acl_gets('a_', 'm_') && $mode == 'profile') ? '' : ' AND field_hide = 0') . '
@ -46,13 +69,13 @@ class custom_profile
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
// Assign fields to template, mode can be profile (for profile change or register for registration // Assign fields to template, mode can be profile (for profile change) or register (for registration)
function generate_profile_fields($mode, $lang_id, $cp_error) function generate_profile_fields($mode, $lang_id, $cp_error)
{ {
global $db, $template, $auth, $user; global $db, $template, $auth, $user;
$sql = "SELECT l.*, f.* $sql = 'SELECT l.*, f.*
FROM phpbb_profile_lang l, phpbb_profile_fields f FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . " f
WHERE l.lang_id = $lang_id WHERE l.lang_id = $lang_id
AND f.field_active = 1 AND f.field_active = 1
" . (($mode == 'register') ? ' AND f.field_show_on_reg = 1' : '') . " . (($mode == 'register') ? ' AND f.field_show_on_reg = 1' : '') .
@ -74,29 +97,6 @@ class custom_profile
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
function build_cache()
{
global $db, $user;
$this->cache = array();
$sql = 'SELECT l.*, f.*
FROM phpbb_profile_lang l, phpbb_profile_fields f
WHERE l.lang_id = ' . $user->get_iso_lang_id() . '
AND f.field_active = 1
AND f.field_hide = 0
AND l.field_id = f.field_id
GROUP BY f.field_id
ORDER BY f.field_order';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$this->cache[$row['field_ident']] = $row;
}
$db->sql_freeresult($result);
}
// Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled) // Assign fields to template, used for viewprofile, viewtopic and memberlist (if load setting is enabled)
// This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template // This is directly connected to the user -> mode == grab is to grab the user specific fields, mode == show is for assigning the row to the template
function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false) function generate_profile_fields_template($mode, $user_id = 0, $profile_row = false)
@ -121,7 +121,7 @@ class custom_profile
} }
$sql = 'SELECT * $sql = 'SELECT *
FROM phpbb_profile_fields_data FROM ' . PROFILE_DATA_TABLE . '
WHERE user_id IN (' . implode(', ', array_map('intval', $user_id)) . ')'; WHERE user_id IN (' . implode(', ', array_map('intval', $user_id)) . ')';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -179,8 +179,8 @@ class custom_profile
} }
else else
{ {
$sql = "SELECT option_id, value $sql = 'SELECT option_id, value
FROM phpbb_profile_fields_lang FROM ' . PROFILE_FIELDS_LANG_TABLE . "
WHERE field_id = $field_id WHERE field_id = $field_id
AND lang_id = $lang_id AND lang_id = $lang_id
AND field_type = $field_type AND field_type = $field_type
@ -503,7 +503,7 @@ class custom_profile
global $db, $user, $auth; global $db, $user, $auth;
$sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value $sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value
FROM phpbb_profile_lang l, phpbb_profile_fields f FROM ' . PROFILE_LANG_TABLE . ' l, ' . PROFILE_FIELDS_TABLE . ' f
WHERE l.lang_id = ' . $user->get_iso_lang_id() . ' WHERE l.lang_id = ' . $user->get_iso_lang_id() . '
AND f.field_active = 1 AND f.field_active = 1
AND f.field_show_on_reg = 0 AND f.field_show_on_reg = 0
@ -599,16 +599,14 @@ class custom_profile
class custom_profile_admin extends custom_profile class custom_profile_admin extends custom_profile
{ {
var $vars = array(); var $vars = array();
function validate_options()
// GET_* get admin options for second step
function get_string_options()
{ {
global $user; global $user;
$options = array(); $validate_ary = array('CHARS_ANY' => '.*', 'NUMBERS_ONLY' => '[0-9]+', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+');
$validate_ary = array('CHARS_ANY' => '.*', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+');
$validate_options = ''; $validate_options = '';
foreach ($validate_ary as $lang => $value) foreach ($validate_ary as $lang => $value)
{ {
@ -616,19 +614,19 @@ class custom_profile_admin extends custom_profile
$validate_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; $validate_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
} }
return $validate_options;
}
// GET_* get admin options for second step
function get_string_options()
{
global $user;
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input class="post" type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
'L_NAME' => 'Length of input box', 1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input class="post" type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
'FIELD' => '<input class="post" type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), 2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input class="post" type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
1 => array( 3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
'L_NAME' => 'Minimum number of characters entered',
'FIELD' => '<input class="post" type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
2 => array(
'L_NAME' => 'Maximum number of characters entered',
'FIELD' => '<input class="post" type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
3 => array(
'L_NAME' => 'Field Validation',
'FIELD' => '<select name="field_validation">' . $validate_options . '</select>'),
); );
return $options; return $options;
@ -638,30 +636,11 @@ class custom_profile_admin extends custom_profile
{ {
global $user; global $user;
$options = array();
$validate_ary = array('CHARS_ANY' => '.*', 'ALPHA_ONLY' => '[\w]+', 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+');
$validate_options = '';
foreach ($validate_ary as $lang => $value)
{
$selected = ($this->vars['field_validation'] == $value) ? ' selected="selected"' : '';
$validate_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>';
}
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<table border=0><tr><td><input name="rows" size="5" value="' . $this->vars['rows'] . '" class="post" /></td><td>[ ' . $user->lang['ROWS'] . ' ]</td></tr><tr><td><input name="columns" size="5" value="' . $this->vars['columns'] . '" class="post" /></td><td>[ ' . $user->lang['COLUMNS'] . ' ] <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" /></td></tr></table>'),
'L_NAME' => 'Field Length', 1 => array('TITLE' => $user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input class="post" type="text" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'),
'FIELD' => '<table border=0><tr><td><input name="rows" size="5" value="' . $this->vars['rows'] . '" class="post" /></td><td>[ ' . $user->lang['ROWS'] . ' ]</td></tr><tr><td><input name="columns" size="5" value="' . $this->vars['columns'] . '" class="post" /></td><td>[ ' . $user->lang['COLUMNS'] . ' ] <input type="hidden" name="field_length" value="' . $this->vars['field_length'] . '" /></td></tr></table>'), 2 => array('TITLE' => $user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input class="post" type="text" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'),
1 => array( 3 => array('TITLE' => $user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options() . '</select>')
'L_NAME' => 'Minimum number of characters entered',
'FIELD' => '<input class="post" type="text" name="field_minlen" size="10" value="' . $this->vars['field_minlen'] . '" />'),
2 => array(
'L_NAME' => 'Maximum number of characters entered',
'FIELD' => '<input class="post" type="text" name="field_maxlen" size="10" value="' . $this->vars['field_maxlen'] . '" />'),
3 => array(
'L_NAME' => 'Field Validation',
'L_EXPLAIN' => '',
'FIELD' => '<select name="field_validation">' . $validate_options . '</select>'),
); );
return $options; return $options;
@ -672,18 +651,10 @@ class custom_profile_admin extends custom_profile
global $user; global $user;
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['FIELD_LENGTH'], 'FIELD' => '<input class="post" type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'),
'L_NAME' => 'Length of input box', 1 => array('TITLE' => $user->lang['MIN_FIELD_NUMBER'], 'FIELD' => '<input class="post" type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
'FIELD' => '<input class="post" type="text" name="field_length" size="5" value="' . $this->vars['field_length'] . '" />'), 2 => array('TITLE' => $user->lang['MAX_FIELD_NUMBER'], 'FIELD' => '<input class="post" type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
1 => array( 3 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => '<input class="post" type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />')
'L_NAME' => 'Lowest allowed number',
'FIELD' => '<input class="post" type="text" name="field_minlen" size="5" value="' . $this->vars['field_minlen'] . '" />'),
2 => array(
'L_NAME' => 'highest allowed number',
'FIELD' => '<input class="post" type="text" name="field_maxlen" size="5" value="' . $this->vars['field_maxlen'] . '" />'),
3 => array(
'L_NAME' => 'Default Value',
'FIELD' => '<input class="post" type="post" name="field_default_value" value="' . $this->vars['field_default_value'] . '" />'),
); );
return $options; return $options;
@ -691,36 +662,25 @@ class custom_profile_admin extends custom_profile
function get_bool_options() function get_bool_options()
{ {
global $user, $config, $db; global $user, $config, $lang_defs;
$sql = 'SELECT lang_id $default_lang_id = $lang_defs['iso'][$config['default_lang']];
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $config['default_lang'] . "'";
$result = $db->sql_query($sql);
$default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result);
$db->sql_freeresult($result);
$profile_row = array( $profile_row = array(
'var_name' => 'field_default_value', 'var_name' => 'field_default_value',
'lang_name' => $this->vars['lang_name'], 'lang_name' => $this->vars['lang_name'],
'lang_explain' => $this->vars['lang_explain'], 'lang_explain' => $this->vars['lang_explain'],
'lang_id' => $default_lang_id, 'lang_id' => $default_lang_id,
'field_default_value' => $this->vars['field_default_value'], 'field_default_value' => $this->vars['field_default_value'],
'field_ident' => 'field_default_value', 'field_ident' => 'field_default_value',
'field_type' => FIELD_BOOL, 'field_type' => FIELD_BOOL,
'field_length' => $this->vars['field_length'], 'field_length' => $this->vars['field_length'],
'lang_options' => $this->vars['lang_options'] 'lang_options' => $this->vars['lang_options']
); );
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['FIELD_TYPE'], 'EXPLAIN' => $user->lang['BOOL_TYPE_EXPLAIN'], 'FIELD' => '<input type="radio" name="field_length" value="1"' . (($this->vars['field_length'] == 1) ? ' checked="checked"' : '') . ' />' . $user->lang['RADIO_BUTTONS'] . '&nbsp; &nbsp;<input type="radio" name="field_length" value="2"' . (($this->vars['field_length'] == 2) ? ' checked="checked"' : '') . ' />' . $user->lang['CHECKBOX'] . '&nbsp; &nbsp;'),
'L_NAME' => 'Field Type', 1 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->generate_bool($profile_row, true))
'L_EXPLAIN' => 'Define the Type, either a checkbox or radio buttons',
'FIELD' => '<input type="radio" name="field_length" value="1"' . (($this->vars['field_length'] == 1) ? ' checked="checked"' : '') . ' />Radio Buttons&nbsp; &nbsp;<input type="radio" name="field_length" value="2"' . (($this->vars['field_length'] == 2) ? ' checked="checked"' : '') . ' />Checkbox&nbsp; &nbsp;'),
1 => array(
'L_NAME' => 'Default Value',
'FIELD' => $this->generate_bool($profile_row, true)),
); );
return $options; return $options;
@ -728,25 +688,20 @@ class custom_profile_admin extends custom_profile
function get_dropdown_options() function get_dropdown_options()
{ {
global $user, $config, $db; global $user, $config, $lang_defs;
$sql = 'SELECT lang_id $default_lang_id = $lang_defs['iso'][$config['default_lang']];
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $config['default_lang'] . "'";
$result = $db->sql_query($sql);
$default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result);
$db->sql_freeresult($result);
$profile_row[0] = array( $profile_row[0] = array(
'var_name' => 'field_default_value', 'var_name' => 'field_default_value',
'field_id' => 1, 'field_id' => 1,
'lang_name' => $this->vars['lang_name'], 'lang_name' => $this->vars['lang_name'],
'lang_explain' => $this->vars['lang_explain'], 'lang_explain' => $this->vars['lang_explain'],
'lang_id' => $default_lang_id, 'lang_id' => $default_lang_id,
'field_default_value' => $this->vars['field_default_value'], 'field_default_value' => $this->vars['field_default_value'],
'field_ident' => 'field_default_value', 'field_ident' => 'field_default_value',
'field_type' => FIELD_DROPDOWN, 'field_type' => FIELD_DROPDOWN,
'lang_options' => $this->vars['lang_options'] 'lang_options' => $this->vars['lang_options']
); );
$profile_row[1] = $profile_row[0]; $profile_row[1] = $profile_row[0];
@ -754,13 +709,8 @@ class custom_profile_admin extends custom_profile
$profile_row[1]['field_ident'] = 'field_no_value'; $profile_row[1]['field_ident'] = 'field_no_value';
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->generate_dropdown($profile_row[0], true)),
'L_NAME' => 'Default Value', 1 => array('TITLE' => $user->lang['NO_VALUE_OPTION'], 'EXPLAIN' => $user->lang['NO_VALUE_OPTION_EXPLAIN'], 'FIELD' => $this->generate_dropdown($profile_row[1], true))
'FIELD' => $this->generate_dropdown($profile_row[0], true)),
1 => array(
'L_NAME' => 'No Value',
'L_EXPLAIN' => 'Value for a non-entry. If the field is required, the user gets an error if he choose the option selected here',
'FIELD' => $this->generate_dropdown($profile_row[1], true)),
); );
return $options; return $options;
@ -768,30 +718,23 @@ class custom_profile_admin extends custom_profile
function get_date_options() function get_date_options()
{ {
global $user, $config, $db; global $user, $config, $lang_defs;
$sql = 'SELECT lang_id $default_lang_id = $lang_defs['iso'][$config['default_lang']];
FROM ' . LANG_TABLE . "
WHERE lang_iso = '" . $config['default_lang'] . "'";
$result = $db->sql_query($sql);
$default_lang_id = (int) $db->sql_fetchfield('lang_id', 0, $result);
$db->sql_freeresult($result);
$profile_row = array( $profile_row = array(
'var_name' => 'field_default_value', 'var_name' => 'field_default_value',
'lang_name' => $this->vars['lang_name'], 'lang_name' => $this->vars['lang_name'],
'lang_explain' => $this->vars['lang_explain'], 'lang_explain' => $this->vars['lang_explain'],
'lang_id' => $default_lang_id, 'lang_id' => $default_lang_id,
'field_default_value' => $this->vars['field_default_value'], 'field_default_value' => $this->vars['field_default_value'],
'field_ident' => 'field_default_value', 'field_ident' => 'field_default_value',
'field_type' => FIELD_DATE, 'field_type' => FIELD_DATE,
'field_length' => $this->vars['field_length'] 'field_length' => $this->vars['field_length']
); );
$options = array( $options = array(
0 => array( 0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->generate_date($profile_row, true) . '<br /><input type="checkbox" name="always_now"' . ((isset($_REQUEST['always_now']) || $this->vars['field_default_value'] == 'now') ? ' checked="checked"' : '') . ' />&nbsp; ' . $user->lang['ALWAYS_TODAY'])
'L_NAME' => 'Default Value',
'FIELD' => $this->generate_date($profile_row, true) . '<br /><input type="checkbox" name="always_now"' . ((isset($_REQUEST['always_now']) || $this->vars['field_default_value'] == 'now') ? ' checked="checked"' : '') . ' />&nbsp; Always the current date'),
); );
return $options; return $options;

View File

@ -2023,4 +2023,90 @@ $lang += array(
'ERR_BOT_NO_IP' => 'The IP addresses you supplied were invalid or the hostname could not be resolved.', 'ERR_BOT_NO_IP' => 'The IP addresses you supplied were invalid or the hostname could not be resolved.',
); );
// Custom profile fields
$lang += array(
'FIELD_INT' => 'Numbers',
'FIELD_STRING' => 'Single Textfield',
'FIELD_TEXT' => 'Textarea',
'FIELD_BOOL' => 'Boolean (Yes/No)',
'FIELD_DROPDOWN'=> 'Dropdown Box',
'FIELD_DATE' => 'Date',
'NO_FIELD_TYPE' => 'No Field type specified',
'FIRST_OPTION' => 'First Option',
'SECOND_OPTION' => 'Second Option',
'EMPTY_FIELD_NAME' => 'Empty field name',
'EMPTY_USER_FIELD_NAME' => 'Empty Field Name presented to the user',
'FIELD_IDENT_ALREADY_EXIST' => 'Field identifier %s already exist, please choose another Field Name.',
'NEXT_PAGE' => 'Next Page',
'PREVIOUS_PAGE' => 'Previous Page',
'STEP_1_TITLE' => 'Add Profile Field',
'STEP_1_EXPLAIN' => 'Here you can enter the first basic parameters of your new profile field. These informations are needed for the second step where you are able to set remaining options and where you are able to preview and tweak your profile field further.',
'STEP_2_TITLE' => 'Profile type specific options',
'STEP_2_EXPLAIN' => 'Here you are able to define some common options. Further you are able to preview the field you generated, as the user will see it. Play around with it until you are satisfied as how the field behaves.',
'STEP_3_TITLE' => 'Remaining Language Definitions',
'STEP_3_EXPLAIN' => 'Since you have more than one board language installed, you have to fill out the remaining language items too. The profile field will work with the default language enabled, you are able to fill out the remaining language items later too.',
'ROWS' => 'Rows',
'COLUMNS' => 'Columns',
'UPDATE_PREVIEW' => 'Update Preview',
'PREVIEW_PROFILE_FIELD' => 'Preview Profile Field',
'EVERYTHING_OK' => 'Everything OK',
'STRING_DEFAULT_VALUE_EXPLAIN' => 'Enter a default phrase to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
'TEXT_DEFAULT_VALUE_EXPLAIN'=> 'Enter a default text to be displayed, a default value. Leave empty if you want to show it empty at the first place.',
'BOOL_ENTRIES_EXPLAIN' => 'Enter your options now',
'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line',
'REQUIRED_FIELD' => 'Required Field',
'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user',
'DISPLAY_AT_REGISTRATION' => 'Display at registration screen',
'HIDE_PROFILE_FIELD' => 'Hide Profile Field',
'HIDE_PROFILE_FIELD_EXPLAIN'=> 'Only Administrators and Moderators are able to see/fill out this profile field',
'ADDED_PROFILE_FIELD' => 'Successfully added custom profile field',
'CREATE_NEW_FIELD' => 'Create New Field',
'DELETED_PROFILE_FIELD' => 'Successfully deleted profile field.',
'CONFIRM_DELETE_PROFILE_FIELD' => 'Are you sure you want to delete this profile field?',
'PROFILE_FIELD_ACTIVATED' => 'Profile field successfully activated',
'PROFILE_FIELD_DEACTIVATED' => 'Profile field successfully deactivated',
'CHARS_ANY' => 'Any character',
'NUMBERS_ONLY' => 'Only numbers (0-9)',
'ALPHA_ONLY' => 'Alphanumeric only',
'ALPHA_SPACERS' => 'Alphanumeric and spacers',
'FIELD_TYPE' => 'Field Type',
'FIELD_TYPE_EXPLAIN' => 'You are not able to change the field type later.',
'FIELD_NAME' => 'Field Name',
'FIELD_NAME_EXPLAIN' => 'The Field Name is a name for you to identify the profile field, it is not displayed to the user. You are able to use this name as template variable later.',
'LANG_SPECIFIC_OPTIONS' => 'Language specific options [<b>%s</b>]',
'USER_FIELD_NAME' => 'Field Name presented to the user',
'FIELD_DESCRIPTION' => 'Field Description',
'FIELD_DESCRIPTION_EXPLAIN' => 'The Explanation for this field presented to the user',
'CP_LANG_NAME' => 'Field Name presented to the user',
'CP_LANG_EXPLAIN' => 'Field Description',
'CP_LANG_EXPLAIN_EXPLAIN' => 'The Explanation for this field presented to the user',
'CP_LANG_DEFAULT_VALUE' => 'Default Value',
'CP_LANG_OPTIONS' => 'Options',
'FIELD_LENGTH' => 'Length of input box',
'MIN_FIELD_CHARS' => 'Minimum number of characters',
'MAX_FIELD_CHARS' => 'Maximum number of characters',
'MIN_FIELD_NUMBER' => 'Lowest allowed number',
'MAX_FIELD_NUMBER' => 'Highest allowed number',
'DEFAULT_VALUE' => 'Default Value',
'FIELD_VALIDATION' => 'Field Validation',
'ENTRIES' => 'Entries',
'BOOL_TYPE_EXPLAIN' => 'Define the Type, either a checkbox or radio buttons',
'RADIO_BUTTONS' => 'Radio Buttons',
'CHECKBOX' => 'Checkbox',
'NO_VALUE_OPTION' => 'Option equal to non entered value',
'NO_VALUE_OPTION_EXPLAIN' => 'Value for a non-entry. If the field is required, the user gets an error if he choose the option selected here',
'ALWAYS_TODAY' => 'Always the current date',
'DEFAULT_ISO_LANGUAGE' => 'Default Language [%s]',
'ISO_LANGUAGE' => 'Language [%s]',
);
?> ?>