1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Copyright (C) 2008-2011 FluxBB |
---|
5 | * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB |
---|
6 | * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher |
---|
7 | */ |
---|
8 | |
---|
9 | define('PUN_ROOT', dirname(__FILE__).'/'); |
---|
10 | require PUN_ROOT.'include/common.php'; |
---|
11 | |
---|
12 | |
---|
13 | if ($pun_user['g_read_board'] == '0') |
---|
14 | message($lang_common['No view']); |
---|
15 | |
---|
16 | |
---|
17 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
---|
18 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
---|
19 | $pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0; |
---|
20 | if ($id < 1 && $pid < 1) |
---|
21 | message($lang_common['Bad request']); |
---|
22 | |
---|
23 | // Load the viewtopic.php language file |
---|
24 | require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php'; |
---|
25 | |
---|
26 | |
---|
27 | // If a post ID is specified we determine topic ID and page number so we can redirect to the correct message |
---|
28 | if ($pid) |
---|
29 | { |
---|
30 | $result = $db->query('SELECT topic_id, posted FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch topic ID', __FILE__, __LINE__, $db->error()); |
---|
31 | if (!$db->num_rows($result)) |
---|
32 | message($lang_common['Bad request']); |
---|
33 | |
---|
34 | list($id, $posted) = $db->fetch_row($result); |
---|
35 | |
---|
36 | // Determine on what page the post is located (depending on $forum_user['disp_posts']) |
---|
37 | $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted<'.$posted) or error('Unable to count previous posts', __FILE__, __LINE__, $db->error()); |
---|
38 | $num_posts = $db->result($result) + 1; |
---|
39 | |
---|
40 | $_GET['p'] = ceil($num_posts / $pun_user['disp_posts']); |
---|
41 | } |
---|
42 | |
---|
43 | // If action=new, we redirect to the first new post (if any) |
---|
44 | else if ($action == 'new') |
---|
45 | { |
---|
46 | if (!$pun_user['is_guest']) |
---|
47 | { |
---|
48 | // We need to check if this topic has been viewed recently by the user |
---|
49 | $tracked_topics = get_tracked_topics(); |
---|
50 | $last_viewed = isset($tracked_topics['topics'][$id]) ? $tracked_topics['topics'][$id] : $pun_user['last_visit']; |
---|
51 | |
---|
52 | $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$last_viewed) or error('Unable to fetch first new post info', __FILE__, __LINE__, $db->error()); |
---|
53 | $first_new_post_id = $db->result($result); |
---|
54 | |
---|
55 | if ($first_new_post_id) |
---|
56 | { |
---|
57 | header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id); |
---|
58 | exit; |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | // If there is no new post, we go to the last post |
---|
63 | header('Location: viewtopic.php?id='.$id.'&action=last'); |
---|
64 | exit; |
---|
65 | } |
---|
66 | |
---|
67 | // If action=last, we redirect to the last post |
---|
68 | else if ($action == 'last') |
---|
69 | { |
---|
70 | $result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch last post info', __FILE__, __LINE__, $db->error()); |
---|
71 | $last_post_id = $db->result($result); |
---|
72 | |
---|
73 | if ($last_post_id) |
---|
74 | { |
---|
75 | header('Location: viewtopic.php?pid='.$last_post_id.'#p'.$last_post_id); |
---|
76 | exit; |
---|
77 | } |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | // Fetch some info about the topic |
---|
82 | if (!$pun_user['is_guest']) |
---|
83 | $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
---|
84 | else |
---|
85 | $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); |
---|
86 | |
---|
87 | if (!$db->num_rows($result)) |
---|
88 | message($lang_common['Bad request']); |
---|
89 | |
---|
90 | $cur_topic = $db->fetch_assoc($result); |
---|
91 | |
---|
92 | // Sort out who the moderators are and if we are currently a moderator (or an admin) |
---|
93 | $mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array(); |
---|
94 | $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false; |
---|
95 | |
---|
96 | // Can we or can we not post replies? |
---|
97 | if ($cur_topic['closed'] == '0') |
---|
98 | { |
---|
99 | if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $is_admmod) |
---|
100 | $post_link = "\t\t\t".'<p class="postlink conr"><a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a></p>'."\n"; |
---|
101 | else |
---|
102 | $post_link = ''; |
---|
103 | } |
---|
104 | else |
---|
105 | { |
---|
106 | $post_link = $lang_topic['Topic closed']; |
---|
107 | |
---|
108 | if ($is_admmod) |
---|
109 | $post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>'; |
---|
110 | |
---|
111 | $post_link = "\t\t\t".'<p class="postlink conr">'.$post_link.'</p>'."\n"; |
---|
112 | } |
---|
113 | |
---|
114 | |
---|
115 | // Add/update this topic in our list of tracked topics |
---|
116 | if (!$pun_user['is_guest']) |
---|
117 | { |
---|
118 | $tracked_topics = get_tracked_topics(); |
---|
119 | $tracked_topics['topics'][$id] = time(); |
---|
120 | set_tracked_topics($tracked_topics); |
---|
121 | } |
---|
122 | |
---|
123 | |
---|
124 | // Determine the post offset (based on $_GET['p']) |
---|
125 | $num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']); |
---|
126 | |
---|
127 | $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']); |
---|
128 | $start_from = $pun_user['disp_posts'] * ($p - 1); |
---|
129 | |
---|
130 | // Generate paging links |
---|
131 | $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'viewtopic.php?id='.$id); |
---|
132 | |
---|
133 | |
---|
134 | if ($pun_config['o_censoring'] == '1') |
---|
135 | $cur_topic['subject'] = censor_words($cur_topic['subject']); |
---|
136 | |
---|
137 | |
---|
138 | $quickpost = false; |
---|
139 | if ($pun_config['o_quickpost'] == '1' && |
---|
140 | ($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) && |
---|
141 | ($cur_topic['closed'] == '0' || $is_admmod)) |
---|
142 | { |
---|
143 | // Load the post.php language file |
---|
144 | require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php'; |
---|
145 | |
---|
146 | $required_fields = array('req_message' => $lang_common['Message']); |
---|
147 | if ($pun_user['is_guest']) |
---|
148 | { |
---|
149 | $required_fields['req_username'] = $lang_post['Guest name']; |
---|
150 | if ($pun_config['p_force_guest_email'] == '1') |
---|
151 | $required_fields['req_email'] = $lang_common['Email']; |
---|
152 | } |
---|
153 | $quickpost = true; |
---|
154 | } |
---|
155 | |
---|
156 | if (!$pun_user['is_guest'] && $pun_config['o_topic_subscriptions'] == '1') |
---|
157 | { |
---|
158 | if ($cur_topic['is_subscribed']) |
---|
159 | // I apologize for the variable naming here. It's a mix of subscription and action I guess :-) |
---|
160 | $subscraction = "\t\t".'<p class="subscribelink clearb"><span>'.$lang_topic['Is subscribed'].' - </span><a href="misc.php?action=unsubscribe&tid='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n"; |
---|
161 | else |
---|
162 | $subscraction = "\t\t".'<p class="subscribelink clearb"><a href="misc.php?action=subscribe&tid='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n"; |
---|
163 | } |
---|
164 | else |
---|
165 | $subscraction = ''; |
---|
166 | |
---|
167 | if ($pun_config['o_feed_type'] == '1') |
---|
168 | $page_head = array('feed' => '<link rel="alternate" type="application/rss+xml" href="extern.php?action=feed&tid='.$id.'&type=rss" title="'.$lang_common['RSS topic feed'].'" />'); |
---|
169 | else if ($pun_config['o_feed_type'] == '2') |
---|
170 | $page_head = array('feed' => '<link rel="alternate" type="application/atom+xml" href="extern.php?action=feed&tid='.$id.'&type=atom" title="'.$lang_common['Atom topic feed'].'" />'); |
---|
171 | |
---|
172 | $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), pun_htmlspecialchars($cur_topic['forum_name']), pun_htmlspecialchars($cur_topic['subject'])); |
---|
173 | define('PUN_ALLOW_INDEX', 1); |
---|
174 | define('PUN_ACTIVE_PAGE', 'index'); |
---|
175 | require PUN_ROOT.'header.php'; |
---|
176 | |
---|
177 | ?> |
---|
178 | <div class="linkst"> |
---|
179 | <div class="inbox crumbsplus"> |
---|
180 | <ul class="crumbs"> |
---|
181 | <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li> |
---|
182 | <li><span>» </span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li> |
---|
183 | <li><span>» </span><a href="viewtopic.php?id=<?php echo $id ?>"><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></a></li> |
---|
184 | </ul> |
---|
185 | <div class="pagepost"> |
---|
186 | <p class="pagelink conl"><?php echo $paging_links ?></p> |
---|
187 | <?php echo $post_link ?> |
---|
188 | </div> |
---|
189 | <div class="clearer"></div> |
---|
190 | </div> |
---|
191 | </div> |
---|
192 | |
---|
193 | <?php |
---|
194 | |
---|
195 | |
---|
196 | require PUN_ROOT.'include/parser.php'; |
---|
197 | |
---|
198 | $post_count = 0; // Keep track of post numbers |
---|
199 | |
---|
200 | // Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data |
---|
201 | $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT '.$start_from.','.$pun_user['disp_posts']) or error('Unable to fetch post IDs', __FILE__, __LINE__, $db->error()); |
---|
202 | |
---|
203 | $post_ids = array(); |
---|
204 | for ($i = 0;$cur_post_id = $db->result($result, $i);$i++) |
---|
205 | $post_ids[] = $cur_post_id; |
---|
206 | |
---|
207 | if (empty($post_ids)) |
---|
208 | error('The post table and topic table seem to be out of sync!', __FILE__, __LINE__); |
---|
209 | |
---|
210 | // Retrieve the posts (and their respective poster/online status) |
---|
211 | $result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); |
---|
212 | while ($cur_post = $db->fetch_assoc($result)) |
---|
213 | { |
---|
214 | $post_count++; |
---|
215 | $user_avatar = ''; |
---|
216 | $user_info = array(); |
---|
217 | $user_contacts = array(); |
---|
218 | $post_actions = array(); |
---|
219 | $is_online = ''; |
---|
220 | $signature = ''; |
---|
221 | |
---|
222 | // If the poster is a registered user |
---|
223 | if ($cur_post['poster_id'] > 1) |
---|
224 | { |
---|
225 | if ($pun_user['g_view_users'] == '1') |
---|
226 | $username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>'; |
---|
227 | else |
---|
228 | $username = pun_htmlspecialchars($cur_post['username']); |
---|
229 | |
---|
230 | $user_title = get_title($cur_post); |
---|
231 | |
---|
232 | if ($pun_config['o_censoring'] == '1') |
---|
233 | $user_title = censor_words($user_title); |
---|
234 | |
---|
235 | // Format the online indicator |
---|
236 | $is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : '<span>'.$lang_topic['Offline'].'</span>'; |
---|
237 | |
---|
238 | if ($pun_config['o_avatars'] == '1' && $pun_user['show_avatars'] != '0') |
---|
239 | { |
---|
240 | if (isset($user_avatar_cache[$cur_post['poster_id']])) |
---|
241 | $user_avatar = $user_avatar_cache[$cur_post['poster_id']]; |
---|
242 | else |
---|
243 | $user_avatar = $user_avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['poster_id']); |
---|
244 | } |
---|
245 | |
---|
246 | // We only show location, register date, post count and the contact links if "Show user info" is enabled |
---|
247 | if ($pun_config['o_show_user_info'] == '1') |
---|
248 | { |
---|
249 | if ($cur_post['location'] != '') |
---|
250 | { |
---|
251 | if ($pun_config['o_censoring'] == '1') |
---|
252 | $cur_post['location'] = censor_words($cur_post['location']); |
---|
253 | |
---|
254 | $user_info[] = '<dd><span>'.$lang_topic['From'].' '.pun_htmlspecialchars($cur_post['location']).'</span></dd>'; |
---|
255 | } |
---|
256 | |
---|
257 | $user_info[] = '<dd><span>'.$lang_topic['Registered'].' '.format_time($cur_post['registered'], true).'</span></dd>'; |
---|
258 | |
---|
259 | if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod']) |
---|
260 | $user_info[] = '<dd><span>'.$lang_topic['Posts'].' '.forum_number_format($cur_post['num_posts']).'</span></dd>'; |
---|
261 | |
---|
262 | // Now let's deal with the contact links (Email and URL) |
---|
263 | if ((($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['is_admmod']) && $pun_user['g_send_email'] == '1') |
---|
264 | $user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['email'].'">'.$lang_common['Email'].'</a></span>'; |
---|
265 | else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') |
---|
266 | $user_contacts[] = '<span class="email"><a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['Email'].'</a></span>'; |
---|
267 | |
---|
268 | if ($cur_post['url'] != '') |
---|
269 | { |
---|
270 | if ($pun_config['o_censoring'] == '1') |
---|
271 | $cur_post['url'] = censor_words($cur_post['url']); |
---|
272 | |
---|
273 | $user_contacts[] = '<span class="website"><a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a></span>'; |
---|
274 | } |
---|
275 | } |
---|
276 | |
---|
277 | if ($pun_user['is_admmod']) |
---|
278 | { |
---|
279 | $user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>'; |
---|
280 | |
---|
281 | if ($cur_post['admin_note'] != '') |
---|
282 | $user_info[] = '<dd><span>'.$lang_topic['Note'].' <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong></span></dd>'; |
---|
283 | } |
---|
284 | } |
---|
285 | // If the poster is a guest (or a user that has been deleted) |
---|
286 | else |
---|
287 | { |
---|
288 | $username = pun_htmlspecialchars($cur_post['username']); |
---|
289 | $user_title = get_title($cur_post); |
---|
290 | |
---|
291 | if ($pun_user['is_admmod']) |
---|
292 | $user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>'; |
---|
293 | |
---|
294 | if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1') |
---|
295 | $user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['Email'].'</a></span>'; |
---|
296 | } |
---|
297 | |
---|
298 | // Generation post action array (quote, edit, delete etc.) |
---|
299 | if (!$is_admmod) |
---|
300 | { |
---|
301 | if (!$pun_user['is_guest']) |
---|
302 | $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>'; |
---|
303 | |
---|
304 | if ($cur_topic['closed'] == '0') |
---|
305 | { |
---|
306 | if ($cur_post['poster_id'] == $pun_user['id']) |
---|
307 | { |
---|
308 | if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1')) |
---|
309 | $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>'; |
---|
310 | if ($pun_user['g_edit_posts'] == '1') |
---|
311 | $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>'; |
---|
312 | } |
---|
313 | |
---|
314 | if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1') |
---|
315 | $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>'; |
---|
316 | } |
---|
317 | } |
---|
318 | else |
---|
319 | { |
---|
320 | $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>'; |
---|
321 | $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>'; |
---|
322 | $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>'; |
---|
323 | $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>'; |
---|
324 | } |
---|
325 | |
---|
326 | // Perform the main parsing of the message (BBCode, smilies, censor words etc) |
---|
327 | $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); |
---|
328 | |
---|
329 | // Do signature parsing/caching |
---|
330 | if ($pun_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $pun_user['show_sig'] != '0') |
---|
331 | { |
---|
332 | if (isset($signature_cache[$cur_post['poster_id']])) |
---|
333 | $signature = $signature_cache[$cur_post['poster_id']]; |
---|
334 | else |
---|
335 | { |
---|
336 | $signature = parse_signature($cur_post['signature']); |
---|
337 | $signature_cache[$cur_post['poster_id']] = $signature; |
---|
338 | } |
---|
339 | } |
---|
340 | |
---|
341 | ?> |
---|
342 | <div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?><?php if ($cur_post['id'] == $cur_topic['first_post_id']) echo ' firstpost'; ?><?php if ($post_count == 1) echo ' blockpost1'; ?>"> |
---|
343 | <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2> |
---|
344 | <div class="box"> |
---|
345 | <div class="inbox"> |
---|
346 | <div class="postbody"> |
---|
347 | <div class="postleft"> |
---|
348 | <dl> |
---|
349 | <dt><strong><?php echo $username ?></strong></dt> |
---|
350 | <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd> |
---|
351 | <?php if ($user_avatar != '') echo "\t\t\t\t\t\t".'<dd class="postavatar">'.$user_avatar.'</dd>'."\n"; ?> |
---|
352 | <?php if (count($user_info)) echo "\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $user_info)."\n"; ?> |
---|
353 | <?php if (count($user_contacts)) echo "\t\t\t\t\t\t".'<dd class="usercontacts">'.implode(' ', $user_contacts).'</dd>'."\n"; ?> |
---|
354 | </dl> |
---|
355 | </div> |
---|
356 | <div class="postright"> |
---|
357 | <h3><?php if ($cur_post['id'] != $cur_topic['first_post_id']) echo $lang_topic['Re'].' '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3> |
---|
358 | <div class="postmsg"> |
---|
359 | <?php echo $cur_post['message']."\n" ?> |
---|
360 | <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?> |
---|
361 | </div> |
---|
362 | <?php if ($signature != '') echo "\t\t\t\t\t".'<div class="postsignature postmsg"><hr />'.$signature.'</div>'."\n"; ?> |
---|
363 | </div> |
---|
364 | </div> |
---|
365 | </div> |
---|
366 | <div class="inbox"> |
---|
367 | <div class="postfoot clearb"> |
---|
368 | <div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo '<p>'.$is_online.'</p>'; ?></div> |
---|
369 | <?php if (count($post_actions)) echo "\t\t\t\t".'<div class="postfootright">'."\n\t\t\t\t\t".'<ul>'."\n\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $post_actions)."\n\t\t\t\t\t".'</ul>'."\n\t\t\t\t".'</div>'."\n" ?> |
---|
370 | </div> |
---|
371 | </div> |
---|
372 | </div> |
---|
373 | </div> |
---|
374 | |
---|
375 | <?php |
---|
376 | |
---|
377 | } |
---|
378 | |
---|
379 | ?> |
---|
380 | <div class="postlinksb"> |
---|
381 | <div class="inbox crumbsplus"> |
---|
382 | <div class="pagepost"> |
---|
383 | <p class="pagelink conl"><?php echo $paging_links ?></p> |
---|
384 | <?php echo $post_link ?> |
---|
385 | </div> |
---|
386 | <ul class="crumbs"> |
---|
387 | <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li> |
---|
388 | <li><span>» </span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li> |
---|
389 | <li><span>» </span><a href="viewtopic.php?id=<?php echo $id ?>"><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></a></li> |
---|
390 | </ul> |
---|
391 | <?php echo $subscraction ?> |
---|
392 | <div class="clearer"></div> |
---|
393 | </div> |
---|
394 | </div> |
---|
395 | |
---|
396 | <?php |
---|
397 | |
---|
398 | // Display quick post if enabled |
---|
399 | if ($quickpost) |
---|
400 | { |
---|
401 | |
---|
402 | $cur_index = 1; |
---|
403 | |
---|
404 | ?> |
---|
405 | <div id="quickpost" class="blockform"> |
---|
406 | <h2><span><?php echo $lang_topic['Quick post'] ?></span></h2> |
---|
407 | <div class="box"> |
---|
408 | <form id="quickpostform" method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}"> |
---|
409 | <div class="inform"> |
---|
410 | <fieldset> |
---|
411 | <legend><?php echo $lang_common['Write message legend'] ?></legend> |
---|
412 | <div class="infldset txtarea"> |
---|
413 | <input type="hidden" name="form_sent" value="1" /> |
---|
414 | <?php if ($pun_config['o_topic_subscriptions'] == '1' && ($pun_user['auto_notify'] == '1' || $cur_topic['is_subscribed'])): ?> <input type="hidden" name="subscribe" value="1" /> |
---|
415 | <?php endif; ?> |
---|
416 | <?php |
---|
417 | |
---|
418 | if ($pun_user['is_guest']) |
---|
419 | { |
---|
420 | $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].' <span>'.$lang_common['Required'].'</span></strong>' : $lang_common['Email']; |
---|
421 | $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email'; |
---|
422 | |
---|
423 | ?> |
---|
424 | <label class="conl required"><strong><?php echo $lang_post['Guest name'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label> |
---|
425 | <label class="conl<?php echo ($pun_config['p_force_guest_email'] == '1') ? ' required' : '' ?>"><?php echo $email_label ?><br /><input type="text" name="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="50" maxlength="80" tabindex="<?php echo $cur_index++ ?>" /><br /></label> |
---|
426 | <div class="clearer"></div> |
---|
427 | <?php |
---|
428 | |
---|
429 | echo "\t\t\t\t\t\t".'<label class="required"><strong>'.$lang_common['Message'].' <span>'.$lang_common['Required'].'</span></strong><br />'; |
---|
430 | } |
---|
431 | else |
---|
432 | echo "\t\t\t\t\t\t".'<label>'; |
---|
433 | |
---|
434 | ?> |
---|
435 | <textarea name="req_message" rows="7" cols="75" tabindex="<?php echo $cur_index++ ?>"></textarea></label> |
---|
436 | <ul class="bblinks"> |
---|
437 | <li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
---|
438 | <li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
---|
439 | <li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li> |
---|
440 | </ul> |
---|
441 | </div> |
---|
442 | </fieldset> |
---|
443 | </div> |
---|
444 | <p class="buttons"><input type="submit" name="submit" tabindex="<?php echo $cur_index++ ?>" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_topic['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /></p> |
---|
445 | </form> |
---|
446 | </div> |
---|
447 | </div> |
---|
448 | <?php |
---|
449 | |
---|
450 | } |
---|
451 | |
---|
452 | // Increment "num_views" for topic |
---|
453 | if ($pun_config['o_topic_views'] == '1') |
---|
454 | $db->query('UPDATE '.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); |
---|
455 | |
---|
456 | $forum_id = $cur_topic['forum_id']; |
---|
457 | $footer_style = 'viewtopic'; |
---|
458 | require PUN_ROOT.'footer.php'; |
---|