1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-15 21:44:56 +01:00

- Make it impossible to open/delete/download files that don't exist :P

git-svn-id: file:///svn/phpbb/trunk@5891 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-05-06 20:35:30 +00:00
parent 830f1fdab7
commit 6d3a8bd107
3 changed files with 17 additions and 9 deletions

View File

@ -14,11 +14,13 @@
<dd><select id="file" name="file" size="10"><!-- BEGIN files --><option value="{files.FILE}"<!-- IF files.S_LAST_ROW --> selected="selected"<!-- ENDIF -->>{files.NAME}</option><!-- END files --></select></dd>
</dl>
</fieldset>
<!-- IF EXISTS -->
<fieldset class="submit-buttons">
<input class="button1" type="submit" id="submit" name="submit" value="{L_START_RESTORE}" />&nbsp;
<input class="button2" type="submit" id="delete" name="delete" value="{L_DELETE_BACKUP}" />&nbsp;
<input class="button2" type="submit" id="download" name="download" value="{L_DOWNLOAD_BACKUP}" />
</fieldset>
<!-- ENDIF -->
</form>
<!-- ELSE -->
<h1>{L_ACP_BACKUP}</h1>

View File

@ -1023,11 +1023,7 @@ class acp_database
{
continue;
}
$methods[] = $type;
}
foreach ($methods as $type)
{
$template->assign_block_vars('methods', array(
'TYPE' => $type
));
@ -1041,16 +1037,19 @@ class acp_database
{
case 'submit':
$delete = request_var('delete', '');
$file = request_var('file', '');
if (!(file_exists($file) && is_readable($file)))
{
trigger_error($lang['BACKUP_INVALID']);
}
if ($delete)
{
$file = request_var('file', '');
unlink($phpbb_root_path . 'store/' . $file);
trigger_error($user->lang['BACKUP_SUCCESS']);
}
$file = request_var('file', '');
preg_match('#^(\d{10})\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches);
$data = file_get_contents($phpbb_root_path . 'store/' . $matches[0]);
@ -1113,7 +1112,7 @@ class acp_database
break;
default:
$selected = $stop = false;
$selected = false;
$methods = array('sql');
$available_methods = array('sql.gz' => 'zlib', 'sql.bz2' => 'bz2');
@ -1141,11 +1140,17 @@ class acp_database
'NAME' => gmdate("d-m-Y H:i:s", $matches[1]),
'SUPPORTED' => $supported
));
$selected = true;
}
}
}
closedir($dh);
if ($selected === true)
{
$template->assign_var('EXISTS', true);
}
$template->assign_vars(array(
'U_ACTION' => $this->u_action . '&amp;action=submit'
));

View File

@ -34,6 +34,7 @@ $lang = array_merge($lang, array(
'ACP_BACKUP_EXPLAIN' => 'Here you can backup all your phpBB related data. You may store the resulting archive in your store/ folder or download it directly. Depending on your server configuration you be able to compress the file in a number of formats. If you wish to include any additional "custom" tables please list them in the additional tables field, separated by commas. ',
'BACKUP_OPTIONS' => 'Backup options',
'BACKUP_TYPE' => 'Backup type',
'BACKUP_INVALID' => 'The selected file to backup is invalid',
'START_BACKUP' => 'Start Backup',
'FULL_BACKUP' => 'Full',
'STRUCTURE_ONLY' => 'Structure Only',
@ -43,7 +44,7 @@ $lang = array_merge($lang, array(
'STORE_LOCAL' => 'Store file locally',
'SELECT_ALL' => 'Select all',
'DESELECT_ALL' => 'Deselect all',
'BACKUP_SUCCESS' => 'The backup file has been created successfully in the location you specified',
'BACKUP_SUCCESS' => 'The backup file has been created successfully',
'STORE_AND_DOWNLOAD' => 'Store and Download',
'ACP_RESTORE' => 'Restore',