Working paste manager
BIN
htdocs/favicon.ico
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
htdocs/img/background.jpg
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
htdocs/img/button.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
htdocs/img/logo.png
Normal file
|
After Width: | Height: | Size: 181 KiB |
BIN
htdocs/img/partage.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
htdocs/img/telechargement.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
htdocs/img/upload.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
94
htdocs/index.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<!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>
|
||||
<?php
|
||||
require_once("../common.php");
|
||||
|
||||
foreach ($_GET as $k => $t)
|
||||
{
|
||||
if (preg_match("#^[a-zA-Z0-9]{5}$#", $k) && is_file(DESTINATION . "/" . $k . ".xml"))
|
||||
{
|
||||
require_once("../geshi/geshi.php");
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc->load(DESTINATION . "/" . $k . ".xml");
|
||||
|
||||
$lang = $doc->getElementsByTagName("language")->item(0)->textContent;
|
||||
if (empty($lang) || !is_file(GESHI_DIR.$lang.".php"))
|
||||
$lang = "whitespace";
|
||||
|
||||
$geshi = new GeSHi(
|
||||
$doc->getElementsByTagName("content")->item(0)->textContent,
|
||||
$lang);
|
||||
|
||||
?>
|
||||
<div id="corps" style="text-align: center;">
|
||||
<h1><?php echo $doc->getElementsByTagName("title")->item(0)->textContent ?></h1>
|
||||
<h2>Posté par <?php $a = $doc->getElementsByTagName("author")->item(0)->textContent; if (empty($a)) echo "<em>un anonyme</em>"; else echo $a; ?>, le <?php echo strftime("%A %e %B %G à %H:%M:%S", $doc->getElementsByTagName("date")->item(0)->textContent); ?></h2>
|
||||
<div id="content">
|
||||
<?php
|
||||
echo $geshi->parse_code();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$view = true;
|
||||
}
|
||||
}
|
||||
if (!empty($view))
|
||||
exit;
|
||||
?>
|
||||
<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>
|
||||
<input type="text" maxlength="200" size="50" id="title" name="title"><br><br>
|
||||
|
||||
<label for="content">Contenu :</label><br>
|
||||
<textarea id="content" name="content"></textarea><br><br>
|
||||
|
||||
<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">
|
||||
<option value=""> Fundamental</option>
|
||||
<?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)
|
||||
echo "<option> ".$l."</option>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
|
||||
<input type="submit" value="Envoyer">
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
29
htdocs/save.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
require_once("../common.php");
|
||||
|
||||
if (!empty($_POST["content"]))
|
||||
{
|
||||
$xml = new DOMDocument('1.0', 'UTF-8');
|
||||
$xml->formatOutput = true;
|
||||
|
||||
$xml_paste = $xml->createElement("paste");
|
||||
|
||||
$xml_paste->appendChild($xml->createElement("title", $_POST["title"]));
|
||||
$xml_paste->appendChild($xml->createElement("author", $_POST["author"]));
|
||||
$xml_paste->appendChild($xml->createElement("language", $_POST["lang"]));
|
||||
$xml_paste->appendChild($xml->createElement("date", time()));
|
||||
$xml_paste->appendChild($xml->createElement("ip", $_SERVER["REMOTE_ADDR"]));
|
||||
$xml_paste->appendChild($xml->createElement("content", $_POST["content"]));
|
||||
|
||||
$xml->appendChild($xml_paste);
|
||||
|
||||
$filename = substr(str_replace("+", "", str_replace("/", "", base64_encode(md5($xml->saveXML(), true)), 0, 5)));
|
||||
|
||||
$xml->save(DESTINATION . "/" . $filename . ".xml");
|
||||
|
||||
header("Location: /?".$filename);
|
||||
exit;
|
||||
}
|
||||
|
||||
header("Location: /");
|
||||
?>
|
||||
104
htdocs/style.css
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
body
|
||||
{
|
||||
background: url('img/background.jpg');
|
||||
}
|
||||
|
||||
header
|
||||
{
|
||||
margin: auto;
|
||||
width: 999px;
|
||||
}
|
||||
header span
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
header h1
|
||||
{
|
||||
background: url('img/logo.png');
|
||||
height: 312px;
|
||||
width: 100%;
|
||||
}
|
||||
header h2
|
||||
{
|
||||
background: url('img/partage.png');
|
||||
float: right;
|
||||
height: 92px;
|
||||
margin: -93px 125px 0 0;
|
||||
width: 171px;
|
||||
}
|
||||
|
||||
p,ul
|
||||
{
|
||||
margin: auto;
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
label {
|
||||
color: #e9802c;
|
||||
font-weight: bold;
|
||||
margin-right: 5px;
|
||||
}
|
||||
label:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
input[type=text], input[type=password], select, textarea {
|
||||
transition: background 0.75s;
|
||||
-moz-transition: background 0.75s;
|
||||
-webkit-transition: background 0.75s;
|
||||
-o-transition: background 0.75s;
|
||||
}
|
||||
input, select, textarea {
|
||||
background: #558dd4;
|
||||
border: #2f588b solid 1px;
|
||||
border-radius: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
input:hover, input:focus, select:hover, select:focus, textarea:hover, textarea:focus {
|
||||
background: #95cdff;
|
||||
}
|
||||
input.erreur, select.erreur {
|
||||
background: #df0009;
|
||||
border: #f7000b solid 1px;
|
||||
}
|
||||
input.erreur:hover, select.erreur:hover {
|
||||
background: #ff2029;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #75903b;
|
||||
}
|
||||
h2 {
|
||||
color: #7f9a48;
|
||||
}
|
||||
h3 {
|
||||
color: #89a355;
|
||||
}
|
||||
h4, h5, h6 {
|
||||
color: #95ae64;
|
||||
}
|
||||
|
||||
form {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
fieldset, div#content {
|
||||
background: #e3e3e3;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 0px 11px #555;
|
||||
min-height: 50px;
|
||||
margin: auto;
|
||||
width: 750px;
|
||||
}
|
||||
|
||||
div#content {
|
||||
padding: 5px;
|
||||
text-align: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
textarea#content {
|
||||
height: 200px;
|
||||
width: 90%;
|
||||
}
|
||||