This repository has been archived on 2020-08-21. You can view files and clone it, but cannot push or open issues or pull requests.
paste-manager/htdocs/list.php

58 lines
1.3 KiB
PHP
Raw Normal View History

2012-01-20 17:41:56 +00:00
<?php
require_once("../common.php");
if ($dh = opendir(DESTINATION))
{
$list = array();
while (($file = readdir($dh)) !== false)
$list[] = array(filemtime(DESTINATION.$file), $file);
closedir($dh);
array_multisort($list, SORT_DESC);
?>
<h1>Dernières publications</h1>
2012-01-20 17:41:56 +00:00
<ul id="list">
<?php
if (empty($_GET["s"]))
$_GET["s"] = 0;
$s = intval($_GET["s"]);
$i = 0;
foreach($list as $f)
{
if ($s > 0)
{
$s--;
continue;
}
if ($i++ > 10)
{
print '<li><a href="./?s='.(intval($_GET["s"])+10).'#list">Plus anciens ...</a></li>';
break;
}
if (preg_match("#^([a-zA-Z0-9]{".RGXP_NB."}).xml$#", $f[1], $fout))
{
$paste = new Paste($fout[1]);
if (empty($paste->title))
$title = "Sans titre";
else
$title = htmlentities($paste->title);
if (empty($paste->author))
$author = "<em>un anonyme</em>";
else
$author = htmlentities($paste->author);
print '<li><a href="./?'.$paste->fileref.'">'.$title."</a> par ".$author.", le ".date("d/m/Y H:i:s", $paste->date)."</li>";
}
}
?>
</ul>
<?php
}
?>