Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate input for zip extension, increase input size for visibility #58

Merged
merged 1 commit into from Dec 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion index.php
Expand Up @@ -722,7 +722,7 @@ function replaceNewUpdater() {
case 6:
$createBackup = $_POST['create_backup'];
if($createBackup === 'true') {
echo(json_encode(array('continue' => true, 'response' => 'Choose location where to backup the /lists directory. Please make sure to choose a location outside the web root: <form onsubmit="return false;"><input type="text" id="backuplocation" name="backup_location" placeholder="/var/backup.zip" /></form>')));
echo(json_encode(array('continue' => true, 'response' => 'Choose location where to backup the /lists directory. Please make sure to choose a location outside the web root:<br> <form onsubmit="return false;"><input type="text" id="backuplocation" size="55" name="backup_location" placeholder="/var/backup.zip" /></form>')));
} else {
echo(json_encode(array('continue' => true, 'response' => '', 'autocontinue'=>true)));
}
Expand All @@ -736,6 +736,10 @@ function replaceNewUpdater() {
echo(json_encode(array('retry' => true, 'continue' => false, 'response' => 'Please choose a folder outside of your phpList installation.')));
break;
}
if (!preg_match("/^.*\.(zip)$/i", $_POST['backup_location'])) {
echo(json_encode(array('retry' => true, 'continue' => false, 'response' => 'Please add .zip extension.')));
break;
}
try {
$update->backUpFiles($_POST['backup_location']);
echo(json_encode(array('continue' => true, 'response' => 'Backup has been created')));
Expand Down