[ticket/15699] Apply suggested fixes

PHPBB3-15699
This commit is contained in:
rubencm 2021-03-21 17:59:45 +01:00 committed by Ruben Calvo
parent 43fb6ebe7a
commit 4b46939258
No known key found for this signature in database
2 changed files with 12 additions and 14 deletions

View file

@ -5,7 +5,7 @@
<h1>{{ lang('STORAGE_TITLE') }}</h1> <h1>{{ lang('STORAGE_TITLE') }}</h1>
{% if S_CONTINUE_UPDATING %} {% if S_CONTINUE_UPDATING %}
<script type="text/javascript"> <script>
// <![CDATA[ // <![CDATA[
/** /**
* Popup storage update progress bar * Popup storage update progress bar
@ -61,7 +61,6 @@
{% endif %} {% endif %}
<form id="acp_storage" method="post" action="{{ U_ACTION }}"> <form id="acp_storage" method="post" action="{{ U_ACTION }}">
{% for storage in STORAGES %} {% for storage in STORAGES %}
<fieldset> <fieldset>
<legend>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }}</legend> <legend>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }}</legend>

View file

@ -90,7 +90,7 @@ class acp_storage
* @param string $id * @param string $id
* @param string $mode * @param string $mode
*/ */
public function main($id, $mode) public function main(string $id, string $mode)
{ {
global $phpbb_container, $phpbb_dispatcher, $phpbb_root_path; global $phpbb_container, $phpbb_dispatcher, $phpbb_root_path;
@ -130,7 +130,11 @@ class acp_storage
} }
} }
public function settings($id, $mode) /**
* @param string $id
* @param string $mode
*/
public function settings(string $id, string $mode)
{ {
$form_key = 'acp_storage'; $form_key = 'acp_storage';
add_form_key($form_key); add_form_key($form_key);
@ -145,7 +149,7 @@ class acp_storage
$this->load_state(); $this->load_state();
// If user cancelled to continue, remove state // If user cancelled to continue, remove state
if ($this->request->is_set_post('cancel', false)) if ($this->request->is_set_post('cancel'))
{ {
if (!check_form_key($form_key) || !check_link_hash($this->request->variable('hash', ''), 'acp_storage')) if (!check_form_key($form_key) || !check_link_hash($this->request->variable('hash', ''), 'acp_storage'))
{ {
@ -195,7 +199,7 @@ class acp_storage
$sql = 'SELECT file_id, file_path $sql = 'SELECT file_id, file_path
FROM ' . STORAGE_TABLE . " FROM ' . STORAGE_TABLE . "
WHERE storage = '" . $this->db->sql_escape($storage_name) . "' WHERE storage = '" . $this->db->sql_escape($storage_name) . "'
AND file_id > " . $this->state['file_index']; AND file_id > " . (int) $this->state['file_index'];
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))
@ -241,7 +245,7 @@ class acp_storage
$sql = 'SELECT file_id, file_path $sql = 'SELECT file_id, file_path
FROM ' . STORAGE_TABLE . " FROM ' . STORAGE_TABLE . "
WHERE storage = '" . $this->db->sql_escape($storage_name) . "' WHERE storage = '" . $this->db->sql_escape($storage_name) . "'
AND file_id > " . $this->state['file_index']; AND file_id > " . (int) $this->state['file_index'];
$result = $this->db->sql_query($sql); $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))
@ -306,11 +310,6 @@ class acp_storage
$modified_storages = []; $modified_storages = [];
if (!check_form_key($form_key))
{
$messages[] = $this->lang->lang('FORM_INVALID');
}
foreach ($this->storage_collection as $storage) foreach ($this->storage_collection as $storage)
{ {
$storage_name = $storage->get_name(); $storage_name = $storage->get_name();
@ -390,7 +389,7 @@ class acp_storage
} }
else else
{ {
trigger_error(implode('<br />', $messages) . adm_back_link($this->u_action), E_USER_WARNING); trigger_error(implode('<br>', $messages) . adm_back_link($this->u_action), E_USER_WARNING);
} }
} }
@ -429,7 +428,7 @@ class acp_storage
'STORAGE_STATS' => $storage_stats, 'STORAGE_STATS' => $storage_stats,
'PROVIDERS' => $this->provider_collection, 'PROVIDERS' => $this->provider_collection,
'ERROR_MSG' => implode('<br />', $messages), 'ERROR_MSG' => implode('<br>', $messages),
'S_ERROR' => !empty($messages), 'S_ERROR' => !empty($messages),
'U_ACTION' => $this->u_action . '&amp;hash=' . generate_link_hash('acp_storage'), 'U_ACTION' => $this->u_action . '&amp;hash=' . generate_link_hash('acp_storage'),