aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/profilefields
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/profilefields')
-rw-r--r--phpBB/phpbb/profilefields/manager.php10
-rw-r--r--phpBB/phpbb/profilefields/type/type_bool.php2
-rw-r--r--phpBB/phpbb/profilefields/type/type_date.php2
-rw-r--r--phpBB/phpbb/profilefields/type/type_dropdown.php6
-rw-r--r--phpBB/phpbb/profilefields/type/type_url.php15
5 files changed, 24 insertions, 11 deletions
diff --git a/phpBB/phpbb/profilefields/manager.php b/phpBB/phpbb/profilefields/manager.php
index ea4b24af56..35b18ddf07 100644
--- a/phpBB/phpbb/profilefields/manager.php
+++ b/phpBB/phpbb/profilefields/manager.php
@@ -230,7 +230,7 @@ class manager
*/
public function update_profile_field_data($user_id, $cp_data)
{
- if (!sizeof($cp_data))
+ if (!count($cp_data))
{
return;
}
@@ -258,7 +258,7 @@ class manager
*/
public function generate_profile_fields_template_headlines($restrict_option = '')
{
- if (!sizeof($this->profile_cache))
+ if (!count($this->profile_cache))
{
$this->build_cache();
}
@@ -318,12 +318,12 @@ class manager
$user_ids = array($user_ids);
}
- if (!sizeof($this->profile_cache))
+ if (!count($this->profile_cache))
{
$this->build_cache();
}
- if (!sizeof($user_ids))
+ if (!count($user_ids))
{
return array();
}
@@ -486,7 +486,7 @@ class manager
$sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value
FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f
WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . '
- ' . ((sizeof($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
+ ' . ((count($sql_not_in)) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . '
AND l.field_id = f.field_id';
$result = $this->db->sql_query($sql);
diff --git a/phpBB/phpbb/profilefields/type/type_bool.php b/phpBB/phpbb/profilefields/type/type_bool.php
index f6f3f17a6c..9c09e27bc4 100644
--- a/phpBB/phpbb/profilefields/type/type_bool.php
+++ b/phpBB/phpbb/profilefields/type/type_bool.php
@@ -398,7 +398,7 @@ class type_bool extends type_base
public function display_options(&$template_vars, &$field_data)
{
// Initialize these array elements if we are creating a new field
- if (!sizeof($field_data['lang_options']))
+ if (!count($field_data['lang_options']))
{
// No options have been defined for a boolean field.
$field_data['lang_options'][0] = '';
diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php
index 63a0c79a3d..5a1a6dbd5c 100644
--- a/phpBB/phpbb/profilefields/type/type_date.php
+++ b/phpBB/phpbb/profilefields/type/type_date.php
@@ -72,7 +72,7 @@ class type_date extends type_base
'lang_options' => $field_data['lang_options'],
);
- $always_now = request_var('always_now', -1);
+ $always_now = $this->request->variable('always_now', -1);
if ($always_now == -1)
{
$s_checked = ($field_data['field_default_value'] == 'now') ? true : false;
diff --git a/phpBB/phpbb/profilefields/type/type_dropdown.php b/phpBB/phpbb/profilefields/type/type_dropdown.php
index 17ae89e1b2..d54404bbb4 100644
--- a/phpBB/phpbb/profilefields/type/type_dropdown.php
+++ b/phpBB/phpbb/profilefields/type/type_dropdown.php
@@ -282,7 +282,7 @@ class type_dropdown extends type_base
*/
public function validate_options_on_submit($error, $field_data)
{
- if (!sizeof($field_data['lang_options']))
+ if (!count($field_data['lang_options']))
{
$error[] = $this->user->lang['NO_FIELD_ENTRIES'];
}
@@ -298,7 +298,7 @@ class type_dropdown extends type_base
if ($step == 2 && $key == 'field_maxlen')
{
// Get the number of options if this key is 'field_maxlen'
- return sizeof(explode("\n", $this->request->variable('lang_options', '', true)));
+ return count(explode("\n", $this->request->variable('lang_options', '', true)));
}
return parent::get_excluded_options($key, $action, $current_value, $field_data, $step);
@@ -310,7 +310,7 @@ class type_dropdown extends type_base
public function display_options(&$template_vars, &$field_data)
{
// Initialize these array elements if we are creating a new field
- if (!sizeof($field_data['lang_options']))
+ if (!count($field_data['lang_options']))
{
// No options have been defined for the dropdown menu
$field_data['lang_options'] = array();
diff --git a/phpBB/phpbb/profilefields/type/type_url.php b/phpBB/phpbb/profilefields/type/type_url.php
index 375cf5b19a..37815b66a5 100644
--- a/phpBB/phpbb/profilefields/type/type_url.php
+++ b/phpBB/phpbb/profilefields/type/type_url.php
@@ -64,11 +64,24 @@ class type_url extends type_string
return false;
}
- if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $field_value))
+ if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $field_value))
{
return $this->user->lang('FIELD_INVALID_URL', $this->get_field_name($field_data['lang_name']));
}
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function get_profile_value($field_value, $field_data)
+ {
+ if (!preg_match('#^' . get_preg_expression('url_http') . '$#iu', $field_value))
+ {
+ return null;
+ }
+
+ return parent::get_profile_value($field_value, $field_data);
+ }
}