1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

Merge branch '3.1.x' into 3.2.x

This commit is contained in:
Marc Alexander 2016-10-28 21:06:21 +02:00
commit f658e062b2
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
3 changed files with 23 additions and 32 deletions

View File

@ -602,13 +602,13 @@ class acp_profile
if (!sizeof($error)) if (!sizeof($error))
{ {
if (!check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save)) if (($step == 3 && (sizeof($this->lang_defs['iso']) == 1 || $save)) || ($action == 'edit' && $save))
{ {
if (!check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$this->save_profile_field($cp, $field_type, $action); $this->save_profile_field($cp, $field_type, $action);
} }
} }

View File

@ -54,10 +54,8 @@ class acp_search
global $config, $phpbb_admin_path, $phpEx; global $config, $phpbb_admin_path, $phpEx;
$submit = (isset($_POST['submit'])) ? true : false; $submit = (isset($_POST['submit'])) ? true : false;
$form_key = 'acp_search';
add_form_key($form_key);
if ($submit && !check_form_key($form_key)) if ($submit && !check_link_hash($request->variable('hash', ''), 'acp_search'))
{ {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
@ -233,7 +231,7 @@ class acp_search
'S_YES_SEARCH' => (bool) $config['load_search'], 'S_YES_SEARCH' => (bool) $config['load_search'],
'S_SETTINGS' => true, 'S_SETTINGS' => true,
'U_ACTION' => $this->u_action) 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search'))
); );
} }
@ -253,10 +251,7 @@ class acp_search
} }
$submit = $request->is_set_post('submit', false); $submit = $request->is_set_post('submit', false);
$form_key = 'acp_search'; if (!check_link_hash($request->variable('hash', ''), 'acp_search') && in_array($action, array('create', 'delete')))
add_form_key($form_key);
if (!check_form_key($form_key) && in_array($action, array('delete', 'create')))
{ {
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
@ -310,7 +305,7 @@ class acp_search
if (method_exists($this->search, 'delete_index')) if (method_exists($this->search, 'delete_index'))
{ {
// pass a reference to myself so the $search object can make use of save_state() and attributes // pass a reference to myself so the $search object can make use of save_state() and attributes
if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete", false))) if ($error = $this->search->delete_index($this, append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=delete&hash=" . generate_link_hash('acp_search'), false)))
{ {
$this->state = array(''); $this->state = array('');
$this->save_state(); $this->save_state();
@ -353,7 +348,7 @@ class acp_search
{ {
$totaltime = microtime(true) - $starttime; $totaltime = microtime(true) - $starttime;
$rows_per_second = $row_count / $totaltime; $rows_per_second = $row_count / $totaltime;
meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter)); meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second)); trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second));
} }
} }
@ -441,7 +436,7 @@ class acp_search
{ {
$totaltime = microtime(true) - $starttime; $totaltime = microtime(true) - $starttime;
$rows_per_second = $row_count / $totaltime; $rows_per_second = $row_count / $totaltime;
meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter)); meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));
trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second)); trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second));
} }
} }
@ -520,7 +515,7 @@ class acp_search
$template->assign_vars(array( $template->assign_vars(array(
'S_INDEX' => true, 'S_INDEX' => true,
'U_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search'),
'U_PROGRESS_BAR' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar"), 'U_PROGRESS_BAR' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar"),
'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar")), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=$mode&action=progress_bar")),
)); ));
@ -529,7 +524,7 @@ class acp_search
{ {
$template->assign_vars(array( $template->assign_vars(array(
'S_CONTINUE_INDEXING' => $this->state[1], 'S_CONTINUE_INDEXING' => $this->state[1],
'U_CONTINUE_INDEXING' => $this->u_action . '&action=' . $this->state[1], 'U_CONTINUE_INDEXING' => $this->u_action . '&action=' . $this->state[1] . '&hash=' . generate_link_hash('acp_search'),
'L_CONTINUE' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING'] : $user->lang['CONTINUE_DELETING_INDEX'], 'L_CONTINUE' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING'] : $user->lang['CONTINUE_DELETING_INDEX'],
'L_CONTINUE_EXPLAIN' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING_EXPLAIN'] : $user->lang['CONTINUE_DELETING_INDEX_EXPLAIN']) 'L_CONTINUE_EXPLAIN' => ($this->state[1] == 'create') ? $user->lang['CONTINUE_INDEXING_EXPLAIN'] : $user->lang['CONTINUE_DELETING_INDEX_EXPLAIN'])
); );

View File

@ -79,18 +79,16 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
{ {
$this->add_lang('acp/search'); $this->add_lang('acp/search');
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid);
$form_values = $crawler->selectButton('Create index')->form()->getValues(); $form = $crawler->selectButton('Create index')->form();
$crawler = self::request( $form_values = $form->getValues();
'POST', $form_values = array_merge($form_values,
'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid,
array( array(
'search_type' => ( ($backend === null) ? $this->search_backend : $backend ), 'search_type' => ( ($backend === null) ? $this->search_backend : $backend ),
'action' => 'create', 'action' => 'create',
'submit' => true,
'form_token' => $form_values['form_token'],
'creation_time' => $form_values['creation_time'],
) )
); );
$form->setValues($form_values);
$crawler = self::submit($form);
$this->assertContainsLang('SEARCH_INDEX_CREATED', $crawler->text()); $this->assertContainsLang('SEARCH_INDEX_CREATED', $crawler->text());
} }
@ -98,18 +96,16 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
{ {
$this->add_lang('acp/search'); $this->add_lang('acp/search');
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid); $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid);
$form_values = $crawler->selectButton('Delete index')->form()->getValues(); $form = $crawler->selectButton('Delete index')->form();
$crawler = self::request( $form_values = $form->getValues();
'POST', $form_values = array_merge($form_values,
'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid,
array( array(
'search_type' => $this->search_backend, 'search_type' => $this->search_backend,
'action' => 'delete', 'action' => 'delete',
'submit' => true,
'form_token' => $form_values['form_token'],
'creation_time' => $form_values['creation_time'],
) )
); );
$form->setValues($form_values);
$crawler = self::submit($form);
$this->assertContainsLang('SEARCH_INDEX_REMOVED', $crawler->text()); $this->assertContainsLang('SEARCH_INDEX_REMOVED', $crawler->text());
} }
} }