From d22e2697e9655d2fe7df8f183a68181851279f91 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 13 Jun 2008 19:39:01 +0000 Subject: [PATCH] Fix some instances where we left db connections open (registration -> captcha for example) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8655 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_captcha.php | 8 ++++---- phpBB/includes/acp/acp_forums.php | 22 +++++++++++----------- phpBB/includes/ucp/ucp_confirm.php | 4 +++- phpBB/mcp.php | 4 ++-- phpBB/posting.php | 10 ++++++---- phpBB/ucp.php | 6 +++--- 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 0d653c22d1..18523506a4 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -29,7 +29,7 @@ class acp_captcha $user->add_lang('acp/board'); - + $captcha_vars = array( 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', @@ -54,7 +54,7 @@ class acp_captcha } $captcha = new captcha(); $captcha->execute(gen_rand_string(mt_rand(5, 8)), time()); - exit_handler(); + exit; } $config_vars = array( @@ -90,7 +90,7 @@ class acp_captcha } else { - + $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&demo=demo")); if (@extension_loaded('gd')) { @@ -110,7 +110,7 @@ class acp_captcha 'CAPTCHA_PREVIEW' => $preview_image_src, 'PREVIEW' => isset($_POST['preview']), )); - + } } } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 99e53b8667..8c05cce5b1 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -56,7 +56,7 @@ class acp_forums $total = request_var('total', 0); $this->display_progress_bar($start, $total); - exit_handler(); + exit; break; case 'delete': @@ -74,7 +74,7 @@ class acp_forums { trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } - + break; } @@ -100,7 +100,7 @@ class acp_forums $cache->destroy('sql', FORUMS_TABLE); trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); - + break; case 'edit': @@ -189,7 +189,7 @@ class acp_forums $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' WHERE forum_id = ' . (int) $forum_data['forum_id']; $db->sql_query($sql); - + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE forum_id = ' . (int) $forum_data['forum_id']; $db->sql_query($sql); @@ -245,7 +245,7 @@ class acp_forums $auth->acl_clear_prefetch(); $cache->destroy('sql', FORUMS_TABLE); - + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; @@ -543,7 +543,7 @@ class acp_forums $forum_type_options = ''; $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); - + foreach ($forum_type_ary as $value => $lang) { $forum_type_options .= ''; @@ -613,7 +613,7 @@ class acp_forums } } } - + if (strlen($forum_data['forum_password']) == 32) { $errors[] = $user->lang['FORUM_PASSWORD_OLD']; @@ -918,7 +918,7 @@ class acp_forums $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; } - + $range_test_ary = array( array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), ); @@ -974,7 +974,7 @@ class acp_forums $forum_data_sql['forum_password'] = phpbb_hash($forum_data_sql['forum_password']); } unset($forum_data_sql['forum_password_unset']); - + if (!isset($forum_data_sql['forum_id'])) { // no forum_id means we're creating a new forum @@ -1632,7 +1632,7 @@ class acp_forums WHERE p.forum_id = $forum_id AND a.in_message = 0 AND a.topic_id = p.topic_id"; - $result = $db->sql_query($sql); + $result = $db->sql_query($sql); $topic_ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -1690,7 +1690,7 @@ class acp_forums break; default: - + // Delete everything else and curse your DB for not offering multi-table deletion $tables_ary = array( 'post_id' => array( diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php index 0f37c456fa..b91c88b7e8 100644 --- a/phpBB/includes/ucp/ucp_confirm.php +++ b/phpBB/includes/ucp/ucp_confirm.php @@ -73,7 +73,9 @@ class ucp_confirm $captcha = new captcha(); $captcha->execute($row['code'], $row['seed']); - exit; + + garbage_collection(); + exit_handler(); } } diff --git a/phpBB/mcp.php b/phpBB/mcp.php index cd6d20b19c..cb6c14ca0c 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -166,7 +166,7 @@ if ($quickmod) case 'delete_post': case 'delete_topic': $module->load('mcp', 'main', 'quickmod'); - exit_handler(); + exit; break; case 'topic_logs': @@ -390,7 +390,7 @@ function get_topic_data($topic_ids, $acl_list = false, $read_tracking = false) $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); - + while ($row = $db->sql_fetchrow($result)) { if (!$row['forum_id']) diff --git a/phpBB/posting.php b/phpBB/posting.php index 4769c1f592..1dd2244656 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -114,8 +114,7 @@ switch ($mode) else { upload_popup(); - garbage_collection(); - exit_handler(); + exit; } break; @@ -146,7 +145,7 @@ if (!$post_data) if ($mode == 'popup') { upload_popup($post_data['forum_style']); - exit_handler(); + exit; } $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); @@ -277,7 +276,7 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) if ($mode == 'delete') { handle_post_delete($forum_id, $topic_id, $post_id, $post_data); - exit_handler(); + exit; } // Handle bump mode... @@ -1402,6 +1401,9 @@ function upload_popup($forum_style = 0) ); $template->display('popup'); + + garbage_collection(); + exit_handler(); } /** diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 1d182a713a..2b236c29c5 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -69,7 +69,7 @@ switch ($mode) case 'confirm': $module->load('ucp', 'confirm'); - exit_handler(); + exit; break; case 'login': @@ -93,7 +93,7 @@ switch ($mode) $message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED']; } meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); - + $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], '', ' '); trigger_error($message); @@ -135,7 +135,7 @@ switch ($mode) break; case 'delete_cookies': - + // Delete Cookies with dynamic names (do NOT delete poll cookies) if (confirm_box(true)) {