diff options
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 19 | ||||
-rw-r--r-- | phpBB/includes/session.php | 54 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 27 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/mcp_topic.html | 1 | ||||
-rw-r--r-- | phpBB/styles/subsilver2/template/mcp_topic.html | 2 |
6 files changed, 65 insertions, 40 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b4288cf685..2079497236 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -206,6 +206,8 @@ p a { <li>[Fix] Local magic URLs no longer get an additional trailing slash (Bug #14362)</li> <li>[Fix] Do not let the cron script stale for one hour if register_shutdown_function is not able to be called (Bug #14436)</li> <li>[Feature] Added /includes/db/db_tools.php file, which includes tools for handling cross-db actions such as altering columns, etc.</li> + <li>[Change] Reset the start parameter when the timeframe is changed in the mcp topic page (Ticket #14438)</li> + <li>[Change] Added Code for cleaning the confirm table to the session garbage collection</li> </ul> </div> diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 900faa5adc..4459c8e673 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -34,6 +34,7 @@ function mcp_topic_view($id, $mode, $action) $icon_id = request_var('icon', 0); $subject = utf8_normalize_nfc(request_var('subject', '', true)); $start = request_var('start', 0); + $sort_days_old = request_var('st_old', 0); $forum_id = request_var('f', 0); $to_topic_id = request_var('to_topic_id', 0); $to_forum_id = request_var('to_forum_id', 0); @@ -97,13 +98,17 @@ function mcp_topic_view($id, $mode, $action) if ($total == -1) { $total = $topic_info['topic_replies'] + 1; - } - + } + $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page']))); if ($posts_per_page == 0) { $posts_per_page = $total; } + if (!empty($sort_days_old) && $sort_days_old != $sort_days) + { + $start = 0; + } $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u @@ -215,7 +220,7 @@ function mcp_topic_view($id, $mode, $action) 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, 'S_CHECKED' => ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? true : false, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - + 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''), 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '') @@ -263,7 +268,11 @@ function mcp_topic_view($id, $mode, $action) } } } - + + $s_hidden_fields = build_hidden_fields(array( + 'st_old' => $sort_days, + )); + $template->assign_vars(array( 'TOPIC_TITLE' => $topic_info['topic_title'], 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), @@ -289,6 +298,8 @@ function mcp_topic_view($id, $mode, $action) 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, 'S_MERGE_VIEW' => ($action == 'merge') ? true : false, 'S_SPLIT_VIEW' => ($action == 'split') ? true : false, + + 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_TOPIC_ICON' => $icon_id, diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 4d2d22a804..de60f7f2bf 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -746,6 +746,8 @@ class session { global $db, $config; + $batch_size = 10; + if (!$this->time_now) { $this->time_now = time(); @@ -762,7 +764,7 @@ class session FROM ' . SESSIONS_TABLE . ' WHERE session_time < ' . ($this->time_now - $config['session_length']) . ' GROUP BY session_user_id, session_page'; - $result = $db->sql_query_limit($sql, 10); + $result = $db->sql_query_limit($sql, $batch_size); $del_user_id = array(); $del_sessions = 0; @@ -788,23 +790,55 @@ class session $db->sql_query($sql); } - if ($del_sessions < 10) + if ($del_sessions < $batch_size) { - // Less than 10 sessions, update gc timer ... else we want gc + // Less than 10 users, update gc timer ... else we want gc // called again to delete other sessions set_config('session_last_gc', $this->time_now, true); + + if ($config['max_autologin_time']) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); + $db->sql_query($sql); + } + $this->confirm_gc(); } + + return; + } + + function confirm_gc($type = 0) + { + global $db, $config; + + $sql = 'SELECT DISTINCT c.session_id + FROM ' . CONFIRM_TABLE . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); - if ($config['max_autologin_time']) + if ($row = $db->sql_fetchrow($result)) { - $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' - WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); - $db->sql_query($sql); - } + $sql_in = array(); + do + { + $sql_in[] = (string) $row['session_id']; + } + while ($row = $db->sql_fetchrow($result)); - return; + if (sizeof($sql_in)) + { + $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); } - + + /** * Sets a cookie * diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index ca44260760..6f133a9ed4 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -427,31 +427,8 @@ class ucp_register $str = ''; if (!$change_lang) { - $sql = 'SELECT DISTINCT c.session_id - FROM ' . CONFIRM_TABLE . ' c - LEFT JOIN ' . SESSIONS_TABLE . ' s ON (c.session_id = s.session_id) - WHERE s.session_id IS NULL'; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $sql_in = array(); - do - { - $sql_in[] = (string) $row['session_id']; - } - while ($row = $db->sql_fetchrow($result)); - - if (sizeof($sql_in)) - { - $sql = 'DELETE FROM ' . CONFIRM_TABLE . ' - WHERE ' . $db->sql_in_set('session_id', $sql_in) . ' - AND confirm_type = ' . CONFIRM_REG; - $db->sql_query($sql); - } - } - $db->sql_freeresult($result); - + $user->confirm_gc(CONFIRM_REG); + $sql = 'SELECT COUNT(session_id) AS attempts FROM ' . CONFIRM_TABLE . " WHERE session_id = '" . $db->sql_escape($user->session_id) . "' diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 4b61c469c8..b979376dc9 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -163,6 +163,7 @@ onload_functions.push('subPanels()'); <div><a href="#" onclick="marklist('mcp', '', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', '', false); return false;">{L_UNMARK_ALL}</a></div> </fieldset> +{S_HIDDEN_FIELDS} </form> <!-- INCLUDE mcp_footer.html -->
\ No newline at end of file diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html index 9bcd302c9b..456b1679e0 100644 --- a/phpBB/styles/subsilver2/template/mcp_topic.html +++ b/phpBB/styles/subsilver2/template/mcp_topic.html @@ -146,7 +146,7 @@ </select> <input class="btnmain" type="submit" name="mcp_topic_submit" value="{L_SUBMIT}" /></td> </tr> </table> - +{S_HIDDEN_FIELDS} </form> <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> |