From 6ceeb5ff538f89833b1ab3f2ecd3cf89a3d8e17e Mon Sep 17 00:00:00 2001 From: Jerome Jutteau Date: Wed, 2 Jan 2013 21:47:39 +0100 Subject: [PATCH] Add option to activate or not preview mode --- file.php | 2 +- lib/config.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/file.php b/file.php index d01bee6..400cb73 100644 --- a/file.php +++ b/file.php @@ -119,7 +119,7 @@ if (isset ($_GET['h']) && !empty ($_GET['h'])) header ('Content-Length: ' . $link['file_size']); header ('Content-Type: ' . $link['mime_type']); - if (!jirafeau_is_viewable ($link['mime_type'])) + if (!jirafeau_is_viewable ($link['mime_type']) || !$cfg['preview']) { header ('Content-Disposition: attachment; filename="' . $link['file_name'] . '"'); diff --git a/lib/config.php b/lib/config.php index 502a2a3..08e2d1a 100644 --- a/lib/config.php +++ b/lib/config.php @@ -36,6 +36,9 @@ $cfg['style'] = 'industrial'; $cfg['rewrite'] = false; /* An empty admin password will disable the admin interface. */ $cfg['admin_password'] = ''; +/* preview: false (will download file) or true (will preview in browser if + * possible) . */ +$cfg['preview'] = true; if ((basename (__FILE__) != 'config.local.php') && file_exists (JIRAFEAU_ROOT.'lib/config.local.php')) -- 2.34.1