Add some search option in the last paste list

This commit is contained in:
Némunaire 2012-11-05 19:45:20 +01:00
commit ca8b5a0c3e
6 changed files with 32 additions and 11 deletions

View file

@ -23,12 +23,15 @@ function generate_latex($filein, $content)
\usepackage{hyperref}
\usepackage{listings}
\usepackage{color}
\usepackage{array}
\usepackage{tikz}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{language=C++,keywordstyle=\color{blue},stringstyle=\color{mauve}}
\usetikzlibrary{arrows}
\begin{document}".$content."\end{document}";
@ -103,7 +106,7 @@ foreach ($_GET as $k => $t)
print "Je ne sais pas compiler ce code source :(";
$log = ob_get_clean();
ob_end_clean();
if (isset($f) && is_file($f))
{
header('Content-Description: File Transfer');

View file

@ -1,4 +1,6 @@
<!doctype html>
<?php
header("Content-type: text/html; charset=UTF-8");
?><!doctype html>
<html>
<head>
<meta charset="UTF-8">

View file

@ -2,6 +2,14 @@
require_once("../common.php");
$srch_title = $srch_author = $srch_lang = "";
if (!empty($_GET["title"]))
$srch_title = $_GET["title"];
if (!empty($_GET["author"]))
$srch_author = $_GET["author"];
if (!empty($_GET["lang"]))
$srch_lang = $_GET["lang"];
if ($dh = opendir(DESTINATION))
{
$list = array();
@ -26,16 +34,23 @@ if ($dh = opendir(DESTINATION))
continue;
}
if ($i > 10)
if ($i > 23)
{
print '<li><a href="./?s='.(intval($_GET["s"])+10).'#list">Plus anciens ...</a></li>';
$GT = $GA = $GL = "";
if (!empty($srch_title)) $GR = "&amp;title=".$srch;
if (!empty($srch_author)) $GR = "&amp;author=".$srch;
if (!empty($srch_lang)) $GR = "&amp;lang=".$srch;
print '<li><a href="./?s='.(intval($_GET["s"])+23).$GR.'#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 ($paste->is_private ())
if ($paste->is_private ()
|| !preg_match("#".$srch_title."#i", $paste->title)
|| !preg_match("#".$srch_author."#i", $paste->author)
|| !preg_match("#".$srch_lang."#i", $paste->language))
continue;
if (empty($paste->title))

View file

@ -58,7 +58,8 @@ foreach ($_GET as $k => $t)
$paste->crypt($t);
}
header("Content-Type: text/html; charset=UTF-8");
header("Content-Type: text/plain; charset=UTF-8");
header("Content-Disposition: inline; filename=\"".addslashes($paste->title)."\"");
echo ($paste->content);
}
}