]> git.p6c8.net - jirafeau_mojo42.git/blobdiff - lib/functions.js.php
Add support for the X-Sendfile header/module to offload downloads.
[jirafeau_mojo42.git] / lib / functions.js.php
index 7cf1da8644261a52476a3fcfc880fc33efdac3cb..2127dbbb3f6201700b94bfce53545189839a2d62 100644 (file)
@@ -182,16 +182,17 @@ function show_link (reference, delete_code, crypt_key, date)
         }
 
         // Test if content can be previewed
-         type = document.getElementById('file_select').files[0].type;
-         if (type.startsWith('image/') ||
-                type.startsWith('audio') ||
-                type.startsWith('text/plain') ||
-                type.startsWith('video/'))
-         {
+        type = document.getElementById('file_select').files[0].type;
+        if ((type.startsWith('image/')
+                || type.startsWith('audio')
+                || type.startsWith('text/plain')
+                || type.startsWith('video/'))
+            && !type.includes('image/svg+xml'))
+        {
             document.getElementById('preview_link').href = preview_link_href;
             document.getElementById('preview_link_text').innerHTML = web_root + preview_link_href;
             document.getElementById('upload_finished_preview').style.display = '';
-         }
+        }
     }
 
     // Direct download link
@@ -320,6 +321,11 @@ function add_time_string_to_date(d, time)
         d.setSeconds (d.getSeconds() + 604800);
         return true;
     }
+    if (time == 'fortnight')
+    {
+        d.setSeconds (d.getSeconds() + 1209600);
+        return true;
+    }
     if (time == 'month')
     {
                d.setSeconds (d.getSeconds() + 2592000);

patrick-canterino.de