exit;
}
+session_start();
+
/* Upload file */
if (isset($_FILES['file']) && is_writable(VAR_FILES)
&& is_writable(VAR_LINKS)) {
- if (isset($_POST['upload_password'])) {
- if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
+ if (!jirafeau_user_session_logged()) {
+ if (isset($_POST['upload_password']) &&
+ !jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
echo 'Error 3: Invalid password';
exit;
- }
- } else {
- if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
+ } elseif (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
echo 'Error 2: No password nor allowed IP';
exit;
}
}
+
$key = '';
if (isset($_POST['key'])) {
$key = $_POST['key'];
case 'week':
$time += JIRAFEAU_WEEK;
break;
+ case 'fortnight':
+ $time += JIRAFEAU_FORTNIGHT;
+ break;
case 'month':
$time += JIRAFEAU_MONTH;
break;
} else {
$ip = "";
}
-
+
$res = jirafeau_upload(
$_FILES['file'],
isset($_POST['one_time_download']),
one_time='1'
fi
-if [ -n "$UPLOAD_PASSWD" ]; then
- upload_password="$JIRAFEAU_UPLOAD_PASSWORD"
+if [ -n "$JIRAFEAU_UPLOAD_PASSWD" ]; then
+ upload_password="$JIRAFEAU_UPLOAD_PASSWD"
fi
if [ -z "$curl" ]; then
echo " $0 delete URL"
echo
echo "Global variables to export:"
- echo " JIRAFEAU_PROXY: Domain and port of proxy server, eg. »proxysever.example.com:3128«"
+ echo " JIRAFEAU_PROXY: Domain and port of proxy server, eg. »proxyserver.example.com:3128«"
echo " JIRAFEAU_URL : URI to Jirafeau installation with trailing slash, eg. »https://example.com/jirafeau/«"
- echo " JIRAFEAU_TIME : expiration time, eg. »minute«, »hour«, »day«, »week«, »month«, »quarter«, »year« or »none«"
+ echo " JIRAFEAU_TIME : expiration time, eg. »minute«, »hour«, »day«, »week«, fortnight, »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"
echo
echo "Download via API:"
if [[ $key_code ]]; then
- echo " ${0} get ${url}${apipage}?h=$code&k=$key_code [PASSWORD}"
+ echo " ${0} get ${url}${apipage}?h=$code&k=$key_code [PASSWORD]"
else
- echo " ${0} get ${url}${apipage}?h=$code [PASSWORD}"
+ echo " ${0} get ${url}${apipage}?h=$code [PASSWORD]"
fi
echo "Delete via API:"
echo " ${0} delete \"${url}${downloadpage}?h=$code&d=$del_code\""
}
/* Initialize an asynchronous upload. */
elseif (isset($_GET['init_async'])) {
- if (isset($_POST['upload_password'])) {
+ if (jirafeau_user_session_logged()) {}
+ elseif (isset($_POST['upload_password'])) {
if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
echo 'Error 20: Invalid password';
exit;
case 'week':
$time += JIRAFEAU_WEEK;
break;
+ case 'fortnight':
+ $time += JIRAFEAU_FORTNIGHT;
+ break;
case 'month':
$time += JIRAFEAU_MONTH;
break;
} else {
$ip = "";
}
-
+
echo jirafeau_async_init(
$_POST['filename'],
$type,