-if (isset ($_FILES['file']) && is_writable (VAR_FILES)
- && is_writable (VAR_LINKS))
-{
- if (!jirafeau_challenge_upload_ip ($cfg, get_ip_address($cfg)))
- {
- echo 'Error 2';
- exit;
- }
-
- if (jirafeau_has_upload_password ($cfg) &&
- (!isset ($_POST['upload_password']) ||
- !jirafeau_challenge_upload_password ($cfg, $_POST['upload_password'])))
- {
- echo 'Error 3';
- exit;
+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'])) {
+ echo 'Error 3: Invalid password';
+ exit;
+ }
+ } else {
+ if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
+ echo 'Error 2: No password nor allowed IP';
+ exit;
+ }