Add a new tag to hide a paste on the main page

This commit is contained in:
Némunaire 2012-02-29 14:41:00 +01:00
commit a6a87b6f8a
5 changed files with 23 additions and 8 deletions

View file

@ -9,7 +9,7 @@ function generate_latex($filein, $content)
if (is_file($fileout))
return $fileout;
if (!preg_match("#\\begin{document}#ui", $content))
if (!preg_match("#begin{document}#ui", $content))
$content = "\documentclass[10pt]{report}
\usepackage[utf8x]{inputenc}

View file

@ -7,7 +7,7 @@
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
</head>
<body>
<a href="http://github.com/nemunaire/Paste-Manager"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/4c7dc970b89fd04b81c8e221ba88ff99a06c6b61/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub"></a>
<a href="http://github.com/nemunaire/Paste-Manager"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/c641758e06304bc53ae7f633269018169e7e5851/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f77686974655f6666666666662e706e67" alt="Fork me on GitHub"></a>
<?php
require_once("../common.php");
@ -53,7 +53,7 @@ foreach ($_GET as $k => $t)
<h2><?php echo $paste->get_subtitle(); ?></h2>
<div id="content">
<div class="answer">
<a href="/?a=<?php echo $kout[1]; ?>">Répondre</a>
<a href="/?a=<?php echo $kout[1]; if (!empty($_POST["passwd"])) echo ":".$_POST["passwd"]; ?>">Répondre</a>
<?php echo $paste->get_ref(isset($diff)); ?>
<?php echo $paste->get_gen(isset($diff)); ?>
</div>
@ -79,7 +79,7 @@ if (!empty($view))
exit;
//Load answer paste
if (!empty($_GET["a"]) && preg_match("#^[a-zA-Z0-9]{".RGXP_NB."}$#", $_GET["a"])
if (!empty($_GET["a"]) && preg_match("#^([a-zA-Z0-9]{".RGXP_NB."})(:([a-zA-Z0-9]{".RGXP_NB."}))?$#", $_GET["a"], $kout)
&& is_file(Paste::get_path($k = $_GET["a"])))
$paste = new Paste($k);
else

View file

@ -26,7 +26,7 @@ if ($dh = opendir(DESTINATION))
continue;
}
if ($i++ > 10)
if ($i > 10)
{
print '<li><a href="./?s='.(intval($_GET["s"])+10).'#list">Plus anciens ...</a></li>';
break;
@ -35,6 +35,8 @@ if ($dh = opendir(DESTINATION))
if (preg_match("#^([a-zA-Z0-9]{".RGXP_NB."}).xml$#", $f[1], $fout))
{
$paste = new Paste($fout[1]);
if ($paste->is_private ())
continue;
if (empty($paste->title))
$title = "Sans titre";
@ -47,7 +49,7 @@ if ($dh = opendir(DESTINATION))
$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>";
$i++;
}
}
?>