<?php
/*
* Jirafeau, your web file repository
- * Copyright (C) 2015 Jerome Jutteau <j.jutteau@gmail.com>
+ * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/*
- * This file permits to easyly script file sending, receiving, deleting, ...
- * If you don't want this feature, you can simply delete this file from your
- * web directory.
- */
+/* This file offer a kind of API for jirafeau. */
+
define('JIRAFEAU_ROOT', dirname(__FILE__) . '/');
require(JIRAFEAU_ROOT . 'lib/settings.php');
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),
$r = fopen(VAR_FILES . $p . $link['hash'], 'r');
while (!feof($r)) {
print fread($r, 1024);
- ob_flush();
}
fclose($r);
time='<?php echo $cfg['availability_default']; ?>' # Or set JIRAFEAU_TIME.
one_time='' # Or set JIRAFEAU_ONE_TIME.
curl='' # Or set JIRAFEAU_CURL_PATH.
+upload_password='' # Or set JIRAFEAU_UPLOAD_PASSWD
# Config end
if [ -n "$JIRAFEAU_PROXY" ]; then
one_time='1'
fi
+if [ -n "$UPLOAD_PASSWD" ]; then
+ upload_password="$JIRAFEAU_UPLOAD_PASSWORD"
+fi
+
if [ -z "$curl" ]; then
curl="$JIRAFEAU_CURL_PATH"
fi
echo " JIRAFEAU_TIME : expiration time, eg. »minute«, »hour«, »day«, »week«, »month«, »quarter«, »year« or »none«"
echo " JIRAFEAU_ONE_TIME : self-destroy after first download, eg. »1« to enable or »« (empty) to disable"
echo " JIRAFEAU_CURL : alternative path to curl binary"
+ echo " JIRAFEAU_UPLOAD_PASSWD : upload password"
exit 0
fi
options="$options -F one_time_download=1"
fi
+if [ -n "$upload_password" ]; then
+ options="$options -F upload_password=$upload_password"
+fi
+
password=''
if [ -n "$3" ]; then
password="$3"
$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';