- if(!empty($key)) {
- if(!isset($_POST['key'])) {
- require(JIRAFEAU_ROOT . 'lib/template/header.php');
-?>
-<div id="upload">
-<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
-<input type="hidden" name="jirafeau" value="<?php echo JIRAFEAU_VERSION; ?>" />
-<fieldset>
- <legend><?php echo _('Key protection'); ?></legend>
- <table>
- <tr>
- <td><?php echo _('Give the key of this file:'); ?> <input type="password" name="key" /></td>
- </tr>
- <tr>
- <td><input type="submit" value="<?php echo _('I have the right to download this file'); ?>" /></td>
- </tr>
- </table>
-</fieldset>
-</form>
-</div>
-<?php
- require(JIRAFEAU_ROOT . 'lib/template/footer.php');
- exit;
- } else {
- if($key != md5($_POST['key'])) {
- header("HTTP/1.0 403 Forbidden");
-
- require(JIRAFEAU_ROOT . 'lib/template/header.php');
- echo '<div class="error"><p>Error 403: Forbidden</p></div>';
- require(JIRAFEAU_ROOT . 'lib/template/footer.php');
- exit;
+$password_challenged = false;
+if (!empty ($link['key']))
+{
+ if (!isset ($_POST['key']))
+ {
+ require (JIRAFEAU_ROOT.'lib/template/header.php');
+ echo '<div>' .
+ '<form action = "' . $_SERVER['REQUEST_URI'] . '" ' .
+ 'method = "post" id = "submit">'; ?>
+ <input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
+ echo '<fieldset>' .
+ '<legend>' . t('Password protection') .
+ '</legend><table><tr><td>' .
+ t('Give the password of this file') . ' : ' .
+ '<input type = "password" name = "key" />' .
+ '</td></tr>' .
+ '<tr><td>' .
+ t('By using our services, you accept of our'). ' <a href="' . $cfg['web_root'] . '/tos.php' . '">' . t('Term Of Service') . '</a>' .
+ '</td></tr>' .
+ '<tr><td>';
+ ?><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
+ onclick="document.getElementById('submit').action='<?php echo $_SERVER['REQUEST_URI'] ?>&bd=1';
+ document.getElementById('submit_download').submit ();"/><?php
+
+ if ($cfg['download_page'] && $cfg['preview'])
+ {
+ ?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
+ onclick="document.getElementById('submit').action='<?php echo $_SERVER['REQUEST_URI'] ?>&bp=1';
+ document.getElementById('submit_preview').submit ();"/><?php