1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- fix some smaller bugs

- removed custom profiles preview field from acp


git-svn-id: file:///svn/phpbb/trunk@6022 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-06-08 10:59:36 +00:00
parent 0e7adebad6
commit 4306d4d083
14 changed files with 88 additions and 178 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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