echo '&k=' . urlencode($crypt_key);
?>';
document.getElementById('submit_download').submit ();"/><?php
- if ($cfg['download_page'] && $cfg['preview'])
+ if ($cfg['download_page'] && $cfg['preview'] && jirafeau_is_viewable($link['mime_type']))
{
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit').action='
-<?php
- echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&p=1';
- if (!empty($crypt_key))
- echo '&k=' . urlencode($crypt_key);
-?>';
- document.getElementById('submit_preview').submit ();"/><?php
+ <?php
+ echo $cfg['web_root'] . '/f.php?h=' . $link_name . '&p=1';
+ if (!empty($crypt_key))
+ echo '&k=' . urlencode($crypt_key);
+ ?>';
+ document.getElementById('submit_preview').submit ();"/><?php
}
echo '</td></tr></table></fieldset></form></div>';
require (JIRAFEAU_ROOT.'lib/template/footer.php');
?>';
document.getElementById('submit_download').submit ();"/><?php
- if ($cfg['download_page'] && $cfg['preview'])
+ if ($cfg['download_page'] && $cfg['preview'] && jirafeau_is_viewable($link['mime_type']))
{
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit').action='
?>
<div id="upload_finished">
- <p>
- <?php echo t('File uploaded! Copy the following URL to get it') ?>:
+ <p><?php echo t('File uploaded !') ?></p>
<br />
- <a id="upload_link" href=""></a>
+
+ <?php if ($cfg['download_page'] == true) { ?>
+ <div id="upload_finished_download_page">
+ <?php echo t('Download page') ?>
+ <p><a id="upload_link" href=""></a></p>
<br />
- </p>
+ </div>
+ <?php } ?>
- <p>
- <?php echo t('Keep the following URL to delete it at any moment'); ?>:
+ <div id="upload_password_page">
+ <p><?php echo t('Download page') ?>:</p>
+ <p><a id="password_link" href=""></a></p>
+ <br />
+ </div>
+
+ <?php if ($cfg['preview'] == true) { ?>
+ <div id="upload_finished_preview">
+ <p><?php echo t('View link') ?>:</p>
+ <p><a id="preview_link" href=""></a></p>
+ <br />
+ </div>
+ <?php } ?>
+
+ <div id="upload_direct_download">
+ <p><?php echo t('Direct download link') ?>:</p>
+ <p><a id="direct_link" href=""></a></p>
+ <br />
+ </div>
+
+ <p><?php echo t('Delete link') ?>:</p>
+ <p><a id="delete_link" href=""></a></p>
<br />
- <a id="delete_link" href=""></a>
- </p>
<p id="validity">
<?php echo t('This file is valid until the following date'); ?>:
$cfg['lang'] = 'auto';
/* Select your style :) See media folder */
$cfg['style'] = 'modern';
-/* Set preview option.
- * true: will propose user's browser to preview file if possible.
- * false: will just download the file, whatever the content is.
- */
+/* Propose a preview link if file type is previewable is set to true. */
$cfg['preview'] = true;
-/* Download page:
- * true: Will show a download page (with preview if permited and possible).
- * false: Will directly download file or preview (if permited and possible).
- */
-$cfg['download_page'] = false;
+/* Download page: propose a link to a download page is set to true. */
+$cfg['download_page'] = true;
/* Encryption feature. disable it by default.
* By enabling it, file-level deduplication won't work.
*/
function show_link (url, reference, delete_code, crypt_key, date)
{
+ // Download page if element exists
var download_link = url + 'f.php?h=' + reference;
var download_link_href = url + 'f.php?h=' + reference;
if (crypt_key.length > 0)
download_link += '&k=' + crypt_key;
download_link_href += '&k=' + crypt_key;
}
+ if (!!document.getElementById('upload_finished_download_page'))
+ {
+ document.getElementById('upload_link').innerHTML = download_link;
+ document.getElementById('upload_link').href = download_link_href;
+ }
+
+ // Is the preview allowed ?
+ if (!!document.getElementById('preview_link'))
+ {
+ document.getElementById('upload_finished_preview').style.display = 'none';
+ var preview_link = url + 'f.php?h=' + reference + '&p=1';
+ var preview_link_href = url + 'f.php?h=' + reference + '&p=1';
+ if (crypt_key.length > 0)
+ {
+ preview_link += '&k=' + crypt_key;
+ preview_link_href += '&k=' + crypt_key;
+ }
+
+ // Test if content can be previewed
+ type = document.getElementById('file_select').files[0].type;
+ if (type.indexOf("image") > -1 ||
+ type.indexOf("audio") > -1 ||
+ type.indexOf("text") > -1 ||
+ type.indexOf("video") > -1)
+ {
+ document.getElementById('preview_link').innerHTML = preview_link;
+ document.getElementById('preview_link').href = preview_link_href;
+ document.getElementById('upload_finished_preview').style.display = '';
+ }
+ }
+
+ // Only show link to password page if password is set
+ document.getElementById('upload_password_page').style.display = 'none';
+ if (document.getElementById('input_key').value.length > 0)
+ {
+ if (!!document.getElementById('upload_finished_download_page'))
+ document.getElementById('upload_finished_download_page').style.display = 'none';
+ document.getElementById('upload_password_page').style.display = '';
+ if (!!document.getElementById('upload_finished_preview'))
+ document.getElementById('upload_finished_preview').style.display = 'none';
+ document.getElementById('upload_direct_download').style.display = 'none';
+ document.getElementById('password_link').innerHTML = download_link;
+ document.getElementById('password_link').href = download_link_href;
+ }
+ // Direct download link
+ else
+ {
+ var direct_download_link = url + 'f.php?h=' + reference + '&d=1';
+ var direct_download_link_href = url + 'f.php?h=' + reference + '&d=1';
+ if (crypt_key.length > 0)
+ {
+ direct_download_link += '&k=' + crypt_key;
+ direct_download_link_href += '&k=' + crypt_key;
+ }
+ document.getElementById('direct_link').innerHTML = direct_download_link;
+ document.getElementById('direct_link').href = direct_download_link_href;
+ }
+
+ // Delete link
var delete_link = url + 'f.php?h=' + reference + '&d=' + delete_code;
var delete_link_href = url + 'f.php?h=' + reference + '&d=' + delete_code;
-
- document.getElementById('upload_link').innerHTML = download_link;
- document.getElementById('upload_link').href = download_link_href;
document.getElementById('delete_link').innerHTML = delete_link;
document.getElementById('delete_link').href = delete_link_href;
+
if (date)
{
document.getElementById('date').innerHTML = date;
if (!empty ($mime))
{
/* Actually, verify if mime-type is an image or a text. */
- $viewable = array ('image', 'text');
+ $viewable = array ('image', 'text', 'video', 'audio');
$decomposed = explode ('/', $mime);
return in_array ($decomposed[0], $viewable);
}
'Installer script still present' => 'Le script d\'installation est toujours présent',
'Please make sure to delete the installer script "install.php" before continuing.' => 'Merci de supprimer le fichier "install.php" avant de continuer.',
'An error occurred.' => 'Une erreur s\'est produite',
- 'File uploaded! Copy the following URL to get it' => 'Fichier envoyé! Le fichier sera accessible à l\'adresse suivante',
+ 'File uploaded !' => 'Fichier envoyé !',
+ 'Download page' => 'Page de téléchargement',
'This file is valid until the following date' => 'Ce fichier est valable jusqu\'à la date suivante',
- 'Keep the following URL to delete it at any moment' => 'Vous pouvez supprimer le fichier lorsque vous le désirez via l\'adresse suivante',
+ 'View link' => 'Lien d\'affichage',
+ 'Direct download link' => 'Lien de téléchargement direct',
+ 'Delete link' => 'Lien de suppression',
/* f.php */
'Download' => 'Télécharger',
+ 'Preview' => 'Prévisualiser',
'Sorry, the requested file is not found' => 'Désolé, le fichier que vous demandez n\'existe pas ou n\'existe plus',
'File not available.' => 'Fichier non disponible',
'File has been deleted.' => 'Le fichier a été supprimé.',