Fix some instances where we left db connections open (registration -> captcha for example)

git-svn-id: file:///svn/phpbb/trunk@8656 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-06-13 19:44:40 +00:00
parent 677e6451c4
commit eeba8f4560
6 changed files with 29 additions and 26 deletions

View file

@ -28,7 +28,7 @@ class acp_captcha
$user->add_lang('acp/board'); $user->add_lang('acp/board');
$captcha_vars = array( $captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID', 'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID', 'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
@ -52,9 +52,8 @@ class acp_captcha
{ {
include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_non_gd.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'includes/captcha/captcha_non_gd.' . PHP_EXT);
} }
captcha::execute(gen_rand_string(mt_rand(5, 8)), time()); captcha::execute(gen_rand_string(mt_rand(5, 8)), time());
exit(); exit;
} }
$config_vars = array( $config_vars = array(
@ -90,7 +89,7 @@ class acp_captcha
} }
else else
{ {
$preview_image_src = append_sid(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&demo=demo")); $preview_image_src = append_sid(append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=$id&demo=demo"));
if (@extension_loaded('gd')) if (@extension_loaded('gd'))
{ {
@ -110,7 +109,7 @@ class acp_captcha
'CAPTCHA_PREVIEW' => $preview_image_src, 'CAPTCHA_PREVIEW' => $preview_image_src,
'PREVIEW' => isset($_POST['preview']), 'PREVIEW' => isset($_POST['preview']),
)); ));
} }
} }
} }

View file

@ -55,7 +55,7 @@ class acp_forums
$total = request_var('total', 0); $total = request_var('total', 0);
$this->display_progress_bar($start, $total); $this->display_progress_bar($start, $total);
exit_handler(); exit;
break; break;
case 'delete': case 'delete':
@ -73,7 +73,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); trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
} }
break; break;
} }
@ -99,7 +99,7 @@ class acp_forums
$cache->destroy('sql', FORUMS_TABLE); $cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
break; break;
case 'edit': case 'edit':
@ -188,7 +188,7 @@ class acp_forums
$sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
WHERE forum_id = ' . (int) $forum_data['forum_id']; WHERE forum_id = ' . (int) $forum_data['forum_id'];
$db->sql_query($sql); $db->sql_query($sql);
$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
WHERE forum_id = ' . (int) $forum_data['forum_id']; WHERE forum_id = ' . (int) $forum_data['forum_id'];
$db->sql_query($sql); $db->sql_query($sql);
@ -244,7 +244,7 @@ class acp_forums
$auth->acl_clear_prefetch(); $auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE); $cache->destroy('sql', FORUMS_TABLE);
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
$message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
@ -542,7 +542,7 @@ class acp_forums
$forum_type_options = ''; $forum_type_options = '';
$forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK');
foreach ($forum_type_ary as $value => $lang) foreach ($forum_type_ary as $value => $lang)
{ {
$forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>'; $forum_type_options .= '<option value="' . $value . '"' . (($value == $forum_data['forum_type']) ? ' selected="selected"' : '') . '>' . $user->lang['TYPE_' . $lang] . '</option>';
@ -612,7 +612,7 @@ class acp_forums
} }
} }
} }
if (strlen($forum_data['forum_password']) == 32) if (strlen($forum_data['forum_password']) == 32)
{ {
$errors[] = $user->lang['FORUM_PASSWORD_OLD']; $errors[] = $user->lang['FORUM_PASSWORD_OLD'];
@ -917,7 +917,7 @@ class acp_forums
$forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; $forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0;
$errors[] = $user->lang['FORUM_DATA_NEGATIVE']; $errors[] = $user->lang['FORUM_DATA_NEGATIVE'];
} }
$range_test_ary = array( $range_test_ary = array(
array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'),
); );
@ -973,7 +973,7 @@ class acp_forums
$forum_data_sql['forum_password'] = phpbb_hash($forum_data_sql['forum_password']); $forum_data_sql['forum_password'] = phpbb_hash($forum_data_sql['forum_password']);
} }
unset($forum_data_sql['forum_password_unset']); unset($forum_data_sql['forum_password_unset']);
if (!isset($forum_data_sql['forum_id'])) if (!isset($forum_data_sql['forum_id']))
{ {
// no forum_id means we're creating a new forum // no forum_id means we're creating a new forum
@ -1631,7 +1631,7 @@ class acp_forums
WHERE p.forum_id = $forum_id WHERE p.forum_id = $forum_id
AND a.in_message = 0 AND a.in_message = 0
AND a.topic_id = p.topic_id"; AND a.topic_id = p.topic_id";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$topic_ids = array(); $topic_ids = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
@ -1688,7 +1688,7 @@ class acp_forums
break; break;
default: default:
// Delete everything else and curse your DB for not offering multi-table deletion // Delete everything else and curse your DB for not offering multi-table deletion
$tables_ary = array( $tables_ary = array(
'post_id' => array( 'post_id' => array(

View file

@ -72,7 +72,9 @@ class ucp_confirm
} }
captcha::execute($row['code'], $row['seed']); captcha::execute($row['code'], $row['seed']);
exit;
garbage_collection();
exit_handler();
} }
} }

View file

@ -166,7 +166,7 @@ if ($quickmod)
case 'delete_post': case 'delete_post':
case 'delete_topic': case 'delete_topic':
$module->load('mcp', 'main', 'quickmod'); $module->load('mcp', 'main', 'quickmod');
exit_handler(); exit;
break; break;
case 'topic_logs': 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); $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
if (!$row['forum_id']) if (!$row['forum_id'])

View file

@ -114,8 +114,7 @@ switch ($mode)
else else
{ {
upload_popup(); upload_popup();
garbage_collection(); exit;
exit_handler();
} }
break; break;
@ -146,7 +145,7 @@ if (!$post_data)
if ($mode == 'popup') if ($mode == 'popup')
{ {
upload_popup($post_data['forum_style']); upload_popup($post_data['forum_style']);
exit_handler(); exit;
} }
$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); $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') if ($mode == 'delete')
{ {
handle_post_delete($forum_id, $topic_id, $post_id, $post_data); handle_post_delete($forum_id, $topic_id, $post_id, $post_data);
exit_handler(); exit;
} }
// Handle bump mode... // Handle bump mode...
@ -1402,6 +1401,9 @@ function upload_popup($forum_style = 0)
); );
$template->display('popup'); $template->display('popup');
garbage_collection();
exit_handler();
} }
/** /**

View file

@ -69,7 +69,7 @@ switch ($mode)
case 'confirm': case 'confirm':
$module->load('ucp', 'confirm'); $module->load('ucp', 'confirm');
exit_handler(); exit;
break; break;
case 'login': case 'login':
@ -93,7 +93,7 @@ switch ($mode)
$message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED']; $message = ($user->data['user_id'] == ANONYMOUS) ? $user->lang['LOGOUT_REDIRECT'] : $user->lang['LOGOUT_FAILED'];
} }
meta_refresh(3, append_sid('index')); meta_refresh(3, append_sid('index'));
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a> '); $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid('index') . '">', '</a> ');
trigger_error($message); trigger_error($message);
@ -135,7 +135,7 @@ switch ($mode)
break; break;
case 'delete_cookies': case 'delete_cookies':
// Delete Cookies with dynamic names (do NOT delete poll cookies) // Delete Cookies with dynamic names (do NOT delete poll cookies)
if (confirm_box(true)) if (confirm_box(true))
{ {