-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
175 lines (158 loc) · 4.4 KB
/
post.php
File metadata and controls
175 lines (158 loc) · 4.4 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
require_once 'util.php';
require_once 'gp-api.php';
$postid = array_safe_get('postid', $_GET, '');
if(empty($postid) || !logged_in()) {
rickroll('/');
return;
}
$threadID = array_safe_get('tid', $_REQUEST, 0);
if($threadID > 0) {
$threadToggleValue = 'Hide Thread';
$threadDisplay = 'block';
}
else {
$threadToggleValue = 'Show Thread';
$threadDisplay = 'none';
}
$api = new GpAPI();
$post = $api->PostGet($postid);
#echo var_export($post, TRUE).'<BR>';
#$threadId = $post[
$api->PostMarkAs(1, 0, $postid);
#$postsParams = array('ThreadID' => $post['ThreadID']);
$threadPosts = $api->Posts($post['ThreadID']);
$parent_id = $post['ParentID'];
if($parent_id != $postid) {
$parent = $api->PostGet($parent_id);
}
else {
$parent = null;
}
$subject = $post['Subject'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Greenpride Mobile</title>
<?php echo head_links(); ?>
</head>
<body>
<div class="panel" selected="true">
<?php
$nextUnreadPostId = $api->PostNextUnreadID($post['ThreadID']);
$menuSettings = array(
'nextUnreadPostId' => $nextUnreadPostId,
//'returnToBoard' => FALSE,
'search' => FALSE,
);
echo menu($menuSettings);
?>
<?php if(!empty($parent)) { ?>
<input id="parentToggle" type="button" value="Show Previous Message" onclick="javascript:toggleDiv('parent', 'parentToggle', 'Show Previous Message', 'Hide Previous Message')" />
<div id="parent" class="parent" style="display:none; border: 1px solid #999999;">
<table>
<tr>
<td colspan="2" class="parent">In response to:</td>
</tr>
<tr></tr>
<tr>
<td class="parentHeading">Author:</td>
<td class="parent"><?php echo $parent['AuthorName']; ?></td>
</tr>
<tr>
<td class="parentHeading">Subject:</td>
<td class="parent"><?php echo $parent['Subject']; ?></td>
</tr>
<tr>
<td class="parentHeading">Date:</td>
<td class="parent"><?php echo formatDate($parent['Date']); ?></td>
</tr>
<tr>
<td class="parent" colspan="2"><?php echo preg_replace('/\n/', '<BR>', $parent['Description']); ?></td>
</tr>
</table>
</div>
<?php } ?>
<div class="heading">
<table>
<tr>
<th>Author</th>
<td><?php echo $post['AuthorName']; ?>
</tr>
<tr>
<th>Subject</th>
<td><?php echo $post['Subject']; ?>
</tr>
<tr>
<th>Date</th>
<td><?php echo formatDate($post['Date']); ?>
</tr>
</table>
<div class="post">
<?php
echo pretty_pretty($post['Description']);
?>
</div>
<input id="responseToggle" type="button" value="Respond to Post" onclick="javascript:toggleDiv('response', 'responseToggle', 'Respond to Post', 'Hide Respond to Post')" />
<div id="response" style="display:none; margin-left: 0; padding-left: 0; border: 1px solid #999999;">
<form id="postsubmit" class="panel" action="/postsubmit.php" method="POST" >
<table class="heading">
<?php
if(!empty($_GET['e'])) {
?>
<tr>
<td align="center" colspan="2"><font color="red"><?php echo $_GET['e'] ?></font></td>
</tr>
<?php } ?>
<tr>
<th>Subject</th>
</tr>
<tr>
<td><input type="text" name="subject" value="<?php echo $subject; ?>" /></td>
</tr>
<tr>
<th>Response</th>
</tr>
<tr>
<td><textarea rows="5" name="response" style="width:100%"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
<input type="hidden" name="postid" value="<?php echo $postid; ?>" />
<input type="hidden" name="tid" value="<?php echo $post['ThreadID']; ?>" />
</form>
</div>
<input id="threadToggle" type="button" value="<?php echo $threadToggleValue; ?>" onclick="javascript:toggleDiv('thread', 'threadToggle', 'Show Thread', 'Hide Thread')" />
<div id="thread" style="display:<?php echo $threadDisplay; ?>; margin-left: 0; padding-left: 0; border: 1px solid #999999;">
<?php
$settings = array(
'currentPostId' => $postid,
'threadIDInQueryString' => TRUE,
);
echo display_posts($threadPosts, $settings);
?>
</div>
<?php
$menuSettings = array(
'nextUnreadPostId' => $nextUnreadPostId,
'returnToBoard' => TRUE,
);
if(!empty($_GET['q'])) {
$menuSettings['searchString'] = $_GET['q'];
$menuSettings['backToSearchResults'] = TRUE;
}
$menuSettings['showStats'] = TRUE;
echo menu($menuSettings);
?>
<!--
<form method="GET" action="/">
<input type="submit" value="Return to Board" />
</form>
-->
</div>
<?php echo footer(); ?>
</body>
</html>