mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/15699] Use template variables
PHPBB3-15699
This commit is contained in:
parent
3c4aa6ee8c
commit
4974f86059
3 changed files with 24 additions and 18 deletions
|
@ -126,9 +126,9 @@
|
|||
<dl>
|
||||
<dt><label for="update_type">{{ lang('STORAGE_UPDATE_TYPE') }}{{ lang('COLON') }}</label></dt>
|
||||
<dd>
|
||||
<label><input id="update_type" class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_CONFIG') }}" checked="checked" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_CONFIG') }}</label>
|
||||
<label><input class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_COPY') }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_COPY') }}</label>
|
||||
<label><input class="radio" name="update_type" value="{{ constant('STORAGE_UPDATE_TYPE_MOVE') }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_MOVE') }}</label>
|
||||
<label><input id="update_type" class="radio" name="update_type" value="{{ STORAGE_UPDATE_TYPE_CONFIG }}" checked="checked" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_CONFIG') }}</label>
|
||||
<label><input class="radio" name="update_type" value="{{ STORAGE_UPDATE_TYPE_COPY }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_COPY') }}</label>
|
||||
<label><input class="radio" name="update_type" value="{{ STORAGE_UPDATE_TYPE_MOVE }}" type="radio"> {{ lang('STORAGE_UPDATE_TYPE_MOVE') }}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
|
@ -86,6 +86,13 @@ class acp_storage
|
|||
/** @var mixed */
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Update type constants
|
||||
*/
|
||||
public const STORAGE_UPDATE_TYPE_CONFIG = 0;
|
||||
public const STORAGE_UPDATE_TYPE_COPY = 1;
|
||||
public const STORAGE_UPDATE_TYPE_MOVE = 2;
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @param string $mode
|
||||
|
@ -181,7 +188,7 @@ class acp_storage
|
|||
}
|
||||
|
||||
// If update_type is copy or move, copy files from the old to the new storage
|
||||
if (in_array($this->state['update_type'], [STORAGE_UPDATE_TYPE_COPY, STORAGE_UPDATE_TYPE_MOVE], true))
|
||||
if (in_array($this->state['update_type'], [self::STORAGE_UPDATE_TYPE_COPY, self::STORAGE_UPDATE_TYPE_MOVE], true))
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
||||
|
@ -208,7 +215,7 @@ class acp_storage
|
|||
{
|
||||
$this->save_state();
|
||||
meta_refresh(1, append_sid($this->u_action . '&action=update&hash=' . generate_link_hash('acp_storage')));
|
||||
trigger_error($this->lang->lang('STORAGE_UPDATE_REDIRECT', $this->lang->lang('STORAGE_' . strtoupper($storage_name) . '_TITLE'), $i + 1, count($this->state['storages'])));
|
||||
trigger_error($this->lang->lang('self::STORAGE_UPDATE_REDIRECT', $this->lang->lang('STORAGE_' . strtoupper($storage_name) . '_TITLE'), $i + 1, count($this->state['storages'])));
|
||||
}
|
||||
|
||||
$stream = $current_adapter->read_stream($row['file_path']);
|
||||
|
@ -228,7 +235,7 @@ class acp_storage
|
|||
}
|
||||
|
||||
// If update_type is move files, remove the old files
|
||||
if ($this->state['update_type'] === STORAGE_UPDATE_TYPE_MOVE)
|
||||
if ($this->state['update_type'] === self::STORAGE_UPDATE_TYPE_MOVE)
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($this->state['storages'] as $storage_name => $storage_options)
|
||||
|
@ -355,7 +362,7 @@ class acp_storage
|
|||
$this->state = [
|
||||
// Save the value of the checkbox, to remove all files from the
|
||||
// old storage once they have been successfully moved
|
||||
'update_type' => (int) $this->request->variable('update_type', STORAGE_UPDATE_TYPE_CONFIG),
|
||||
'update_type' => (int) $this->request->variable('update_type', self::STORAGE_UPDATE_TYPE_CONFIG),
|
||||
'storage_index' => 0,
|
||||
'file_index' => 0,
|
||||
'remove_storage_index' => 0,
|
||||
|
@ -424,14 +431,18 @@ class acp_storage
|
|||
}
|
||||
|
||||
$this->template->assign_vars([
|
||||
'STORAGES' => $this->storage_collection,
|
||||
'STORAGE_STATS' => $storage_stats,
|
||||
'PROVIDERS' => $this->provider_collection,
|
||||
'STORAGES' => $this->storage_collection,
|
||||
'STORAGE_STATS' => $storage_stats,
|
||||
'PROVIDERS' => $this->provider_collection,
|
||||
|
||||
'ERROR_MSG' => implode('<br>', $messages),
|
||||
'S_ERROR' => !empty($messages),
|
||||
'ERROR_MSG' => implode('<br>', $messages),
|
||||
'S_ERROR' => !empty($messages),
|
||||
|
||||
'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_storage'),
|
||||
'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_storage'),
|
||||
|
||||
'STORAGE_UPDATE_TYPE_CONFIG' => self::STORAGE_UPDATE_TYPE_CONFIG,
|
||||
'STORAGE_UPDATE_TYPE_COPY' => self::STORAGE_UPDATE_TYPE_COPY,
|
||||
'STORAGE_UPDATE_TYPE_MOVE' => self::STORAGE_UPDATE_TYPE_MOVE,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -228,11 +228,6 @@ define('CAPTCHA_MAX_CHARS', 7);
|
|||
// Additional constants
|
||||
define('VOTE_CONVERTED', 127);
|
||||
|
||||
// Storage update methods
|
||||
define('STORAGE_UPDATE_TYPE_CONFIG', 0);
|
||||
define('STORAGE_UPDATE_TYPE_COPY', 1);
|
||||
define('STORAGE_UPDATE_TYPE_MOVE', 2);
|
||||
|
||||
// BC global FTW
|
||||
global $table_prefix;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue