aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_forums.php66
-rw-r--r--phpBB/includes/acp/acp_main.php6
-rw-r--r--phpBB/includes/acp/acp_profile.php94
-rw-r--r--phpBB/includes/functions.php6
-rw-r--r--phpBB/includes/functions_profile_fields.php45
-rw-r--r--phpBB/includes/functions_user.php4
-rw-r--r--phpBB/includes/message_parser.php4
-rw-r--r--phpBB/includes/ucp/ucp_activate.php4
-rw-r--r--phpBB/includes/ucp/ucp_register.php4
9 files changed, 77 insertions, 156 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index adf3abddfb..2d9a9461e7 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -825,12 +825,14 @@ class acp_forums
$forum_data['forum_flags'] += ($forum_data['show_active']) ? 16 : 0;
// Unset data that are not database fields
- unset($forum_data['forum_link_track']);
- unset($forum_data['prune_old_polls']);
- unset($forum_data['prune_announce']);
- unset($forum_data['prune_sticky']);
- unset($forum_data['show_active']);
- unset($forum_data['forum_password_confirm']);
+ $forum_data_sql = $forum_data;
+
+ unset($forum_data_sql['forum_link_track']);
+ unset($forum_data_sql['prune_old_polls']);
+ unset($forum_data_sql['prune_announce']);
+ unset($forum_data_sql['prune_sticky']);
+ unset($forum_data_sql['show_active']);
+ unset($forum_data_sql['forum_password_confirm']);
// What are we going to do tonight Brain? The same thing we do everynight,
// try to take over the world ... or decide whether to continue update
@@ -840,16 +842,16 @@ class acp_forums
return $errors;
}
- if (!isset($forum_data['forum_id']))
+ if (!isset($forum_data_sql['forum_id']))
{
// no forum_id means we're creating a new forum
- unset($forum_data['type_action']);
+ unset($forum_data_sql['type_action']);
- if ($forum_data['parent_id'])
+ if ($forum_data_sql['parent_id'])
{
$sql = 'SELECT left_id, right_id
FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $forum_data['parent_id'];
+ WHERE forum_id = ' . $forum_data_sql['parent_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -869,8 +871,8 @@ class acp_forums
WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id';
$db->sql_query($sql);
- $forum_data['left_id'] = $row['right_id'];
- $forum_data['right_id'] = $row['right_id'] + 1;
+ $forum_data_sql['left_id'] = $row['right_id'];
+ $forum_data_sql['right_id'] = $row['right_id'] + 1;
}
else
{
@@ -880,11 +882,11 @@ class acp_forums
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $forum_data['left_id'] = $row['right_id'] + 1;
- $forum_data['right_id'] = $row['right_id'] + 2;
+ $forum_data_sql['left_id'] = $row['right_id'] + 1;
+ $forum_data_sql['right_id'] = $row['right_id'] + 2;
}
- $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data);
+ $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql);
$db->sql_query($sql);
$forum_data['forum_id'] = $db->sql_nextid();
@@ -893,34 +895,34 @@ class acp_forums
}
else
{
- $row = $this->get_forum_info($forum_data['forum_id']);
+ $row = $this->get_forum_info($forum_data_sql['forum_id']);
- if ($forum_data['forum_type'] != FORUM_POST && $row['forum_type'] != $forum_data['forum_type'])
+ if ($row['forum_type'] == FORUM_POST && $row['forum_type'] != $forum_data_sql['forum_type'])
{
// we're turning a postable forum into a non-postable forum
- if ($forum_data['type_action'] == 'move')
+ if ($forum_data_sql['type_action'] == 'move')
{
- if ($forum_data['to_forum_id'])
+ $to_forum_id = request_var('to_forum_id', 0);
+
+ if ($to_forum_id)
{
- $errors = $this->move_forum_content($forum_data['forum_id'], $forum_data['to_forum_id']);
+ $errors = $this->move_forum_content($forum_data_sql['forum_id'], $to_forum_id);
}
else
{
return array($user->lang['NO_DESTINATION_FORUM']);
}
}
- else if ($forum_data['type_action'] == 'delete')
+ else if ($forum_data_sql['type_action'] == 'delete')
{
- $errors = $this->delete_forum_content($forum_data['forum_id']);
+ $errors = $this->delete_forum_content($forum_data_sql['forum_id']);
}
else
{
return array($user->lang['NO_FORUM_ACTION']);
}
- $forum_data['forum_posts'] = 0;
- $forum_data['forum_topics'] = 0;
- $forum_data['forum_topics_real'] = 0;
+ $forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = 0;
}
if (sizeof($errors))
@@ -928,9 +930,9 @@ class acp_forums
return $errors;
}
- if ($row['parent_id'] != $forum_data['parent_id'])
+ if ($row['parent_id'] != $forum_data_sql['parent_id'])
{
- $errors = $this->move_forum($forum_data['forum_id'], $forum_data['parent_id']);
+ $errors = $this->move_forum($forum_data_sql['forum_id'], $forum_data_sql['parent_id']);
}
if (sizeof($errors))
@@ -938,9 +940,9 @@ class acp_forums
return $errors;
}
- unset($forum_data['type_action']);
+ unset($forum_data_sql['type_action']);
- if ($row['forum_name'] != $forum_data['forum_name'])
+ if ($row['forum_name'] != $forum_data_sql['forum_name'])
{
// the forum name has changed, clear the parents list of child forums
$sql = 'UPDATE ' . FORUMS_TABLE . "
@@ -951,11 +953,11 @@ class acp_forums
}
// Setting the forum id to the forum id is not really received well by some dbs. ;)
- $forum_id = $forum_data['forum_id'];
- unset($forum_data['forum_id']);
+ $forum_id = $forum_data_sql['forum_id'];
+ unset($forum_data_sql['forum_id']);
$sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $forum_data) . '
+ SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . '
WHERE forum_id = ' . $forum_id;
$db->sql_query($sql);
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 292d78973f..090ee0fe06 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -68,8 +68,8 @@ class acp_main
if ($row = $db->sql_fetchrow($result))
{
- set_config('newest_user_id', $row['user_id']);
- set_config('newest_username', $row['username']);
+ set_config('newest_user_id', $row['user_id'], true);
+ set_config('newest_username', $row['username'], true);
}
$db->sql_freeresult($result);
}
@@ -368,7 +368,7 @@ class acp_main
{
while (($file = readdir($avatar_dir)) !== false)
{
- if ($file{0} != '.')
+ if ($file{0} != '.' && strpos($file, 'index.') === false)
{
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
}
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index d3f49e92a6..ca998e0e2c 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -223,8 +223,6 @@ class acp_profile
$step = request_var('step', 1);
$submit = (isset($_REQUEST['next']) || isset($_REQUEST['prev'])) ? true : false;
- $update_preview = (isset($_REQUEST['update_preview'])) ? true : false;
- $update = (isset($_REQUEST['update']) || $update_preview) ? true : false;
$save = (isset($_REQUEST['save'])) ? true : false;
// We are editing... we need to grab basic things
@@ -264,8 +262,6 @@ class acp_profile
}
$db->sql_freeresult($result);
- $field_row['pf_preview'] = '';
-
$s_hidden_fields = '<input type="hidden" name="field_id" value="' . $field_id . '" />';
}
else
@@ -288,8 +284,7 @@ class acp_profile
'field_show_on_reg' => 0,
'lang_name' => '',
'lang_explain' => '',
- 'lang_default_value'=> '',
- 'pf_preview' => '')
+ 'lang_default_value'=> '')
);
$s_hidden_fields = '<input type="hidden" name="field_type" value="' . $field_type . '" />';
@@ -298,7 +293,7 @@ class acp_profile
// $exclude contains the data we gather in each step
$exclude = array(
1 => array('field_ident', 'lang_name', 'lang_explain', 'field_option', 'field_no_view'),
- 2 => array('field_length', 'pf_preview', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
+ 2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
);
@@ -509,13 +504,6 @@ class acp_profile
}
}
- $user_error = '';
- if ($update && $step == 2)
- {
- // Validate Field
- $user_error = $cp->validate_profile_field($field_type, $cp->vars['pf_preview'], $cp->vars);
- }
-
$step = (isset($_REQUEST['next'])) ? $step + 1 : ((isset($_REQUEST['prev'])) ? $step - 1 : $step);
if (sizeof($error))
@@ -524,13 +512,6 @@ class acp_profile
$submit = false;
}
- if (isset($_REQUEST['prev']) || isset($_REQUEST['next']))
- {
- $update = false;
- $pf_preview = '';
- unset($_REQUEST['pf_preview']);
- }
-
// Build up the specific hidden fields
foreach ($exclude as $num => $key_ary)
{
@@ -660,77 +641,6 @@ class acp_profile
$template->assign_block_vars('option', $option_ary);
}
- if ($user_error || $update)
- {
- // If not and only showing common error messages, use this one
- switch ($user_error)
- {
- case 'FIELD_INVALID_DATE':
- case 'FIELD_REQUIRED':
- $user_error = sprintf($user->lang[$user_error], $cp->vars['lang_name']);
- break;
-
- case 'FIELD_TOO_SHORT':
- case 'FIELD_TOO_SMALL':
- $user_error = sprintf($user->lang[$user_error], $cp->vars['lang_name'], $cp->vars['field_minlen']);
- break;
-
- case 'FIELD_TOO_LONG':
- case 'FIELD_TOO_LARGE':
- $user_error = sprintf($user->lang[$user_error], $cp->vars['lang_name'], $cp->vars['field_maxlen']);
- break;
-
- case 'FIELD_INVALID_CHARS':
- switch ($cp->vars['field_validation'])
- {
- case '[0-9]+':
- $user_error = sprintf($user->lang[$user_error . '_NUMBERS_ONLY'], $cp->vars['lang_name']);
- break;
-
- case '[\w]+':
- $user_error = sprintf($user->lang[$user_error . '_ALPHA_ONLY'], $cp->vars['lang_name']);
- break;
-
- case '[\w_\+\. \-\[\]]+':
- $user_error = sprintf($user->lang[$user_error . '_SPACERS_ONLY'], $cp->vars['lang_name']);
- break;
- }
- break;
-
- default:
- $user_error = '';
- }
-
- $template->assign_var('USER_ERROR', $user_error);
- }
-
- $preview_field = array(
- 'lang_name' => $cp->vars['lang_name'],
- 'lang_explain' => $cp->vars['lang_explain'],
- 'lang_id' => $lang_defs['iso'][$config['default_lang']],
- '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'],
- 'field_maxlen' => $cp->vars['field_maxlen'],
- 'lang_options' => $cp->vars['lang_options'],
- );
-
- if ($update_preview)
- {
- $preview_field['acp_preview'] = true;
- }
-
- $template->assign_vars(array(
- 'PREVIEW_LANG_NAME' => $cp->vars['lang_name'],
- 'PREVIEW_LANG_EXPLAIN' => $cp->vars['lang_explain'],
- 'PREVIEW_FIELD' => $cp->process_field_row(($update_preview) ? 'change' : 'preview', $preview_field))
- );
-
break;
// Define remaining language variables
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a9e3a59673..143fc3fd79 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1237,6 +1237,12 @@ function build_url($strip_vars = false)
$redirect = (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'] . (($user->page['query_string']) ? "?{$user->page['query_string']}" : '');
$redirect = append_sid($redirect, false, false);
+ // Add delimiter if not there...
+ if (strpos($redirect, '?') === false)
+ {
+ $redirect .= '?';
+ }
+
// Strip vars...
if ($strip_vars !== false && strpos($redirect, '?') !== false)
{
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index 8fed0968aa..d332fb7bc7 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -65,7 +65,8 @@ class custom_profile
$template->assign_block_vars('profile_fields', array(
'LANG_NAME' => $row['lang_name'],
'LANG_EXPLAIN' => $row['lang_explain'],
- 'FIELD' => $tpl_snippet)
+ 'FIELD' => $tpl_snippet,
+ 'S_REQUIRED' => ($row['field_required']) ? true : false)
);
}
$db->sql_freeresult($result);
@@ -355,19 +356,24 @@ class custom_profile
WHERE user_id IN (' . implode(', ', array_map('intval', $user_id)) . ')';
$result = $db->sql_query($sql);
- $user_fields = array();
+ $field_data = array();
while ($row = $db->sql_fetchrow($result))
{
- foreach ($row as $ident => $value)
+ $field_data[$row['user_id']] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $user_fields = array();
+
+ // Go through the fields in correct order
+ foreach (array_keys($this->profile_cache) as $used_ident)
+ {
+ foreach ($field_data as $user_id => $row)
{
- if (isset($this->profile_cache[$ident]))
- {
- $user_fields[$row['user_id']][$ident]['value'] = $value;
- $user_fields[$row['user_id']][$ident]['data'] = $this->profile_cache[$ident];
- }
+ $user_fields[$user_id][$used_ident]['value'] = $row[$used_ident];
+ $user_fields[$user_id][$used_ident]['data'] = $this->profile_cache[$used_ident];
}
}
- $db->sql_freeresult($result);
return $user_fields;
}
@@ -444,6 +450,7 @@ class custom_profile
return $value;
break;
+ // case 'datetime':
case 'date':
$date = explode('-', $value);
$month = (isset($date[0])) ? (int) $date[0] : 0;
@@ -456,14 +463,12 @@ class custom_profile
}
else if ($day && $month && $year)
{
- global $user;
-
- return $user->format_date(mktime(0, 0, 1, $day, $month, $year));
+ return sprintf('%4d-%02d-%02d', $year, $month, $day);
}
return $value;
break;
-
+
case 'dropdown':
$field_id = $ident_ary['data']['field_id'];
$lang_id = $ident_ary['data']['lang_id'];
@@ -479,7 +484,7 @@ class custom_profile
return $this->options_lang[$field_id][$lang_id][(int) $value];
break;
-
+
case 'bool':
$field_id = $ident_ary['data']['field_id'];
$lang_id = $ident_ary['data']['lang_id'];
@@ -501,7 +506,7 @@ class custom_profile
return $this->options_lang[$field_id][$lang_id][(int) ($value + 1)];
}
break;
-
+
default:
trigger_error('Unknown profile type', E_USER_ERROR);
break;
@@ -532,7 +537,7 @@ class custom_profile
}
else
{
- if (is_null($user->profile_fields[$user_ident]) && !$preview)
+ if (!$preview && is_null($user->profile_fields[$user_ident]))
{
$value = NULL;
}
@@ -651,8 +656,7 @@ class custom_profile
{
if (!isset($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']]) || !sizeof($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']]))
{
- $s_preview = ($preview || isset($profile_row['acp_preview'])) ? true : false;
- $this->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], FIELD_BOOL, $s_preview);
+ $this->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], FIELD_BOOL, $preview);
}
foreach ($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']] as $option_id => $option_value)
@@ -707,8 +711,7 @@ class custom_profile
if (!isset($this->options_lang[$profile_row['field_id']]) || !isset($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']]) || !sizeof($this->options_lang[$profile_row['field_id']][$profile_row['lang_id']]))
{
- $s_preview = ($preview || isset($profile_row['acp_preview'])) ? true : false;
- $this->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], FIELD_DROPDOWN, $s_preview);
+ $this->get_option_lang($profile_row['field_id'], $profile_row['lang_id'], FIELD_DROPDOWN, $preview);
}
$profile_row['field_value'] = $value;
@@ -1026,7 +1029,7 @@ class custom_profile_admin extends custom_profile
$options = array(
0 => array('TITLE' => $user->lang['DEFAULT_VALUE'], 'FIELD' => $this->process_field_row('preview', $profile_row)),
- 1 => array('TITLE' => $user->lang['ALWAYS_TODAY'], 'FIELD' => '<input type="radio" name="always_now" value="1"' . (($s_checked) ? ' checked="checked"' : '') . ' /> ' . $user->lang['YES'] . ' <input type="radio" name="always_now" value="0"' . ((!$s_checked) ? ' checked="checked"' : '') . ' /> ' . $user->lang['NO']),
+ 1 => array('TITLE' => $user->lang['ALWAYS_TODAY'], 'FIELD' => '<input type="radio" name="always_now" value="1"' . (($s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['YES'] . ' <input type="radio" name="always_now" value="0"' . ((!$s_checked) ? ' checked="checked"' : '') . ' onchange="document.getElementById(\'add_profile_field\').submit();" /> ' . $user->lang['NO']),
);
return $options;
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index e82f5af537..ddb717f8be 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -201,8 +201,8 @@ function user_delete($mode, $user_id, $post_username = false)
if ($row = $db->sql_fetchrow($result))
{
- set_config('newest_user_id', $row['user_id']);
- set_config('newest_username', $row['username']);
+ set_config('newest_user_id', $row['user_id'], true);
+ set_config('newest_username', $row['username'], true);
}
$db->sql_freeresult($result);
}
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 9f85549d8d..e16f930cce 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -767,8 +767,8 @@ class parse_message extends bbcode_firstpass
// Do some general 'cleanup' first before processing message,
// e.g. remove excessive newlines(?), smilies(?)
// Transform \r\n and \r into \n
- $match = array('#\r\n?#', '#sid=[a-z0-9]*?&amp;?#', "#([\n][\s]+){3,}#", '#(script|about|applet|activex|chrome):#i');
- $replace = array("\n", '', "\n\n", "\\1&#058;");
+ $match = array('#\r\n?#', "#([\n][\s]+){3,}#", '#(script|about|applet|activex|chrome):#i');
+ $replace = array("\n", "\n\n", "\\1&#058;");
$this->message = preg_replace($match, $replace, trim($this->message));
// Message length check. -1 disables this check completely.
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php
index 93d1f63e05..c837975fa4 100644
--- a/phpBB/includes/ucp/ucp_activate.php
+++ b/phpBB/includes/ucp/ucp_activate.php
@@ -105,8 +105,8 @@ class ucp_activate
if (!$update_password)
{
- set_config('newest_user_id', $row['user_id']);
- set_config('newest_username', $row['username']);
+ set_config('newest_user_id', $row['user_id'], true);
+ set_config('newest_username', $row['username'], true);
set_config('num_users', $config['num_users'] + 1, true);
}
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 92b70ca507..928882e02f 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -400,8 +400,8 @@ class ucp_register
if ($user_type == USER_NORMAL || !$config['email_enable'])
{
- set_config('newest_user_id', $user_id);
- set_config('newest_username', $username);
+ set_config('newest_user_id', $user_id, true);
+ set_config('newest_username', $username, true);
set_config('num_users', $config['num_users'] + 1, true);
}
unset($data);