'link' => '',
'delete_link' => ''));
}
- jirafeau_add_file($file, $one_time_download, $key, $time, $ip, $crypt, $link_name_length, $file_hash_method);
+ return jirafeau_add_file($file, $one_time_download, $key, $time, $ip, $crypt, $link_name_length, $file_hash_method);
}
/**
if (!empty($mime)) {
$viewable = array('image', 'video', 'audio');
$decomposed = explode('/', $mime);
- if (in_array($decomposed[0], $viewable) && strpos($mime, 'image/svg+xml') === false) {
+ if (in_array($decomposed[0], $viewable) && stripos($mime, 'image/svg+xml') === false && strpos($mime, ',') === false) {
return true;
}
$viewable = array('text/plain');
if (!empty($link_hash) && $link_hash != $node) {
continue;
}
+
+ /* Get download statistics */
+ $ld = jirafeau_get_download_stats($node);
/* Print link information. */
echo '<tr>';
echo '<td><strong>';
if (strlen($l['ip']) > 0) {
echo t('ORIGIN') . ': ' . $l['ip'] . '<br/>';
}
+ echo t('DOWNLOAD_COUNT') . ': ' . $ld['count'] . '<br/>';
+ if ($ld['count'] > 0) {
+ echo t('DOWNLOAD_DATE') . ': ' . jirafeau_get_datetimefield($ld['date']) . '<br/>';
+ echo t('DOWNLOAD_IP') . ': ' . $ld['ip'] . '<br/>';
+ }
echo '</td><td>';
if (!$l['crypted'] && !$l['crypted_legacy']) {
return "Error: referenced file does not exist";
}
+ /* Store filesize before encrypting the file */
+ /* Otherwise we would send the size of the encrypted file and the data of the unencrypted file */
+ /* This would break some browsers */
+ $size = filesize($p);
+
$crypted = false;
$crypt_key = '';
if ($crypt == true && extension_loaded('sodium') == true) {
}
$hash = jirafeau_hash_file($file_hash_method, $p);
- $size = filesize($p);
$np = s2p($hash);
$delete_link_code = jirafeau_gen_random(5);
fclose($handle);
}
-function jirafeau_create_upload_finished_box($preview = true)
+function jirafeau_create_upload_finished_box($preview = true, $download_pass = null)
{
?>
</p>
</div>
+ <?php if (!is_null($download_pass)) { ?>
+ <div id="show_password">
+ <p><?php echo t('PSW') ?></p>
+
+ <div id="download_password">
+ <p>
+ <?php echo '<input id="output_key" value="' . $download_pass . '" readonly/>'?>
+ <button id="password_copy_button">📋</button>
+ </p>
+ </div>
+ </div>
+ <?php
+ }?>
+
+
<?php
if ($preview == true) { ?>
<div id="upload_finished_preview">