aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/acp/acp_profile.php25
-rw-r--r--phpBB/phpbb/profilefields/lang_helper.php10
-rw-r--r--phpBB/phpbb/profilefields/type/type_bool.php20
-rw-r--r--phpBB/phpbb/profilefields/type/type_date.php18
-rw-r--r--phpBB/phpbb/profilefields/type/type_dropdown.php15
-rw-r--r--phpBB/phpbb/profilefields/type/type_int.php15
-rw-r--r--phpBB/phpbb/profilefields/type/type_interface.php10
-rw-r--r--phpBB/phpbb/profilefields/type/type_string_common.php13
8 files changed, 99 insertions, 27 deletions
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 6ee051e37b..63f5a0e1f5 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -840,7 +840,7 @@ class acp_profile
// Build options based on profile type
$profile_field = $phpbb_container->get('profilefields.type.' . $cp->profile_types[$field_type]);
- $options = $profile_field->get_options($this->lang_defs, $cp->vars);
+ $options = $profile_field->get_options($this->lang_defs['iso'][$config['default_lang']], $cp->vars);
foreach ($options as $num => $option_ary)
{
@@ -1101,13 +1101,14 @@ class acp_profile
$db->sql_query($sql);
}
+ $type_collection = $phpbb_container->get('profilefields.type_collection');
+ $profile_type = $type_collection['profilefields.type.' . $cp->profile_types[$field_type]];
+
if ($action == 'create')
{
$field_ident = 'pf_' . $field_ident;
$db_tools = $phpbb_container->get('dbal.tools');
- $type_collection = $phpbb_container->get('profilefields.type_collection');
- $profile_type = $type_collection['profilefields.type.' . $cp->profile_types[$field_type]];
list($sql_type, $null) = $db_tools->get_column_type($profile_type->get_database_column_type());
$profile_sql[] = $this->add_field_ident($field_ident, $sql_type);
@@ -1164,23 +1165,7 @@ class acp_profile
}
}
- // These are always arrays because the key is the language id...
- $cp->vars['l_lang_name'] = utf8_normalize_nfc(request_var('l_lang_name', array(0 => ''), true));
- $cp->vars['l_lang_explain'] = utf8_normalize_nfc(request_var('l_lang_explain', array(0 => ''), true));
- $cp->vars['l_lang_default_value'] = utf8_normalize_nfc(request_var('l_lang_default_value', array(0 => ''), true));
-
- if ($field_type != FIELD_BOOL)
- {
- $cp->vars['l_lang_options'] = utf8_normalize_nfc(request_var('l_lang_options', array(0 => ''), true));
- }
- else
- {
- /**
- * @todo check if this line is correct...
- $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', array(0 => array('')), true);
- */
- $cp->vars['l_lang_options'] = utf8_normalize_nfc(request_var('l_lang_options', array(0 => array('')), true));
- }
+ $cp->vars = $profile_type->get_language_options_input($cp->vars);
if ($cp->vars['lang_options'])
{
diff --git a/phpBB/phpbb/profilefields/lang_helper.php b/phpBB/phpbb/profilefields/lang_helper.php
index 627c76e76e..569eaaca40 100644
--- a/phpBB/phpbb/profilefields/lang_helper.php
+++ b/phpBB/phpbb/profilefields/lang_helper.php
@@ -48,6 +48,14 @@ class lang_helper
foreach ($lang_options as $num => $var)
{
+ if (!isset($this->options_lang[$field_id]))
+ {
+ $this->options_lang[$field_id] = array();
+ }
+ if (!isset($this->options_lang[$field_id][$lang_id]))
+ {
+ $this->options_lang[$field_id][$lang_id] = array();
+ }
$this->options_lang[$field_id][$lang_id][($num + 1)] = $var;
}
}
@@ -104,7 +112,7 @@ class lang_helper
*/
public function get($field_id, $lang_id, $field_value = null)
{
- if (!is_null($field_value))
+ if (is_null($field_value))
{
return $this->options_lang[$field_id][$lang_id];
}
diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php
index f4e0ac0f86..a3291d5ce1 100644
--- a/phpBB/phpbb/profilefields/type/type_bool.php
+++ b/phpBB/phpbb/profilefields/type/type_bool.php
@@ -144,7 +144,7 @@ class type_bool implements type_interface
{
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
- $default_value = $profile_row['lang_default_value'];
+ $default_value = $profile_row['field_default_value'];
// checkbox - set the value to "true" if it has been set to 1
if ($profile_row['field_length'] == 2)
@@ -211,4 +211,22 @@ class type_bool implements type_interface
return $options;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_language_options_input($field_data)
+ {
+ $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
+ $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true);
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true);
+
+ /**
+ * @todo check if this line is correct...
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => array('')), true);
+ */
+ $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => array('')), true);
+
+ return $field_data;
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php
index d2a10cdd15..c76c7e1d49 100644
--- a/phpBB/phpbb/profilefields/type/type_date.php
+++ b/phpBB/phpbb/profilefields/type/type_date.php
@@ -177,6 +177,7 @@ class type_date implements type_interface
public function generate_field($profile_row, $preview_options = false)
{
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
+ $field_ident = $profile_row['field_ident'];
$now = getdate();
@@ -186,14 +187,14 @@ class type_date implements type_interface
{
$profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']);
}
- list($day, $month, $year) = explode('-', ((!isset($this->user->profile_fields[$user_ident]) || $preview_options !== false) ? $profile_row['field_default_value'] : $this->user->profile_fields[$user_ident]));
+ list($day, $month, $year) = explode('-', ((!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) ? $profile_row['field_default_value'] : $this->user->profile_fields[$field_ident]));
}
else
{
if ($preview_options !== false && $profile_row['field_default_value'] == 'now')
{
$profile_row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']);
- list($day, $month, $year) = explode('-', ((!isset($this->user->profile_fields[$user_ident]) || $preview_options !== false) ? $profile_row['field_default_value'] : $this->user->profile_fields[$user_ident]));
+ list($day, $month, $year) = explode('-', ((!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) ? $profile_row['field_default_value'] : $this->user->profile_fields[$field_ident]));
}
else
{
@@ -257,4 +258,17 @@ class type_date implements type_interface
return $options;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_language_options_input($field_data)
+ {
+ $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
+ $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true);
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true);
+ $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true);
+
+ return $field_data;
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php
index 82c128861a..4313f0e64c 100644
--- a/phpBB/phpbb/profilefields/type/type_dropdown.php
+++ b/phpBB/phpbb/profilefields/type/type_dropdown.php
@@ -153,7 +153,7 @@ class type_dropdown implements type_interface
{
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
- $default_value = $profile_row['lang_default_value'];
+ $default_value = $profile_row['field_default_value'];
$value = ($this->request->is_set($field_ident)) ? $this->request->variable($field_ident, $default_value) : ((!isset($this->user->profile_fields[$field_ident]) || $preview_options !== false) ? $default_value : $this->user->profile_fields[$field_ident]);
@@ -209,4 +209,17 @@ class type_dropdown implements type_interface
return $options;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_language_options_input($field_data)
+ {
+ $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
+ $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true);
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true);
+ $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true);
+
+ return $field_data;
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_int.php b/phpBB/phpbb/profilefields/type/type_int.php
index a2e6f8e663..9901f61795 100644
--- a/phpBB/phpbb/profilefields/type/type_int.php
+++ b/phpBB/phpbb/profilefields/type/type_int.php
@@ -124,7 +124,7 @@ class type_int implements type_interface
{
$profile_row['field_ident'] = (isset($profile_row['var_name'])) ? $profile_row['var_name'] : 'pf_' . $profile_row['field_ident'];
$field_ident = $profile_row['field_ident'];
- $default_value = $profile_row['lang_default_value'];
+ $default_value = $profile_row['field_default_value'];
if ($this->request->is_set($field_ident))
{
@@ -183,4 +183,17 @@ class type_int implements type_interface
return $options;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_language_options_input($field_data)
+ {
+ $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
+ $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true);
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true);
+ $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true);
+
+ return $field_data;
+ }
}
diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php
index f6f6355698..9390c4171b 100644
--- a/phpBB/phpbb/profilefields/type/type_interface.php
+++ b/phpBB/phpbb/profilefields/type/type_interface.php
@@ -102,7 +102,15 @@ interface type_interface
* Get the options we need to display for the language input fields in the ACP
*
* @param array $field_data Array with data for this field
- * @return array Returns the language options we need to generate
+ * @return array Returns the language options we need to generate
*/
public function get_language_options($field_data);
+
+ /**
+ * Get the input for the supplied language options
+ *
+ * @param array $field_data Array with data for this field
+ * @return array Returns the language options we need to generate
+ */
+ public function get_language_options_input($field_data);
}
diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php
index 686c50d4db..88ca905aee 100644
--- a/phpBB/phpbb/profilefields/type/type_string_common.php
+++ b/phpBB/phpbb/profilefields/type/type_string_common.php
@@ -109,4 +109,17 @@ abstract class type_string_common
{
return 'pf_' . $field_data['field_ident'];
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_language_options_input($field_data)
+ {
+ $field_data['l_lang_name'] = $this->request->variable('l_lang_name', array(0 => ''), true);
+ $field_data['l_lang_explain'] = $this->request->variable('l_lang_explain', array(0 => ''), true);
+ $field_data['l_lang_default_value'] = $this->request->variable('l_lang_default_value', array(0 => ''), true);
+ $field_data['l_lang_options'] = $this->request->variable('l_lang_options', array(0 => ''), true);
+
+ return $field_data;
+ }
}