aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-05-06 20:35:30 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-05-06 20:35:30 +0000
commit6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d (patch)
treed3f928edf10e7a9685b5908f0e151d7c356f083e /phpBB
parent830f1fdab7b1a216ed1d00df1ae98ed31286291e (diff)
downloadforums-6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d.tar
forums-6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d.tar.gz
forums-6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d.tar.bz2
forums-6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d.tar.xz
forums-6d3a8bd107bbd40d7afa3cc7adc5d5f46a3de63d.zip
- 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
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/style/acp_database.html2
-rw-r--r--phpBB/includes/acp/acp_database.php21
-rw-r--r--phpBB/language/en/acp/database.php3
3 files changed, 17 insertions, 9 deletions
diff --git a/phpBB/adm/style/acp_database.html b/phpBB/adm/style/acp_database.html
index c1db0cda9c..980ed4d68e 100644
--- a/phpBB/adm/style/acp_database.html
+++ b/phpBB/adm/style/acp_database.html
@@ -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>
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 587f3d0851..4afbea026d 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -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'
));
diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php
index bc212c20e2..f077fb95fe 100644
--- a/phpBB/language/en/acp/database.php
+++ b/phpBB/language/en/acp/database.php
@@ -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',