From: Jerome Jutteau Date: Wed, 2 Jan 2013 20:47:39 +0000 (+0100) Subject: Add option to activate or not preview mode X-Git-Tag: 1.0~5 X-Git-Url: https://git.p6c8.net/jirafeau.git/commitdiff_plain/6ceeb5ff538f89833b1ab3f2ecd3cf89a3d8e17e?hp=c5187160be16af5c5574a020ff83e7da586c4338 Add option to activate or not preview mode --- 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'))