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/index.php

120 lines
3.2 KiB
PHP
Raw Normal View History

2012-01-18 23:23:08 +00:00
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>.: Pommultimédia - Paste :.</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
</head>
<body>
2012-01-20 14:58:47 +00:00
<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>
2012-01-18 23:23:08 +00:00
<?php
require_once("../common.php");
foreach ($_GET as $k => $t)
{
2012-01-20 16:16:57 +00:00
if (preg_match("#^([a-zA-Z0-9]{".RGXP_NB."})(:([a-zA-Z0-9]{".RGXP_NB."}))?$#", $k, $kout)
&& is_file(Paste::get_path($kout[1])))
2012-01-18 23:23:08 +00:00
{
require_once("../geshi/geshi.php");
2012-01-20 16:16:57 +00:00
$paste = new Paste($kout[1]);
2012-01-18 23:23:08 +00:00
2012-01-20 16:16:57 +00:00
$geshi = new GeSHi($paste->content, $paste->language);
2012-01-18 23:23:08 +00:00
2012-01-18 23:23:36 +00:00
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
2012-01-18 23:23:08 +00:00
?>
<div id="corps" style="text-align: center;">
2012-01-18 23:23:36 +00:00
<h1>
2012-01-20 16:16:57 +00:00
<?php echo htmlentities($paste->title); ?>
2012-01-18 23:23:36 +00:00
</h1>
2012-01-20 16:16:57 +00:00
<h2><?php echo $paste->get_subtitle(); ?></h2>
2012-01-18 23:23:08 +00:00
<div id="content">
2012-01-18 23:23:36 +00:00
<div class="answer">
2012-01-20 16:16:57 +00:00
<a href="/?a=<?php echo $kout[1]; ?>">Répondre</a>
<?php echo $paste->get_ref(); ?>
2012-01-18 23:23:36 +00:00
</div>
2012-01-18 23:23:08 +00:00
<?php
echo $geshi->parse_code();
2012-01-18 23:23:36 +00:00
?>
2012-01-18 23:23:08 +00:00
</div>
</div>
</body>
</html>
2012-01-18 23:23:36 +00:00
<?php
2012-01-18 23:23:08 +00:00
$view = true;
}
}
2012-01-20 16:16:57 +00:00
//Don't show the creation part when we show paste
2012-01-18 23:23:08 +00:00
if (!empty($view))
exit;
2012-01-20 16:16:57 +00:00
//Load answer paste
if (!empty($_GET["a"]) && preg_match("#^[a-zA-Z0-9]{".RGXP_NB."}$#", $_GET["a"])
&& is_file(Paste::get_path($k = $_GET["a"])))
$paste = new Paste($k);
else
$paste = new Paste();
2012-01-18 23:23:08 +00:00
?>
<header>
<h1><span>Pommultimédia</span></h1>
<h2><span>Service de partage de code</span></h2>
</header>
<div id="corps">
<form method="post" action="save.php">
<fieldset class="paste_form">
<label for="title">Titre :</label>
2012-01-20 16:16:57 +00:00
<input type="text" size="50" id="title" name="title" value="<?php
echo $paste->title;
?>">
2012-01-18 23:23:36 +00:00
<br><br>
2012-01-18 23:23:08 +00:00
<label for="content">Contenu :</label><br>
2012-01-18 23:23:36 +00:00
<textarea id="content" name="content"><?php
2012-01-20 16:16:57 +00:00
echo htmlentities(utf8_decode($paste->content));
2012-01-18 23:23:36 +00:00
?></textarea><br><br>
2012-01-18 23:23:08 +00:00
<label for="author">Auteur :</label>
<input type="text" maxlength="64" size="35" id="author" name="author">
<label for="lang">Langage :</label>
<select id="lang" name="lang">
2012-01-18 23:23:36 +00:00
<option value=""> Text</option>
2012-01-18 23:23:08 +00:00
<?php
if ($dh = opendir(GESHI_DIR))
{
$lg = array();
while (($file = readdir($dh)) !== false)
{
if (is_file(GESHI_DIR.$file))
$lg[] = substr($file, 0, -4);
}
closedir($dh);
sort($lg);
foreach ($lg as $l)
2012-01-18 23:23:36 +00:00
{
2012-01-20 16:16:57 +00:00
if (!empty($paste->language) && $paste->language == $l)
2012-01-18 23:23:36 +00:00
echo "<option selected=\"selected\"> ".ucfirst($l)."</option>\n";
else
echo "<option> ".ucfirst($l)."</option>\n";
}
2012-01-18 23:23:08 +00:00
}
?>
</select>
2012-01-18 23:23:36 +00:00
<?php
2012-01-20 16:16:57 +00:00
if (!empty($paste->fileref))
echo '<input type="hidden" name="ref" value="'.$paste->fileref.'">';
2012-01-18 23:23:36 +00:00
?>
2012-01-18 23:23:08 +00:00
<input type="submit" value="Envoyer">
</fieldset>
</form>
</div>
</body>
</html>