Compare commits
3 Commits
c13a0e1b1a
...
c16b9120df
Author | SHA1 | Date | |
---|---|---|---|
c16b9120df | |||
4f9dd8fb74 | |||
b656b517f9 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@
|
|||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
num/db/
|
||||
|
|
BIN
avatar.png
Normal file → Executable file
BIN
avatar.png
Normal file → Executable file
Binary file not shown.
Before Width: | Height: | Size: 916 B After Width: | Height: | Size: 696 KiB |
8
cgi-bin/home.sh
Executable file
8
cgi-bin/home.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
echo "Content-type: text/plain"
|
||||
echo ""
|
||||
|
||||
echo "Anyone can edit this comment!?!
|
||||
https://tilde.team/~mwt/mustache.png" > "$HOME/.mwt"
|
||||
echo $HOME
|
||||
exit 0
|
16
cgi-bin/min.sh
Executable file
16
cgi-bin/min.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
|
||||
echo "Content-type: text/plain"
|
||||
echo "Access-Control-Allow-Origin: *"
|
||||
echo ""
|
||||
|
||||
if [ "$REQUEST_METHOD" = "POST" ]; then
|
||||
read -n "$CONTENT_LENGTH" QUERY_STRING_POST
|
||||
curl -F"shorten=https://hash.mwt.me/$QUERY_STRING_POST" https://ttm.sh
|
||||
else
|
||||
echo "use POST"
|
||||
fi
|
||||
|
||||
exit 0
|
13
cgi-bin/pandoc.sh
Executable file
13
cgi-bin/pandoc.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Content-type: application/pdf"
|
||||
echo ""
|
||||
|
||||
TARGET=${QUERY_STRING##*=}
|
||||
|
||||
#echo ${TARGET%/*}
|
||||
|
||||
curl -sL "https://mattwthomas.com/$TARGET" | pandoc /dev/stdin -f html -t pdf --pdf-engine=pdflatex -o /dev/stdout
|
||||
|
||||
exit 0
|
||||
|
8
cgi-bin/train.sh
Executable file
8
cgi-bin/train.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Content-type: text/html"
|
||||
echo "Access-Control-Allow-Origin: *"
|
||||
echo ""
|
||||
|
||||
train -p
|
||||
exit 0
|
5
composer.json
Normal file
5
composer.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"require": {
|
||||
"ueberdosis/pandoc": "^0.7.0"
|
||||
}
|
||||
}
|
210
composer.lock
generated
Normal file
210
composer.lock
generated
Normal file
|
@ -0,0 +1,210 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ef34f8748699036b203b1e53cd129ff0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.23.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
|
||||
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.23-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-07-28T13:41:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v5.3.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "38f26c7d6ed535217ea393e05634cb0b244a1967"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/38f26c7d6ed535217ea393e05634cb0b244a1967",
|
||||
"reference": "38f26c7d6ed535217ea393e05634cb0b244a1967",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Process\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2021-08-04T21:20:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ueberdosis/pandoc",
|
||||
"version": "0.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ueberdosis/pandoc.git",
|
||||
"reference": "e68815e3b67299b38dde09c58a2d5671d38b0104"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ueberdosis/pandoc/zipball/e68815e3b67299b38dde09c58a2d5671d38b0104",
|
||||
"reference": "e68815e3b67299b38dde09c58a2d5671d38b0104",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1|^8.0",
|
||||
"symfony/process": ">4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.0 || ^9.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Pandoc\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hans Pagel",
|
||||
"email": "hans.pagel@ueber.io",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Pandoc PHP Package",
|
||||
"homepage": "https://github.com/ueberdosis/pandoc",
|
||||
"keywords": [
|
||||
"pandoc",
|
||||
"ueberdosis"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/ueberdosis/",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-03-02T19:37:59+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
}
|
BIN
default-avatar.png
Normal file
BIN
default-avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 916 B |
5
echo.php
Normal file
5
echo.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
?>
|
||||
<?=var_dump($_POST)?>
|
220
index.php
220
index.php
|
@ -1,106 +1,142 @@
|
|||
<?php
|
||||
$user = posix_getpwuid(fileowner(__FILE__))["name"];
|
||||
$dotname = ".mwt";
|
||||
$users = array_map(function ($f) { return basename(dirname($f)); }, glob("/home/*/$dotname"));
|
||||
$name = "Matthew Wildrick Thomas";
|
||||
$images = array();
|
||||
<?php if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// get the comment from the POST
|
||||
$comment = $_POST["comment"];
|
||||
file_put_contents("/srv/php-fpm/.mwt", $comment);
|
||||
}
|
||||
|
||||
$me = posix_getpwuid(fileowner(__FILE__))["name"];
|
||||
$dotname = ".mwt";
|
||||
$users = array_map(function ($f) {
|
||||
return basename(dirname($f));
|
||||
}, glob("/home/*/$dotname"));
|
||||
$name = "Matthew Wildrick Thomas";
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="<?=$user?>'s page on tilde.team">
|
||||
<meta name="author" content="<?=$name?>">
|
||||
<meta name="theme-color" content="#00cc00">
|
||||
<title><?=$user?>'s page</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://tilde.team/css/hacker.css">
|
||||
<link rel="stylesheet" href="https://tilde.team/css/fork-awesome.min.css">
|
||||
<style>
|
||||
<?php
|
||||
function makeComment($user, $notepath, $image = null, $link = null)
|
||||
{
|
||||
$link = $link ?: "https://tilde.team/~$user/";
|
||||
if (filesize($notepath) > 0) {
|
||||
$notefile = file($notepath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$note = htmlspecialchars($notefile[0]);
|
||||
if (empty($image) && count($notefile) > 1 && $notefile[1] !== "") {
|
||||
$image = htmlspecialchars($notefile[1]);
|
||||
} elseif (empty($image) && file_exists("/home/$user/public_html/avatar.png")) {
|
||||
$image = "https://tilde.team/~$user/avatar.png";
|
||||
}
|
||||
} else {
|
||||
unset($note);
|
||||
}
|
||||
?>
|
||||
<div class="comment">
|
||||
<div class="avatar-container">
|
||||
<img class="avatar" src="<?= $image ?? "https://tilde.team/~mwt/default-avatar.png" ?>" alt="<?= $user ?>'s avatar">
|
||||
</div>
|
||||
<div class="comment-text">
|
||||
<a href="<?= $link ?>">
|
||||
<h4>~<?= $user ?></h4>
|
||||
</a>
|
||||
<p>
|
||||
<?= (isset($note) ? $note : "") ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="<?= $user ?>'s page on tilde.team">
|
||||
<meta name="author" content="<?= $name ?>">
|
||||
<meta name="theme-color" content="#00cc00">
|
||||
<title><?= $me ?>'s page</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://tilde.team/css/hacker.css">
|
||||
<link rel="stylesheet" href="https://tilde.team/css/fork-awesome.min.css">
|
||||
<style>
|
||||
.comment {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
gap: 1em;
|
||||
margin: 0.125em;
|
||||
}
|
||||
|
||||
.avatar-container {
|
||||
display: inline-block;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
max-width: 20vw;
|
||||
max-height: 20vw;
|
||||
flex: 0 0 20%;
|
||||
max-width: 128px;
|
||||
max-height: 128px;
|
||||
}
|
||||
.comment-text{
|
||||
display: inline-block;
|
||||
margin: 0 1em;
|
||||
width: auto;
|
||||
height: auto;
|
||||
|
||||
.comment-text {
|
||||
flex: 1 1 80%;
|
||||
}
|
||||
|
||||
.comment-text>a,
|
||||
.comment-text>a>h4 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<div class="pull-right">
|
||||
<p><a href="https://tilde.team/"><- back to tilde.team</a></p>
|
||||
</div>
|
||||
<h1><strong>~<?=$user?> is <?=$name?></strong></h1>
|
||||
</div>
|
||||
<p>Hi, you can find more about me on <a href="https://mattwthomas.com">my website</a> and also on:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/mwt"><i class="fa fa-fw fa-github"></i> github</a></li>
|
||||
<li><a href="https://mathstodon.xyz/@mwt"><i class="fa fa-fw fa-mastodon"></i> mastodon</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2>Comments</h2>
|
||||
<?php foreach ($users as $user) {
|
||||
$notepath = "/home/$user/$dotname";
|
||||
if (filesize($notepath) > 0) {
|
||||
$notefile = file($notepath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$note = htmlspecialchars($notefile[0]);
|
||||
if (count($notefile) > 1 && $notefile[1] !== "")
|
||||
$image = htmlspecialchars($notefile[1]);
|
||||
else {
|
||||
unset($image);
|
||||
}
|
||||
}
|
||||
else {
|
||||
unset($note);
|
||||
unset($image);
|
||||
}
|
||||
?>
|
||||
<div class="comment">
|
||||
<div class="avatar-container">
|
||||
<img class="avatar" src="<?=$image ?? "https://tilde.team/~$user/avatar.png"?>" alt="<?=$user?>'s avatar">
|
||||
</div>
|
||||
<div class="comment-text">
|
||||
<a href="<?="https://tilde.team/~$user/"?>">
|
||||
<h4>~<?=$user?></h4>
|
||||
</a>
|
||||
<p>
|
||||
<?=(isset($note) ? $note : "")?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<hr>
|
||||
<p>
|
||||
To comment, create a file at <code>~/.mwt</code> with your comment on the first line and a link to your avatar on the second line (if no avatar is specified, your <code>avatar.png</code> will be used).
|
||||
</p>
|
||||
<hr>
|
||||
<!-- tilde.team ring fragment-->
|
||||
<div id="newring">
|
||||
<center>
|
||||
[<a href="https://tilde.team/ring/?action=prev&me=mwt">previous</a>]
|
||||
[<a href="https://tilde.team/ring/?action=random&me=mwt">random</a>]
|
||||
[<a href="https://tilde.team/ring/?action=next&me=mwt">next</a>]
|
||||
<br>
|
||||
<a href="https://tilde.team/ring/">how to join this webring</a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<div class="pull-right">
|
||||
<p><a href="https://tilde.team/"><- back to tilde.team</a></p>
|
||||
</div>
|
||||
<h1><strong>~<?= $me ?> is <?= $name ?></strong></h1>
|
||||
</div>
|
||||
<p>Hi, you can find more about me on <a href="https://mattwthomas.com">my website</a> and also on:</p>
|
||||
<ul>
|
||||
<li><a href="https://github.com/mwt"><i class="fa fa-fw fa-github"></i> github</a></li>
|
||||
<li><a href="https://mathstodon.xyz/@mwt"><i class="fa fa-fw fa-mastodon"></i> mastodon</a></li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2>Comments</h2>
|
||||
<?php foreach ($users as $user) {
|
||||
$notepath = "/home/$user/$dotname";
|
||||
makeComment($user, $notepath);
|
||||
}
|
||||
?>
|
||||
<?= makeComment(
|
||||
"guest",
|
||||
"/srv/php-fpm/.mwt",
|
||||
"https://tilde.team/~mwt/mustache.png",
|
||||
"#"
|
||||
);
|
||||
?>
|
||||
<hr>
|
||||
<form action="./" method="post">
|
||||
<label for="comment">Guest Comment (ephemeral)</label>
|
||||
<input type="text" id="comment" name="comment">
|
||||
</form>
|
||||
<hr>
|
||||
<p>
|
||||
To comment, create a file at <code>~/.mwt</code> with your comment on the first line and a link to your avatar on the second line (if no avatar is specified, your <code>avatar.png</code> will be used).
|
||||
</p>
|
||||
<hr>
|
||||
<!-- tilde.team ring fragment-->
|
||||
<div id="newring">
|
||||
<center>
|
||||
[<a href="https://tilde.team/ring/?action=prev&me=mwt">previous</a>]
|
||||
[<a href="https://tilde.team/ring/?action=random&me=mwt">random</a>]
|
||||
[<a href="https://tilde.team/ring/?action=next&me=mwt">next</a>]
|
||||
<br>
|
||||
<a href="https://tilde.team/ring/">how to join this webring</a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
20
min.php
Normal file
20
min.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
header("Content-Type: text/plain");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$url = 'https://ttm.sh';
|
||||
$data = array('shorten' => "https://hash.mwt.me/{$_POST['shorten']}");
|
||||
|
||||
// use key 'http' even if you send the request to https://...
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
||||
'method' => 'POST',
|
||||
'content' => http_build_query($data)
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($url, false, $context);
|
||||
?>
|
||||
<?=$result?>
|
||||
<?php }?>
|
BIN
mustache.png
Normal file
BIN
mustache.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
47
num/index.php
Normal file
47
num/index.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
|
||||
// We put files in /db/W where W is the week number
|
||||
$date = explode("-", date("W-D"));
|
||||
$weeknum = $date[0];
|
||||
// Add a week if it's already Friday or later
|
||||
if (in_array($date[1], ["Fri", "Sat", "Sun"])) {
|
||||
$weeknum = $weeknum + 1;
|
||||
}
|
||||
$filepath = "/home/mwt/public_html/num/db/" . $weeknum;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
// get the numbers from the POST
|
||||
$input = json_decode("[" . $_POST["num"] . "]");
|
||||
|
||||
// if the array contains only integers, then proceed
|
||||
if (array_reduce($input, function ($result, $item) {
|
||||
return $result && is_int($item);
|
||||
}, true)) {
|
||||
// load the database if there is data to load
|
||||
if (file_exists($filepath)) {
|
||||
$output = json_decode(file_get_contents($filepath));
|
||||
array_push($output, ...$input);
|
||||
} else {
|
||||
$output = $input;
|
||||
}
|
||||
file_put_contents($filepath, json_encode($output));
|
||||
print "Success! Thank you for the integers: ";
|
||||
print json_encode($input);
|
||||
} else {
|
||||
print "Failure! Array must contain only integers.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
header("Content-Type: application/json");
|
||||
if (file_exists($filepath)) {
|
||||
$gethist = array_count_values(json_decode(file_get_contents($filepath)));
|
||||
arsort($gethist);
|
||||
print json_encode($gethist);
|
||||
} else {
|
||||
print "{}";
|
||||
}
|
||||
}
|
25
pandoc.php
Normal file
25
pandoc.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
header("Content-Type: text/plain");
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Cache-Control: no-cache private");
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Disposition:attachment;filename='downloaded.pdf'");
|
||||
header("Content-type:application/pdf");
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (array_key_exists('md', $_POST)) {
|
||||
$output = (new \Pandoc\Pandoc)
|
||||
->from('markdown')
|
||||
->input($_POST['md'])
|
||||
->to('pdf')
|
||||
->run();
|
||||
header('Content-Length: '. strlen($output));
|
||||
}
|
||||
|
||||
?>
|
||||
<?=$output?>
|
||||
<?="Hi"?>
|
||||
<?php }?>
|
59
your_index_template.php
Normal file
59
your_index_template.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!--
|
||||
hey,
|
||||
this is a template for your own index.php.
|
||||
you can edit this file and rename it to index.php.
|
||||
have fun!
|
||||
|
||||
cp ~/public_html/your_index_template.php ~/public_html/index.php
|
||||
|
||||
YOU CAN REMOVE THIS COMMENT!
|
||||
-->
|
||||
|
||||
<?php $user = posix_getpwuid(fileowner(__FILE__))["name"]; ?>
|
||||
<!-- HTML HEADER -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>~<?=$user?> on envs.net</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="author" content="<?=$user?>">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta name="description" content="~<?=$user?> on envs.net" />
|
||||
<meta name="keywords" content="<?=$user?>" />
|
||||
<link rel="stylesheet" href="https://envs.net/css/css_style.css" />
|
||||
<link rel="stylesheet" href="https://envs.net/css/fork-awesome.min.css" />
|
||||
</head>
|
||||
<!-- dark/light-mode -->
|
||||
<body id="body" class="dark-mode">
|
||||
<!-- min-width: needed if the sidebar is enable -->
|
||||
<div style="clear:both; /*min-width: 750px;*/">
|
||||
|
||||
<div id="main">
|
||||
<pre>
|
||||
<blockquote>
|
||||
<?=$user?>
|
||||
|
||||
</blockquote>
|
||||
hi and welcome to my new website.
|
||||
|
||||
IRC: <?=$user?> on tilde.chat
|
||||
Mail: <code><?=$user?>@envs.net</code>
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<!-- You can also enable a right sidebar
|
||||
|
||||
<div id="sidebar">
|
||||
<pre class="sidebar">
|
||||
|
||||
more text
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
-->
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user