1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

Merge remote-tracking branch 'github-nickvergessen/ticket/5506' into develop-olympus

* github-nickvergessen/ticket/5506:
  [ticket/5506] Do not display an empty last page after deleting logs.
This commit is contained in:
Nils Adermann 2011-07-16 20:53:30 -04:00
commit 83f955a2c5
6 changed files with 39 additions and 22 deletions

View File

@ -301,7 +301,7 @@ class acp_inactive
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true), 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true),
'USERS_PER_PAGE' => $per_page, 'USERS_PER_PAGE' => $per_page,
'U_ACTION' => $this->u_action . '&start=' . $start, 'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start",
)); ));
$this->tpl_name = 'acp_inactive'; $this->tpl_name = 'acp_inactive';

View File

@ -127,12 +127,12 @@ class acp_logs
// Grab log data // Grab log data
$log_data = array(); $log_data = array();
$log_count = 0; $log_count = 0;
view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords); $start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
$template->assign_vars(array( $template->assign_vars(array(
'L_TITLE' => $l_title, 'L_TITLE' => $l_title,
'L_EXPLAIN' => $l_title_explain, 'L_EXPLAIN' => $l_title_explain,
'U_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true), 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true),

View File

@ -1124,7 +1124,7 @@ class acp_users
// Grab log data // Grab log data
$log_data = array(); $log_data = array();
$log_count = 0; $log_count = 0;
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
$template->assign_vars(array( $template->assign_vars(array(
'S_FEEDBACK' => true, 'S_FEEDBACK' => true,

View File

@ -2595,6 +2595,31 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')'; $sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
} }
if ($log_count !== false)
{
$sql = 'SELECT COUNT(l.log_id) AS total_entries
FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
WHERE l.log_type = $log_type
AND l.user_id = u.user_id
AND l.log_time >= $limit_days
$sql_keywords
$sql_forum";
$result = $db->sql_query($sql);
$log_count = (int) $db->sql_fetchfield('total_entries');
$db->sql_freeresult($result);
}
if ($log_count == 0)
{
// Save the queries, because there are no logs to display
return 0;
}
if ($offset >= $log_count)
{
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
}
$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour $sql = "SELECT l.*, u.username, u.username_clean, u.user_colour
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
WHERE l.log_type = $log_type WHERE l.log_type = $log_type
@ -2762,21 +2787,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
} }
} }
if ($log_count !== false) return $offset;
{
$sql = 'SELECT COUNT(l.log_id) AS total_entries
FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
WHERE l.log_type = $log_type
AND l.user_id = u.user_id
AND l.log_time >= $limit_days
$sql_keywords
$sql_forum";
$result = $db->sql_query($sql);
$log_count = (int) $db->sql_fetchfield('total_entries');
$db->sql_freeresult($result);
}
return;
} }
/** /**
@ -2908,6 +2919,12 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
$user_count = (int) $db->sql_fetchfield('user_count'); $user_count = (int) $db->sql_fetchfield('user_count');
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($user_count == 0)
{
// Save the queries, because there are no users to display
return 0;
}
if ($offset >= $user_count) if ($offset >= $user_count)
{ {
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit; $offset = ($offset - $limit < 0) ? 0 : $offset - $limit;

View File

@ -170,7 +170,7 @@ class mcp_logs
// Grab log data // Grab log data
$log_data = array(); $log_data = array();
$log_count = 0; $log_count = 0;
view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords); $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
$template->assign_vars(array( $template->assign_vars(array(
'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($log_count, $config['topics_per_page'], $start),
@ -179,7 +179,7 @@ class mcp_logs
'L_TITLE' => $user->lang['MCP_LOGS'], 'L_TITLE' => $user->lang['MCP_LOGS'],
'U_POST_ACTION' => $this->u_action, 'U_POST_ACTION' => $this->u_action . "&amp;$u_sort_param$keywords_param&amp;start=$start",
'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false,
'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_KEY' => $s_sort_key,

View File

@ -198,7 +198,7 @@ class mcp_notes
$log_data = array(); $log_data = array();
$log_count = 0; $log_count = 0;
view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords); $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords);
if ($log_count) if ($log_count)
{ {