- Pruning doesn't lower user post counts anymore [Bug #7676]

- Better resync explanations in ACP
- relative link to board shouldn't result in an empty link [Bug #7762]
- allow spaces to define multiple classes [Bug #7700]
- forgot addslashes for password conversion [Bug #7530]
- adjusted get_post_data call in mcp_post to retrieve read tracking info [Bug #7538]
- fixed sorting in reports/queue by properly generating the pagination links [Bug #7666]
- send UTF-8 charset header in database_update.php [Bug #7564]


git-svn-id: file:///svn/phpbb/trunk@6974 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann 2007-02-08 22:11:14 +00:00
parent 766e311ff3
commit 56a93bdfdd
11 changed files with 129 additions and 44 deletions

View file

@ -89,13 +89,49 @@
</table>
<!-- IF S_ACTION_OPTIONS -->
<form id="stats" method="post" action="{U_ACTION}">
<fieldset class="quick">
<select name="action">{S_ACTION_OPTIONS}</select>
<fieldset>
<legend>{L_STATISTIC_RESYNC_OPTIONS}</legend>
<input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
<form id="action_online_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_online">{L_RESET_ONLINE}</label></dt>
<dd><input class="button2" type="submit" id="action_online" name="action_online" value="{L_RUN}" /></dd>
</dl>
<input type="hidden" name="action" value="online"/>
</form>
<form id="action_date_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_date">{L_RESET_DATE}</label></dt>
<dd><input class="button2" type="submit" id="action_date" name="action_date" value="{L_RUN}" /></dd>
</dl>
<input type="hidden" name="action" value="date"/>
</form>
<form id="action_stats_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_stats">{L_RESYNC_STATS}</label><br /><span>{L_RESYNC_STATS_EXPLAIN}</span></dt>
<dd><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
</dl>
<input type="hidden" name="action" value="stats"/>
</form>
<form id="action_user_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_user">{L_RESYNC_POSTCOUNTS}</label><br /><span>{L_RESYNC_POSTCOUNTS_EXPLAIN}</span></dt>
<dd><input class="button2" type="submit" id="action_user" name="action_user" value="{L_RUN}" /></dd>
</dl>
<input type="hidden" name="action" value="user"/>
</form>
<form id="action_db_track_form" method="post" action="{U_ACTION}">
<dl>
<dt><label for="action_db_track">{L_RESYNC_POST_MARKING}</label><br /><span>{L_RESYNC_POST_MARKING_EXPLAIN}</span></dt>
<dd><input class="button2" type="submit" id="action_db_track" name="action_db_track" value="{L_RUN}" /></dd>
</dl>
<input type="hidden" name="action" value="db_track"/>
</form>
</fieldset>
</form>
<!-- ENDIF -->
<!-- IF .log -->

View file

@ -637,6 +637,7 @@ dt label {
}
dd label {
font-size:100%;
white-space: nowrap;
margin: 0 10px 0 0;
}

View file

@ -51,6 +51,46 @@ class acp_main
$action = request_var('action', '');
if ($action && !confirm_box(true))
{
switch ($action)
{
case 'online':
$confirm = true;
$confirm_lang = 'RESET_ONLINE_CONFIRM';
break;
case 'stats':
$confirm = true;
$confirm_lang = 'RESYNC_STATS_CONFIRM';
break;
case 'user':
$confirm = true;
$confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM';
break;
case 'date':
$confirm = true;
$confirm_lang = 'RESET_DATE_CONFIRM';
break;
case 'db_track':
$confirm = true;
$confirm_lang = 'RESYNC_POST_MARKING_CONFIRM';
break;
default:
$confirm = true;
$confirm_lang = 'CONFIRM_OPERATION';
}
if ($confirm)
{
confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'action' => $action,
)));
}
}
switch ($action)
{
case 'online':
@ -74,29 +114,23 @@ class acp_main
FROM ' . POSTS_TABLE . '
WHERE post_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
set_config('num_posts', (int) $row['stat'], true);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
set_config('num_topics', (int) $row['stat'], true);
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
$db->sql_freeresult($result);
set_config('num_users', (int) $row['stat'], true);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
@ -296,7 +330,6 @@ class acp_main
}
$dbsize = get_database_size();
$s_action_options = build_select(array('online' => 'RESET_ONLINE', 'date' => 'RESET_DATE', 'stats' => 'RESYNC_STATS', 'user' => 'RESYNC_POSTCOUNTS', 'db_track' => 'RESYNC_POST_MARKING'));
$template->assign_vars(array(
'TOTAL_POSTS' => $total_posts,
@ -320,7 +353,7 @@ class acp_main
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&amp;mode=admin'),
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&amp;mode=list'),
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? $s_action_options : '',
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
)
);

View file

@ -939,6 +939,9 @@ parse_css_file = {PARSE_CSS_FILE}
$add_custom = isset($_POST['add_custom']) ? true : false;
$matches = array();
// no curly brackets inside a CSS block please
$css_data = str_replace(array('{', '}'), '', $css_data);
// Retrieve some information about the theme
$sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data
FROM ' . STYLES_THEME_TABLE . "
@ -1266,7 +1269,7 @@ parse_css_file = {PARSE_CSS_FILE}
else
{
// check whether the custom class name is valid
if (!preg_match('/^[a-z0-9\.,:#_\->*]+$/i', $custom_class))
if (!preg_match('/^[a-z0-9\.,:#_\ \t->*]+$/i', $custom_class))
{
trigger_error($user->lang['THEME_ERR_CLASS_CHARS'] . adm_back_link($this->u_action . "&amp;action=edit&amp;id=$theme_id&amp;text_rows=$text_rows"), E_USER_WARNING);
}

View file

@ -98,9 +98,9 @@ function login_db(&$username, &$password)
// If the password convert flag is set we need to convert it
if ($row['user_pass_convert'])
{
// in phpBB2 passwords were used exactly as they were sent
// in phpBB2 passwords were used exactly as they were sent, with addslashes applied
$password_old_format = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';
$password_old_format = (STRIP) ? stripslashes($password_old_format) : $password_old_format;
$password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format;
$password_new_format = '';
set_var($password_new_format, $password_old_format, 'string');

View file

@ -2398,7 +2398,7 @@ function make_clickable($text, $server_url = false)
// relative urls for this board
$magic_url_match[] = '#(^|[\n\t (])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
$magic_url_replace[] = "'\$1<!-- l --><a href=\"\$2/' . preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . '\">' . preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . '</a><!-- l -->'";
$magic_url_replace[] = "'\$1<!-- l --><a href=\"\$2/' . preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . '\">' . ((strlen('\$3')) ? preg_replace('/(&amp;|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') : '\$2/') . '</a><!-- l -->'";
// matches a xxxx://aaaaa.bbb.cccc. ...
$magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('url_inline') . ')#ie';

View file

@ -495,7 +495,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
/**
* Remove topic(s)
*/
function delete_topics($where_type, $where_ids, $auto_sync = true)
function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true)
{
global $db, $config;
@ -517,7 +517,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
}
$return = array(
'posts' => delete_posts($where_type, $where_ids, false, true)
'posts' => delete_posts($where_type, $where_ids, false, true, $post_count_sync)
);
$sql = 'SELECT topic_id, forum_id, topic_approved
@ -579,7 +579,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true)
/**
* Remove post(s)
*/
function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true)
function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true)
{
global $db, $config, $phpbb_root_path, $phpEx;
@ -612,7 +612,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$topic_ids[] = $row['topic_id'];
$forum_ids[] = $row['forum_id'];
if ($row['post_postcount'])
if ($row['post_postcount'] && $post_count_sync)
{
$post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1;
}
@ -642,7 +642,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
unset($table_ary);
// Adjust users post counts
if (sizeof($post_counts))
if (sizeof($post_counts) && $post_count_sync)
{
foreach ($post_counts as $poster_id => $substract)
{
@ -1896,7 +1896,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync
$topic_list = array_unique($topic_list);
}
return delete_topics('topic_id', $topic_list, $auto_sync);
return delete_topics('topic_id', $topic_list, $auto_sync, false);
}
/**

View file

@ -379,7 +379,7 @@ class mcp_queue
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
'PAGINATION' => generate_pagination($this->u_action . "&amp;f=$forum_id", $total, $config['topics_per_page'], $start),
'PAGINATION' => generate_pagination($this->u_action . "&amp;f=$forum_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total)

View file

@ -353,7 +353,7 @@ class mcp_reports
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
'PAGINATION' => generate_pagination($this->u_action . "&amp;f=$forum_id&amp;t=$topic_id", $total, $config['topics_per_page'], $start),
'PAGINATION' => generate_pagination($this->u_action . "&amp;f=$forum_id&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir", $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,

View file

@ -378,6 +378,8 @@ switch ($db->sql_layer)
$error_ary = array();
$errored = false;
header('Content-type: text/html; charset=UTF-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>">

View file

@ -317,13 +317,23 @@ $lang = array_merge($lang, array(
'POSTS_PER_DAY' => 'Posts per day',
'RESET_DATE' => 'Reset date',
'RESET_ONLINE' => 'Reset online',
'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
'RESYNC_POST_MARKING' => 'Resynchronise dotted topics',
'RESYNC_STATS' => 'Resynchronise statistics',
'RESET_DATE' => 'Reset boards start date',
'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the boards start date?',
'RESET_ONLINE' => 'Reset most users ever online',
'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?',
'RESYNC_POSTCOUNTS' => 'Resynchronise post counts',
'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.',
'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?',
'RESYNC_POST_MARKING' => 'Resynchronise dotted topics',
'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?',
'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months',
'RESYNC_STATS' => 'Resynchronise statistics',
'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?',
'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.',
'RUN' => 'Run now',
'STATISTIC' => 'Statistic',
'STATISTIC' => 'Statistic',
'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics',
'TOPICS_PER_DAY' => 'Topics per day',
@ -362,20 +372,20 @@ $lang = array_merge($lang, array(
// Log Entries
$lang = array_merge($lang, array(
'LOG_ACL_ADD_USER_GLOBAL_U_' => '<strong>Added or edited users user permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_U_' => '<strong>Added or edited groups user permissions</strong><br />» %s',
'LOG_ACL_ADD_USER_GLOBAL_M_' => '<strong>Added or edited users global moderator permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_M_' => '<strong>Added or edited groups global moderator permissions</strong><br />» %s',
'LOG_ACL_ADD_USER_GLOBAL_A_' => '<strong>Added or edited users administrator permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_A_' => '<strong>Added or edited groups administrator permissions</strong><br />» %s',
'LOG_ACL_ADD_USER_GLOBAL_U_' => '<strong>Added or edited users user permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_U_' => '<strong>Added or edited groups user permissions</strong><br />» %s',
'LOG_ACL_ADD_USER_GLOBAL_M_' => '<strong>Added or edited users global moderator permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_M_' => '<strong>Added or edited groups global moderator permissions</strong><br />» %s',
'LOG_ACL_ADD_USER_GLOBAL_A_' => '<strong>Added or edited users administrator permissions</strong><br />» %s',
'LOG_ACL_ADD_GROUP_GLOBAL_A_' => '<strong>Added or edited groups administrator permissions</strong><br />» %s',
'LOG_ACL_ADD_ADMIN_GLOBAL_A_' => '<strong>Added or edited Administrators</strong><br />» %s',
'LOG_ACL_ADD_MOD_GLOBAL_M_' => '<strong>Added or edited Global Moderators</strong><br />» %s',
'LOG_ACL_ADD_USER_LOCAL_F_' => '<strong>Added or edited users forum access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_USER_LOCAL_M_' => '<strong>Added or edited users forum moderator access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_GROUP_LOCAL_F_' => '<strong>Added or edited groups forum access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_GROUP_LOCAL_M_' => '<strong>Added or edited groups forum moderator access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_USER_LOCAL_F_' => '<strong>Added or edited users forum access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_USER_LOCAL_M_' => '<strong>Added or edited users forum moderator access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_GROUP_LOCAL_F_' => '<strong>Added or edited groups forum access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_GROUP_LOCAL_M_' => '<strong>Added or edited groups forum moderator access</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_MOD_LOCAL_M_' => '<strong>Added or edited Moderators</strong> from %1$s<br />» %2$s',
'LOG_ACL_ADD_FORUM_LOCAL_F_' => '<strong>Added or edited forum permissions</strong> from %1$s<br />» %2$s',