102 lines
2.8 KiB
PHP
102 lines
2.8 KiB
PHP
<!DOCTYPE html>
|
|
<!--
|
|
groff-web is free software: you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
groff-web is distributed in the hope that it will be useful, but
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Foobar. If not, see <https://www.gnu.org/licenses/>.
|
|
-->
|
|
<html>
|
|
|
|
<head>
|
|
<title>Groff Web</title>
|
|
<style>
|
|
* {
|
|
background-color: #121212;
|
|
font-family: monospace;
|
|
margin: 0 0 10px;
|
|
color: #928374;
|
|
}
|
|
|
|
h1 {
|
|
margin: 10px 0 0;
|
|
color: #fe8019;
|
|
}
|
|
|
|
textarea {
|
|
background-color: #282828;
|
|
color: #83a598;
|
|
}
|
|
|
|
body {
|
|
text-align: center;
|
|
margin: 0 auto;
|
|
width: 100%;
|
|
}
|
|
|
|
.button {
|
|
padding: 5px 10px 5px;
|
|
margin: 10px;
|
|
}
|
|
|
|
.columns {
|
|
max-width: 1300px;
|
|
margin: 0 auto;
|
|
columns: 2;
|
|
width: 95%;
|
|
}
|
|
|
|
textarea#codebox {
|
|
height: 730px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<?php
|
|
exec("rm -rf tmp/*");
|
|
$uid = exec("head -n 10 /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1");
|
|
exec("mkdir -p tmp/$uid");
|
|
if($_POST['codebox']){
|
|
$file_open = fopen("tmp/$uid/document.ms","w+");
|
|
fwrite($file_open, $_POST['codebox']);
|
|
fclose($file_open);
|
|
}
|
|
exec("sh compiler.sh $uid");
|
|
?>
|
|
|
|
<body>
|
|
<h1>Groff Web</h1>
|
|
<p><?php echo exec("/usr/bin/groff -v | head -n 1") ?></p>
|
|
|
|
|
|
<div class=columns>
|
|
<div style="width: 100%"><form method="POST">
|
|
<div><input type=submit value=Compile class=button name=button></div>
|
|
<textarea id="codebox" name="codebox"><?php
|
|
$datalines = file ("tmp/$uid/document.ms");
|
|
foreach ($datalines as $zz) {
|
|
echo $zz; }
|
|
?></textarea>
|
|
</form></div>
|
|
|
|
<object width="100%" height="800" type="application/pdf" data="/tmp/<?php echo $uid ?>.pdf?#&navpanes=0">
|
|
<p>PDF cannot be displayed.</p>
|
|
</object>
|
|
</div>
|
|
|
|
<footer><p>
|
|
Copyright (C) 2023 Gustavo Calvo |
|
|
<a href="https://gitlab.com/tavo-wasd/groff-web" target="_blank" rel="noopener noreferrer">Source</a> |
|
|
<a href="https://www.gnu.org/licenses/gpl-3.0.txt" target="_blank" rel="noopener noreferrer">GPL-3.0</a>
|
|
</p></footer>
|
|
</body>
|
|
|
|
</html>
|