- if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0)
- continue;
- /* Read link informations. */
- $l = jirafeau_get_link ($link);
-
- /* Filter. */
- if (!empty ($name) && $name != $l['file_name'])
- continue;
- if (!empty ($file_hash) && $file_hash != $l['md5'])
- continue;
- if (!empty ($link_hash) && $link_hash != $link)
- continue;
-
- /* Print link informations. */
- echo '<tr>';
- echo '<td>' . $l['file_name'] . '</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'])) .
- '</td>';
- echo '<td>' . $l['onetime'] . '</td>';
- echo '<td>' . strftime ('%c', $l['upload_date']) . '</td>';
- echo '<td>' . $l['ip'] . '</td>';
- echo '<td>' .
- '<form action = "admin.php" method = "post">' .
- '<input type = "hidden" name = "action" value = "delete_link"/>' .
- '<input type = "hidden" name = "link" value = "' . $link . '"/>' .
- '<input type = "submit" value = "' . _('Del link') . '" />' .
- '</form>' .
- '<form action = "admin.php" method = "post">' .
- '<input type = "hidden" name = "action" value = "delete_file"/>' .
- '<input type = "hidden" name = "md5" value = "' . $l['md5'] . '"/>' .
- '<input type = "submit" value = "' . _('Del file and links') . '" />' .
- '</form>' .
- '</td>';
- echo '</tr>';
+ $dir = scandir ($d);
+ foreach ($dir as $node)
+ {
+ if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
+ preg_match ('/\.tmp/i', "$node"))
+ continue;
+ if (is_dir ($d . $node))
+ {
+ /* Push new found directory. */
+ $stack[] = $d . $node . '/';
+ }
+ elseif (is_file ($d . $node))
+ {
+ /* Read link informations. */
+ $l = jirafeau_get_link ($node);
+ if (!count ($l))
+ continue;
+
+ /* Filter. */
+ 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 != $node)
+ continue;
+ /* Print link informations. */
+ echo '<tr>';
+ 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'])) .
+ '</td>';
+ echo '<td>' . $l['onetime'] . '</td>';
+ echo '<td>' . strftime ('%c', $l['upload_date']) . '</td>';
+ echo '<td>' . $l['ip'] . '</td>';
+ echo '<td>' .
+ '<form action = "admin.php" method = "post">' .
+ '<input type = "hidden" name = "action" value = "delete_link"/>' .
+ '<input type = "hidden" name = "link" value = "' . $node . '"/>' .
+ '<input type = "submit" value = "' . t('Del link') . '" />' .
+ '</form>' .
+ '<form action = "admin.php" method = "post">' .
+ '<input type = "hidden" name = "action" value = "delete_file"/>' .
+ '<input type = "hidden" name = "md5" value = "' . $l['md5'] . '"/>' .
+ '<input type = "submit" value = "' . t('Del file and links') . '" />' .
+ '</form>' .
+ '</td>';
+ echo '</tr>';
+ }
+ }