return $p;
}
+/**
+ * Convert base 16 to base 64
+ * @returns A string based on 64 characters (0-9, a-z, A-Z, "-" and "_")
+ */
+function
+base_16_to_64 ($num)
+{
+ $m = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_';
+ $o = '';
+ $b = '';
+ $i = 0;
+ $size = strlen ($num);
+ for ($i = 0; $i < $size; $i++)
+ $b .= base_convert ($num{$i}, 16, 2);
+ $size = strlen ($b);
+ for ($i = $size - 6; $i >= 0; $i -= 6)
+ $o = $m{bindec (substr ($b, $i, 6))} . $o;
+ if ($i < 0 && $i > -6)
+ $o = $m{bindec (substr ($b, 0, $i + 6))} . $o;
+ return $o;
+}
+
function
jirafeau_human_size ($octets)
{
NL . $md5. NL . ($one_time_download ? 'O' : 'R') . NL.date ('U') .
NL. $ip . NL. $delete_link_code . NL);
fclose ($handle);
- $md5_link = md5_file ($link_tmp_name);
+ $md5_link = base_16_to_64 (md5_file ($link_tmp_name));
$l = s2p ("$md5_link");
if (!@mkdir (VAR_LINKS . $l, 0755, true) ||
!rename ($link_tmp_name, VAR_LINKS . $l . $md5_link))
{
echo '<fieldset><legend>';
if (!empty ($name))
- echo $name . ' ';
+ echo t('Filename') . ": $name ";
if (!empty ($file_hash))
- echo $file_hash . ' ';
+ echo t('file') . ": $file_hash ";
if (!empty ($link_hash))
- echo $link_hash . ' ';
+ echo t('link') . ": $link_hash ";
if (empty ($name) && empty ($file_hash) && empty ($link_hash))
echo t('List all files');
echo '</legend>';
continue;
/* Filter. */
- if (!empty ($name) && $name != $l['file_name'])
+ if (!empty ($name) && !preg_match ("/$name/i", $l['file_name']))
continue;
if (!empty ($file_hash) && $file_hash != $l['md5'])
continue;
- if (!empty ($link_hash) && $link_hash != $link)
+ if (!empty ($link_hash) && $link_hash != $node)
continue;
/* Print link informations. */
echo '<tr>';
- echo '<td>' . $l['file_name'] . '</td>';
+ echo '<td>' .
+ '<form action = "admin.php" method = "post">' .
+ '<input type = "hidden" name = "action" value = "download"/>' .
+ '<input type = "hidden" name = "link" value = "' . $node . '"/>' .
+ '<input type = "submit" value = "' . $l['file_name'] . '" />' .
+ '</form>';
+ echo '</td>';
echo '<td>' . $l['mime_type'] . '</td>';
echo '<td>' . jirafeau_human_size ($l['file_size']) . '</td>';
echo '<td>' . ($l['time'] == -1 ? '' : strftime ('%c', $l['time'])) .