<div id="options">
<table id="option_table">
- <tr>
- <td><?php echo t('ONE_TIME_DL'); ?>:</td>
- <td><input type="checkbox" id="one_time_download" /></td>
- </tr>
+ <?php
+ if ($cfg['one_time_download']) {
+ echo '<tr><td>' . t('ONE_TIME_DL') . ':</td>';
+ echo '<td><input type="checkbox" id="one_time_download" /></td></tr>';
+ }
+ ?>
<tr>
<td><label for="input_key"><?php echo t('PSW') . ':'; ?></label></td>
<td><input type="password" name="key" id="input_key" /></td>
*/
$cfg['availability_default'] = 'month';
+/* Give the uploading user the option to have the file
+ * deleted after the first download.
+ */
+$cfg['one_time_download'] = true;
+
/* Set maximal upload size expressed in MB.
* »0« means unlimited upload size.
*/
function upload (max_size)
{
+ var one_time_checkbox = document.getElementById('one_time_download');
+ var one_time = one_time_checkbox !== null ? one_time_checkbox.checked : false;
if (check_html5_file_api ()
&& document.getElementById('file_select').files[0].size >= max_size)
{
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
- document.getElementById('one_time_download').checked,
+ one_time,
document.getElementById('upload_password').value
);
}
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
- document.getElementById('one_time_download').checked,
+ one_time,
document.getElementById('upload_password').value
);
}
exit;
}
+ // Check if one time download is enabled
+ if (!$cfg['one_time_download'] && isset($_POST['one_time_download'])) {
+ echo 'Error 26: One time download is disabled.';
+ exit;
+ }
+
$res = jirafeau_upload($_FILES['file'],
isset($_POST['one_time_download']),
$key, $time, get_ip_address($cfg),
$key = $_POST['key'];
}
+ // Check if one time download is enabled
+ if (!$cfg['one_time_download'] && isset($_POST['one_time_download'])) {
+ echo 'Error 26: One time download is disabled.';
+ exit;
+ }
+
$time = time();
if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) {
echo 'Error 22';