fix la liste accueil

This commit is contained in:
max/sooulix 2025-02-10 23:12:42 +01:00
parent 43f4d75164
commit c49abfb35b
3 changed files with 38 additions and 8 deletions

View File

@ -73,6 +73,8 @@ function share_list($dir)
function($carry, $child) function($carry, $child)
{ {
$tsv = tsv_path($child); $tsv = tsv_path($child);
var_dump(is_file($tsv));
if (is_file($tsv)) if (is_file($tsv))
{ {
return array_merge($carry, read_tsv($child, $tsv)); return array_merge($carry, read_tsv($child, $tsv));

View File

@ -17,7 +17,7 @@ if ($new_share)
else if (isset($_GET['dir'])) else if (isset($_GET['dir']))
{ {
$selected_dir = $_GET['dir']; $selected_dir = $_GET['dir'];
include('./sanddir.php'); include('./sanddir_template.php');
} }
?> ?>

View File

@ -32,17 +32,45 @@ if (isset($_GET['action']) && $_GET['action'] == 'share')
} }
?> ?>
<h2>Existing links</h2> <h2>Existing shares for <?php _($selected_dir) ?></h2>
<ul>
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Creation</th>
<th>Expiration</th>
</tr>
<?php <?php
foreach (share_links($selected_dir) as $link) foreach (read_tsv($selected_dir, tsv_path($selected_dir)) as $share)
{ {
?> ?>
<li> <tr>
<a href="<?php _($link) ?>"><?php _($link) ?></a> <td>
</li> <?php _($share['name']) ?>
</td>
<td>
<?php _($share['description']) ?>
</td>
<td>
<?php
_(
explode('T', $share['creation'])[0]
);
?>
</td>
<td>
<?php
_(
$share['expires']
? explode('T', $share['expires'])[0]
: 'never'
);
?>
</td>
</tr>
<?php <?php
} }
?> ?>
</ul> </table>