forked from lholliger/ATC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathposts.php
More file actions
82 lines (68 loc) · 1.97 KB
/
posts.php
File metadata and controls
82 lines (68 loc) · 1.97 KB
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
<?php
require("header.php");
$path = "../data/posts";
$files = glob("$path/*");
usort($files, function($a, $b) {
return filemtime($a) < filemtime($b);
});
?>
<center>
<?php
foreach ($files as $post) {
?>
<br><br>
<div class='post'>
<a class='hide' href='<?php echo(substr($post, strrpos($post, '/') + 1)) ?>'>
<div class='pi'>
<?php
$path = $post;
$files = glob("$path/_*");
$rep = count($files);
?>
<?php echo(file_get_contents("$post/0/poster")); ?> <span style='float: center;'><b><?php echo(file_get_contents("$post/0/title")); ?></b></span><span style='float: right;'><?php echo($rep); ?> replies</span>
<?php
$path = $post;
$type = file_get_contents("$path/0/type");
if ($type == "encryption") {
echo("</h1> <span class='t-crypt'>ENCRYPTION</span>");
}
if ($type == "ctf") {
echo("</h1> <span class='t-ctf'>CTF</span> ");
}
if ($type == "cg") {
echo("</h1> <span class='t-cg'>CODE GOLF</span> ");
}
if ($type == "code") {
echo("</h1> <span class='t-code'>CODE</span> ");
}
if ($type == "etc") {
echo("</h1> <span class='t-etc'>OTHER</span> ");
}
$status = file_get_contents("$post/0/status");
if ($status == "open") {
echo(" <span class='open'>OPEN</span>");
}
if ($status == "solved") {
echo(" <span class='solved'>SOLVED</span>");
}
if ($status == "issue") {
echo(" <span class='ISSUE'>ISSUE</span>");
}
?>
</div>
<div class='pc'>
<?php echo(file_get_contents("$post/0/contents")); ?>
</div>
</div>
<?php
}
?>
<script>
var converter = new showdown.Converter(),
var elements = document.body.getElementsByClassName("pc");
window.onload = function() {
for (i = 0; i < elements.length; i++) {
elements[i].innerHTML = converter.makeHtml(elements[i].innerHTML);
}
}
</script>