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

152 lines
4.3 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");
$view = 0;
2012-01-18 23:23:08 +00:00
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
{
2012-01-20 16:16:57 +00:00
$paste = new Paste($kout[1]);
2012-01-18 23:23:08 +00:00
2012-01-30 15:04:43 +00:00
if (!empty($paste->crypt) && empty($_POST["passwd"]))
{
?>
<div id="corps" style="text-align: center;">
<h1>
<?php echo htmlentities($paste->title); ?>
</h1>
<h2><?php echo $paste->get_subtitle(); ?></h2>
<div>
<form method="post" action="?<?php echo $kout[1]; ?>">
<fieldset class="paste_form">
<label for="title">Mot de passe :</label>
<input type="password" size="42" id="passwd" name="passwd">
<br><br>
<input type="submit" value="Voir le texte">
</fieldset>
</form>
<?php
}
else
{
if (!empty($paste->crypt))
$paste->crypt($_POST["passwd"]);
if (!empty($kout[3]) && is_file(Paste::get_path($kout[3])))
$diff = new Paste($kout[3]);
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(isset($diff)); ?>
<?php echo $paste->get_gen(isset($diff)); ?>
2012-01-18 23:23:36 +00:00
</div>
2012-01-18 23:23:08 +00:00
<?php
2012-01-30 15:04:43 +00:00
if (isset($diff))
echo $paste->get_diff($diff);
else
echo $paste->get_code();
echo $paste->show_answers();
}
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
$view++;
2012-01-18 23:23:08 +00:00
}
}
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-30 15:04:43 +00:00
<input type="text" size="42" id="title" name="title" value="<?php
2012-01-20 16:16:57 +00:00
echo $paste->title;
?>">
2012-01-30 15:04:43 +00:00
<label for="author">Auteur :</label>
<input type="text" maxlength="64" size="25" id="author" name="author">
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
2012-01-30 15:04:43 +00:00
<label for="crypt" style="font-style: italic;">Mot de passe :</label>
<input type="text" maxlength="64" size="25" id="crypt" name="crypt">
2012-01-18 23:23:08 +00:00
<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>
2012-01-20 17:41:56 +00:00
<?php
include("list.php");
?>
2012-01-18 23:23:08 +00:00
</div>
</body>
</html>