-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpost.php
More file actions
111 lines (81 loc) · 2.89 KB
/
post.php
File metadata and controls
111 lines (81 loc) · 2.89 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
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
<?php
$application = 'darkblog';
require_once 'conf/conf.php';
$application = 'darkblog';
require_once 'autoloader.php';
$autoloader = new libAutoloader();
require_once 'conf/db.php';
require_once 'conf/emercoin.conf.php';
require_once 'conf/other.php';
require_once 'darkblog/other/text.php';
$page = 'post';
\darkblog\other\url::parse();
\darkblog\db\pager::$order = 'name';
if(!empty($_GET['page'])) \darkblog\db\pager::$page = (int)$_GET['page'];
function parse_post(&$post) {
$p = new \darkblog\lib\Parsedown();
$post['content'] = $p->parse($post['content']);
//$post['content'] = nl2br($post['content']);
if(!empty($post['replies']))
foreach ($post['replies'] as $key => $subpost) {
$post['replies'][$key]['content'] = $p->parse($subpost['content']);
}
}
if(!empty($_GET['id'])) {
$oposts = new \darkblog\objects\posts();
if(isset($_GET['full'])) {
$post = $oposts->getPost((int)$_GET['id']);
var_dump($post);
if(!empty($post['id'])) {
$post['replies'] = $oposts->getRepliesFull($post['id']);
if(!empty($post['reply_id']))
$post['reply_to'] = $oposts->getPost($post['reply_id']);
}
parse_post($post);
require 'templates/header.php';
require 'templates/post_full.php';
}
else {
$post = $oposts->getPost((int)$_GET['id']);
if(!empty($post['id'])) {
$post['replies'] = $oposts->getReplies($post['id']);
if(!empty($post['reply_id']))
$post['reply_to'] = $oposts->getPost($post['reply_id']);
}
parse_post($post);
require 'templates/header.php';
require 'templates/post.php';
}
}
elseif(!empty($_GET['name'])) {
$oposts = new \darkblog\objects\posts();
if(isset($_GET['full'])) {
$post = $oposts->getPostByName($_GET['name']);
if(!empty($post['id'])) {
$post['replies'] = $oposts->getRepliesFull($post['id']);
if(!empty($post['reply_id']))
$post['reply_to'] = $oposts->getPost($post['reply_id']);
}
parse_post($post);
require 'templates/header.php';
require 'templates/post_full.php';
}
else {
$post = $oposts->getPostByName($_GET['name']);
if(!empty($post['id'])) {
$post['replies'] = $oposts->getReplies($post['id']);
if(!empty($post['reply_id']))
$post['reply_to'] = $oposts->getPost($post['reply_id']);
}
parse_post($post);
require 'templates/header.php';
require 'templates/post.php';
}
}
else {
require 'templates/header.php';
}
require 'templates/footer.php';
if((!empty($_GET['name']) || !empty($_GET['id'])) && isset($_GET['full'])) {
require 'templates/post_full_footer.php';
}