1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
<?php
/*ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);*/
if($_SERVER['REQUEST_URI'] === "/blog/posts/post.php") {
header("Location: /blog/");
die();
}
$cwd = preg_replace('/^.*\//', '', getcwd());
$feed = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."/blog/blog.atom");
$pdate = "";
$udate = "";
$title = "";
$descr = "";
$prevtitle = "";
$prevlink = "";
$nexttitle = "";
$nextlink = "";
foreach($feed->entry as $entry) {
if($entry->id == $cwd) {
$pdate = preg_replace('/T.*$/', ' ', $entry->published);
$udate = preg_replace('/T.*$/', ' ', $entry->updated);
$title = $entry->title;
$descr = htmlspecialchars($entry->summary);
} else if($title) {
$nextlink = $entry->link["href"];
$nexttitle = $entry->title;
break;
} else {
$prevlink = $entry->link["href"];
$prevtitle = $entry->title;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/guestbook/comments.css" rel="stylesheet" type="text/css" media="all">
<?php
echo("<title>$title</title><meta name='description' content='$descr'>");
$bgfile = glob('bg.*')[0];
if(!is_null($bgfile)) {
echo("<style> body > h1:first-of-type { background-image: url('$bgfile') } </style>");
}
?>
<style>
form {
display: flex;
flex-direction: column;
gap: calc(var(--stdpadding) / 2);
}
#commentform-top, #commentform-bottom {
display: flex;
gap: calc(var(--stdpadding) / 2);
align-items: center;
}
#commentform-bottom {
justify-content: right;
}
input[type="submit"] {
width: fit-content;
}
.error, .success {
flex-grow: 1;
}
@media only screen and (hover: none) {
#commentform-top {
flex-direction: column;
}
}
td {
display: table-cell !important;
}
</style>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
</head>
<body>
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/nav.php');
include($_SERVER['DOCUMENT_ROOT'] . '/common.php');
$udates = "";
if($pdate != $udate) { $udates = " | Updated on $udate"; }
echo("<h1>isoblog</h1><h2 id='caption'>$title</h2><p style='text-align: center;'><em>Posted on $pdate$udates</em></p>");
//echo("<p style='text-align: right;'>I'm testing in prod right now. don't worry about it");
include("../../../Parsedown.php");
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents("index.md"));
$Parsedown->setSafeMode(true);
$return = $_GET["return"];
?>
<hr>
<nav style="flex-direction: column;">
<?php
if($prevlink) {
echo("<a style='width: 100%; box-sizing: border-box;' href='$prevlink'><svg style='max-height: 1em;' xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 4 28 16' stroke-width='1.5' stroke='currentColor' class='size-6'><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 18.75 7.5-7.5 7.5 7.5' /><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 12.75 7.5-7.5 7.5 7.5' /></svg>$prevtitle</a>");
}
if($nextlink) {
echo("<a style='width: 100%; box-sizing: border-box;' href='$nextlink'><svg style='max-height: 1em;' xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 4 28 16' stroke-width='1.5' stroke='currentColor' class='size-6'><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 5.25 7.5 7.5 7.5-7.5m-15 6 7.5 7.5 7.5-7.5' /></svg>$nexttitle</a>");
}
?>
</nav>
<hr>
<h2>Comments</h2>
<form action="/guestbook/submit.php" method="post" autocomplete="off">
<?php echo "<input type='text' name='entry' value='".preg_replace("/^.*\//","",getcwd())."' style='display: none;' readonly>"; ?>
<textarea name="msg" placeholder="I know what you are." style="opacity: 0; position: absolute; left: -10000rem; height: 0; width: 0; overflow: clip;"></textarea>
<div id="commentform-top">
<input type="text" name="name" placeholder="Name">
<input type="text" name="website" placeholder="Website (optional)">
<input type="text" name="botcheck" placeholder="Bot test (type "isopod")">
</div>
<textarea name="message" placeholder="Comment (Now supports Markdown!)"></textarea>
<div id="commentform-bottom">
<?php
if($return) {
echo($gbform_messages[$return]);
}
?>
<input type="submit" value="Submit">
</div>
</form>
<?php include('../../../guestbook/comments.php'); echo_comments(preg_replace("/^.*\//","",getcwd()), $Parsedown); ?>
</body>
</html>
|