comparison forum/Themes/babylon/Display.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
comparison
equal deleted inserted replaced
75:72f59aa7e503 76:e3e11437ecea
1 <?php
2 // Version: 1.1.12; Display
3
4 function template_main()
5 {
6 global $context, $settings, $options, $txt, $scripturl, $modSettings;
7
8 // Show the anchor for the top and for the first message. If the first message is new, say so.
9 echo '
10 <a name="top"></a>
11 <a name="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a name="new"></a>' : '';
12
13 // Show the linktree as well as the "Who's Viewing" information.
14 echo '
15 <table width="100%" cellpadding="3" cellspacing="0">
16 <tr>
17 <td valign="bottom">', theme_linktree(), '</td>';
18 if (!empty($settings['display_who_viewing']))
19 {
20 echo '
21 <td align="center" class="smalltext">';
22
23 // Show just numbers...?
24 if ($settings['display_who_viewing'] == 1)
25 echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt[19];
26 // Or show the actual people viewing the topic?
27 else
28 echo empty($context['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
29
30 // Now show how many guests are here too.
31 echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '</td>';
32 }
33
34 // Show the previous/next links.
35 echo '
36 <td valign="bottom" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext">
37 <span class="nav">', $context['previous_next'], '</span>
38 </td>
39 </tr>
40 </table>';
41
42 // Is this topic also a poll?
43 if ($context['is_poll'])
44 {
45 echo '
46 <table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
47 <tr class="titlebg">
48 <td colspan="2" valign="middle" style="padding-left: 6px;">
49 <img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="top" /> ', $txt['smf43'], '
50 </td>
51 </tr>
52 <tr class="windowbg">
53 <td width="5%" valign="top"><b>', $txt['smf21'], ':</b></td>
54 <td>
55 ', $context['poll']['question'];
56 if (!empty($context['poll']['expire_time']))
57 echo '
58 &nbsp;(', ($context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on']), ': ', $context['poll']['expire_time'], ')';
59
60 // Are they not allowed to vote but allowed to view the options?
61 if ($context['poll']['show_results'] || !$context['allow_vote'])
62 {
63 echo '
64 <table>
65 <tr>
66 <td style="padding-top: 2ex;">
67 <table border="0" cellpadding="0" cellspacing="0">';
68
69 // Show each option with its corresponding percentage bar.
70 foreach ($context['poll']['options'] as $option)
71 echo '
72 <tr>
73 <td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
74 <td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
75 </tr>';
76
77 echo '
78 </table>
79 </td>
80 <td valign="bottom" style="padding-left: 15px;">';
81
82 // If they are allowed to revote - show them a link!
83 if ($context['allow_change_vote'])
84 echo '
85 <a href="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], ';sesc=', $context['session_id'], '">', $txt['poll_change_vote'], '</a><br />';
86
87 // If we're viewing the results... maybe we want to go back and vote?
88 if ($context['poll']['show_results'] && $context['allow_vote'])
89 echo '
90 <a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_return_vote'], '</a><br />';
91
92 // If they're allowed to lock the poll, show a link!
93 if ($context['poll']['lock'])
94 echo '
95 <a href="', $scripturl, '?action=lockVoting;topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', !$context['poll']['is_locked'] ? $txt['smf30'] : $txt['smf30b'], '</a><br />';
96
97 // If they're allowed to edit the poll... guess what... show a link!
98 if ($context['poll']['edit'])
99 echo '
100 <a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['smf39'], '</a>';
101
102 echo '
103 </td>
104 </tr>', $context['allow_poll_view'] ? '
105 <tr>
106 <td colspan="2"><b>' . $txt['smf24'] . ': ' . $context['poll']['total_votes'] . '</b></td>
107 </tr>' : '', '
108 </table><br />';
109 }
110 // They are allowed to vote! Go to it!
111 else
112 {
113 echo '
114 <form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
115 <table>
116 <tr>
117 <td colspan="2">';
118
119 // Show a warning if they are allowed more than one option.
120 if ($context['poll']['allowed_warning'])
121 echo '
122 ', $context['poll']['allowed_warning'], '
123 </td>
124 </tr><tr>
125 <td>';
126
127 // Show each option with its button - a radio likely.
128 foreach ($context['poll']['options'] as $option)
129 echo '
130 <label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br />';
131
132 echo '
133 </td>
134 <td valign="bottom" style="padding-left: 15px;">';
135
136 // Allowed to view the results? (without voting!)
137 if ($context['allow_poll_view'])
138 echo '
139 <a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';viewResults">', $txt['smf29'], '</a><br />';
140
141 // Show a link for locking the poll as well...
142 if ($context['poll']['lock'])
143 echo '
144 <a href="', $scripturl, '?action=lockVoting;topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', (!$context['poll']['is_locked'] ? $txt['smf30'] : $txt['smf30b']), '</a><br />';
145
146 // Want to edit it? Click right here......
147 if ($context['poll']['edit'])
148 echo '
149 <a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['smf39'], '</a>';
150
151 echo '
152 </td>
153 </tr><tr>
154 <td colspan="2"><input type="submit" value="', $txt['smf23'], '" /></td>
155 </tr>
156 </table>
157 <input type="hidden" name="sc" value="', $context['session_id'], '" />
158 </form>';
159 }
160
161 echo '
162 </td>
163 </tr>
164 </table>';
165 }
166
167 // Does this topic have some events linked to it?
168 if (!empty($context['linked_calendar_events']))
169 {
170 echo '
171 <table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
172 <tr class="titlebg">
173 <td colspan="2" valign="middle" align="left" style="padding-left: 6px;">
174 ', $txt['calendar_linked_events'], '
175 </td>
176 </tr>
177 <tr class="windowbg">
178 <td width="5%" valign="top">
179 <ul>';
180 foreach ($context['linked_calendar_events'] as $event)
181 {
182 echo '
183 <li>
184 ', ($event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : ''), '<b>', $event['title'], '</b>: ', $event['start_date'], ($event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : ''), '
185 </li>';
186 }
187 echo '
188 </ul>
189 </td>
190 </tr>
191 </table>';
192 }
193
194 // Show the page index... "Pages: [1]".
195 echo '
196 <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-bottom: 1ex;">
197 <tr>
198 <td class="catbg" width="100%" height="35">
199 <table cellpadding="3" cellspacing="0" width="100%">
200 <tr>
201 <td>
202 <b>', $txt[139], ':</b> ', $context['page_index'];
203
204 // Show a "go down" link?
205 if (!empty($modSettings['topbottomEnable']))
206 echo $context['menu_separator'], '<a href="#bot">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_down.gif" alt="' . $txt['topbottom5'] . '" border="0" align="top" />' : $txt['topbottom5'], '</a>';
207
208 echo '
209 </td>
210 <td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller;">';
211
212 $buttonArray = array();
213 if ($context['can_reply'])
214 $buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/reply.gif" alt="' . $txt[146] . '" border="0" />' : $txt[146]) . '</a>';
215 if ($context['can_mark_notify'])
216 $buttonArray[] = '<a href="' . $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/notify.gif" alt="' . $txt[131] . '" border="0" />' : $txt[131]) . '</a>';
217
218 // This is a special case; if they can see mark unread, put it at the top... otherwise show add poll.
219 if ($context['user']['is_logged'] && $settings['show_mark_read'])
220 $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/markunread.gif" alt="' . $txt['mark_unread'] . '" border="0" />' : $txt['mark_unread']) . '</a>';
221 elseif ($context['can_add_poll'])
222 $buttonArray[] = '<a href="' . $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addpoll.gif" alt="' . $txt['add_poll'] . '" border="0" />' : $txt['add_poll']) . '</a>';
223
224 if ($context['can_send_topic'])
225 $buttonArray[] = '<a href="' . $scripturl . '?action=sendtopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/sendtopic.gif" alt="' . $txt[707] . '" border="0" />' : $txt[707]) . '</a>';
226 $buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/print.gif" alt="' . $txt[465] . '" border="0" />' : $txt[465]) . '</a>';
227
228 echo implode($context['menu_separator'], $buttonArray);
229
230 echo '</td>
231 </tr>
232 </table>
233 </td>
234 </tr>
235 </table>';
236
237 // Show the topic information - icon, subject, etc.
238 echo '
239 <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
240 <tr class="titlebg">
241 <td valign="middle" width="15%" style="padding-left: 6px;">
242 <img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" alt="" align="middle" /> ', $txt[29], '
243 </td>
244 <td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject">
245 ', $txt[118], ': ', $context['subject'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
246 </td>
247 </tr>
248 </table>';
249
250 // if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
251 echo '
252 <form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" name="quickModForm" accept-charset="', $context['character_set'], '" id="quickModForm" style="margin: 0;" onsubmit="return in_edit_mode == 1 ? modify_save(\'' . $context['session_id'] . '\') : confirm(\'' . $txt['quickmod_confirm'] . '\');">';
253
254 echo '
255 <table cellpadding="0" cellspacing="0" border="0" width="100%" class="bordercolor">';
256
257 // Get all the messages...
258 while ($message = $context['get_message']())
259 {
260 echo '
261 <tr><td style="padding: 1px 1px 0 1px;">';
262
263 // Show the message anchor and a "new" anchor if this message is new.
264 if ($message['id'] != $context['first_message'])
265 echo '
266 <a name="msg', $message['id'], '"></a>', $message['first_new'] ? '<a name="new"></a>' : '';
267
268 echo '
269 <table width="100%" cellpadding="3" cellspacing="0" border="0">
270 <tr><td class="', $message['alternate'] == 0 ? 'windowbg' : 'windowbg2', '">';
271
272 // Show information about the poster of this message.
273 echo '
274 <table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
275 <tr>
276 <td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
277 <b>', $message['member']['link'], '</b>
278 <div class="smalltext">';
279
280 // Show the member's custom title, if they have one.
281 if (isset($message['member']['title']) && $message['member']['title'] != '')
282 echo '
283 ', $message['member']['title'], '<br />';
284
285 // Show the member's primary group (like 'Administrator') if they have one.
286 if (isset($message['member']['group']) && $message['member']['group'] != '')
287 echo '
288 ', $message['member']['group'], '<br />';
289
290 // Don't show these things for guests.
291 if (!$message['member']['is_guest'])
292 {
293 // Show the post group if and only if they have no other group or the option is on, and they are in a post group.
294 if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
295 echo '
296 ', $message['member']['post_group'], '<br />';
297 echo '
298 ', $message['member']['group_stars'], '<br />';
299
300 // Is karma display enabled? Total or +/-?
301 if ($modSettings['karmaMode'] == '1')
302 echo '
303 <br />
304 ', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
305 elseif ($modSettings['karmaMode'] == '2')
306 echo '
307 <br />
308 ', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';
309
310 // Is this user allowed to modify this member's karma?
311 if ($message['member']['karma']['allow'])
312 echo '
313 <a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
314 <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
315
316 // Show online and offline buttons?
317 if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
318 echo '
319 ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $message['member']['online']['image_href'] . '" alt="' . $message['member']['online']['text'] . '" border="0" align="middle" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '<br /><br />';
320
321 // Show the member's gender icon?
322 if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '')
323 echo '
324 ', $txt[231], ': ', $message['member']['gender']['image'], '<br />';
325
326 // Show how many posts they have made.
327 echo '
328 ', $txt[26], ': ', $message['member']['posts'], '<br />
329 <br />';
330
331 // Show avatars, images, etc.?
332 if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
333 echo '
334 <div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';
335
336 // Show their personal text?
337 if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
338 echo '
339 ', $message['member']['blurb'], '<br />
340 <br />';
341
342 // This shows the popular messaging icons.
343 echo '
344 ', $message['member']['icq']['link'], '
345 ', $message['member']['msn']['link'], '
346 ', $message['member']['aim']['link'], '
347 ', $message['member']['yim']['link'], '<br />';
348
349 // Show the profile, website, email address, and personal message buttons.
350 if ($settings['show_profile_buttons'])
351 {
352 // Don't show the profile button if you're not allowed to view the profile.
353 if ($message['member']['can_view_profile'])
354 echo '
355 <a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.gif" alt="' . $txt[27] . '" title="' . $txt[27] . '" border="0" />' : $txt[27]), '</a>';
356
357 // Don't show an icon if they haven't specified a website.
358 if ($message['member']['website']['url'] != '')
359 echo '
360 <a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.gif" alt="' . $txt[515] . '" border="0" />' : $txt[515]), '</a>';
361
362 // Don't show the email address if they want it hidden.
363 if (empty($message['member']['hide_email']))
364 echo '
365 <a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';
366
367 // Since we know this person isn't a guest, you *can* message them.
368 if ($context['can_send_pm'])
369 echo '
370 <a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';
371 }
372 }
373 // Otherwise, show the guest's email.
374 elseif (empty($message['member']['hide_email']))
375 echo '
376 <br />
377 <br />
378 <a href="mailto:', $message['member']['email'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt[69] . '" title="' . $txt[69] . '" border="0" />' : $txt[69]), '</a>';
379
380 // Done with the information about the poster... on to the post itself.
381 echo '
382 </div>
383 </td>
384 <td valign="top" width="85%" height="100%">
385 <table width="100%" border="0"><tr>
386 <td valign="middle"><a href="', $message['href'], '"><img src="', $message['icon_url'] . '" alt="" border="0" /></a></td>
387 <td valign="middle">
388 <div style="font-weight: bold;" id="subject_', $message['id'], '">
389 <a href="', $message['href'], '">', $message['subject'], '</a>
390 </div>';
391
392 // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
393 echo '
394 <div class="smalltext">&#171; <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ':</b> ', $message['time'], ' &#187;</div></td>
395 <td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';
396
397 // Can they reply? Have they turned on quick reply?
398 if ($context['can_reply'] && !empty($options['display_quick_reply']))
399 echo '
400 <a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '" onclick="doQuote(', $message['id'], ', \'', $context['session_id'], '\'); return false;">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';
401 // So... quick reply is off, but they *can* reply?
402 elseif ($context['can_reply'])
403 echo '
404 <a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';
405
406 // Can the user modify the contents of this post?
407 if ($message['can_modify'])
408 echo '
409 <a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/modify.gif" alt="' . $txt[66] . '" border="0" />' : $txt[17]), '</a>';
410
411 // How about... even... remove it entirely?!
412 if ($message['can_remove'])
413 echo '
414 <a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';sesc=', $context['session_id'], '" onclick="return confirm(\'', $txt[154], '?\');">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/delete.gif" alt="' . $txt[121] . '" border="0" />' : $txt[31]), '</a>';
415
416 // What about splitting it off the rest of the topic?
417 if ($context['can_split'])
418 echo '
419 <a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/split.gif" alt="' . $txt['smf251'] . '" border="0" />' : $txt['smf251']), '</a>';
420
421 // Show a checkbox for quick moderation?
422 if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove'])
423 echo '
424 <input type="checkbox" name="msgs[]" value="', $message['id'], '" class="check" onclick="document.getElementById(\'quickmodSubmit\').style.display = \'\';" />';
425
426 // Show the post itself, finally!
427 echo '
428 </td>
429 </tr></table>
430 <hr width="100%" size="1" class="hrcolor" />
431 <div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
432 <img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
433 </td>
434 </tr>';
435
436 // Now for the attachments, signature, ip logged, etc...
437 echo '
438 <tr>
439 <td valign="bottom" class="smalltext" width="85%">
440 <table width="100%" border="0" style="table-layout: fixed;"><tr>
441 <td colspan="2" class="smalltext" width="100%">';
442
443 // Assuming there are attachments...
444 if (!empty($message['attachment']))
445 {
446 echo '
447 <hr width="100%" size="1" class="hrcolor" />
448 <div style="overflow: auto; width: 100%;">';
449 foreach ($message['attachment'] as $attachment)
450 {
451 if ($attachment['is_image'])
452 {
453 if ($attachment['thumbnail']['has_thumb'])
454 echo '
455 <a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
456 else
457 echo '
458 <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
459 }
460 echo '
461 <a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
462 }
463
464 echo '
465 </div>';
466 }
467
468 echo '
469 </td>
470 </tr><tr>
471 <td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
472
473 // Show "« Last Edit: Time by Person »" if this post was edited.
474 if ($settings['show_modify'] && !empty($message['modified']['name']))
475 echo '
476 &#171; <i>', $txt[211], ': ', $message['modified']['time'], ' ', $txt[525], ' ', $message['modified']['name'], '</i> &#187;';
477
478 echo '
479 </td>
480 <td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" class="smalltext">';
481
482 // Maybe they want to report this post to the moderator(s)?
483 if ($context['can_report_moderator'])
484 echo '
485 <a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['rtm1'], '</a> &nbsp;';
486 echo '
487 <img src="', $settings['images_url'], '/ip.gif" alt="" border="0" />';
488
489 // Show the IP to this user for this post - because you can moderate?
490 if ($context['can_moderate_forum'] && !empty($message['member']['ip']))
491 echo '
492 <a href="', $scripturl, '?action=trackip;searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqWin(this.href);" class="help">(?)</a>';
493 // Or, should we show it because this is you?
494 elseif ($message['can_see_ip'])
495 echo '
496 <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
497 // Okay, are you at least logged in? Then we can show something about why IPs are logged...
498 elseif (!$context['user']['is_guest'])
499 echo '
500 <a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt[511], '</a>';
501 // Otherwise, you see NOTHING!
502 else
503 echo '
504 ', $txt[511];
505
506 echo '
507 </td>
508 </tr></table>';
509
510 // Show the member's signature?
511 if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
512 echo '
513 <hr width="100%" size="1" class="hrcolor" />
514 <div class="signature">', $message['member']['signature'], '</div>';
515
516 echo '
517 </td>
518 </tr>
519 </table>
520 </td></tr>
521 </table>
522 </td></tr>';
523 }
524 echo '
525 <tr><td style="padding: 0 0 1px 0;"></td></tr>
526 </table>
527 <a name="lastPost"></a>
528
529 <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-top: 1ex;">
530 <tr>
531 <td class="catbg" width="100%" height="30">
532 <table cellpadding="3" cellspacing="0" width="100%">
533 <tr>
534 <td>
535 <a name="bot"></a><b>', $txt[139], ':</b> ', $context['page_index'], (!empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a href="#top">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/go_up.gif" alt="' . $txt['topbottom4'] . '" border="0" align="top" />' : $txt['topbottom4']) . '</a>' : ''), '
536 </td>
537 <td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller;">';
538
539 $buttonArray = array();
540 if ($context['can_reply'])
541 $buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/reply.gif" alt="' . $txt[146] . '" border="0" />' : $txt[146]) . '</a>';
542 if ($context['can_mark_notify'])
543 $buttonArray[] = '<a href="' . $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/notify.gif" alt="' . $txt[131] . '" border="0" />' : $txt[131]) . '</a>';
544
545 // Another special case, similar to above but reversed. Show "add poll" unless they can't - then show unread here too.
546 if ($context['can_add_poll'])
547 $buttonArray[] = '<a href="' . $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/addpoll.gif" alt="' . $txt['add_poll'] . '" border="0" />' : $txt['add_poll']) . '</a>';
548 elseif ($context['user']['is_logged'] && $settings['show_mark_read'])
549 $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/markunread.gif" alt="' . $txt['mark_unread'] . '" border="0" />' : $txt['mark_unread']) . '</a>';
550
551 if ($context['can_send_topic'])
552 $buttonArray[] = '<a href="' . $scripturl . '?action=sendtopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/sendtopic.gif" alt="' . $txt[707] . '" border="0" />' : $txt[707]) . '</a>';
553 $buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/print.gif" alt="' . $txt[465] . '" border="0" />' : $txt[465]) . '</a>';
554
555 echo implode($context['menu_separator'], $buttonArray);
556
557 echo '&nbsp;
558 </td>
559 </tr>
560 </table>
561 </td>
562 </tr>
563 </table>';
564
565 if ($context['show_spellchecking'])
566 echo '
567 <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . '/spellcheck.js"></script>';
568
569 echo '
570 <script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . '/xml_topic.js"></script>
571 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
572 quickReplyCollapsed = ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ';
573
574 smf_topic = ', $context['current_topic'], ';
575 smf_start = ', $context['start'], ';
576 smf_show_modify = ', $settings['show_modify'] ? '1' : '0', ';
577
578 // On quick modify, this is what the body will look like.
579 var smf_template_body_edit = \'<div id="error_box" style="padding: 4px; color: red;"></div><textarea class="editor" name="message" rows="12" style="width: 94%; margin-bottom: 10px;">%body%</textarea><br /><input type="hidden" name="sc" value="', $context['session_id'], '" /><input type="hidden" name="topic" value="', $context['current_topic'], '" /><input type="hidden" name="msg" value="%msg_id%" /><div style="text-align: center;"><input type="submit" name="post" value="', $txt[10], '" onclick="return modify_save(\\\'' . $context['session_id'] . '\\\');" accesskey="s" />&nbsp;&nbsp;', $context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" onclick="spellCheck(\\\'quickModForm\\\', \\\'message\\\');" />&nbsp;&nbsp;' : '', '<input type="submit" name="cancel" value="', $txt['modify_cancel'], '" onclick="return modify_cancel();" /></div>\';
580
581 // And this is the replacement for the subject.
582 var smf_template_subject_edit = \'<input type="text" name="subject" value="%subject%" size="60" style="width: 99%;" maxlength="80" />\';
583
584 // Restore the message to this after editing.
585 var smf_template_body_normal = \'%body%\';
586 var smf_template_subject_normal = \'<a href="', $scripturl, '?topic=', $context['current_topic'], '.msg%msg_id%#msg%msg_id%">%subject%</a>\';
587 var smf_template_top_subject = "', $txt[118], ': %subject% &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')"
588
589 if (window.XMLHttpRequest)
590 showModifyButtons();
591 // ]]></script>
592 <table border="0" width="100%" cellpadding="0" cellspacing="0">
593 <tr>';
594 if ($settings['linktree_inline'])
595 echo '
596 <td valign="top">', theme_linktree(), '</td> ';
597 echo '
598 <td valign="top" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext"> <span class="nav"> ', $context['previous_next'], '</span></td>
599 </tr>
600 </table>
601 <div style="padding-top: 4px; padding-bottom: 4px;">', theme_show_mod_buttons(), '</div>';
602
603 if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post'])
604 echo '
605 <input type="hidden" name="sc" value="', $context['session_id'], '" />
606 <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
607 document.getElementById("quickmodSubmit").style.display = "none";
608 // ]]></script>';
609 echo '
610 </form>';
611
612 echo '
613 <div align="', !$context['right_to_left'] ? 'right' : 'left', '" style="margin-bottom: 1ex;">
614 <form action="', $scripturl, '" method="get" accept-charset="', $context['character_set'], '">
615 <span class="smalltext">' . $txt[160] . ':</span>
616 <select name="jumpto" id="jumpto" onchange="if (this.selectedIndex > 0 &amp;&amp; this.options[this.selectedIndex].value) window.location.href = smf_scripturl + this.options[this.selectedIndex].value.substr(smf_scripturl.indexOf(\'?\') == -1 || this.options[this.selectedIndex].value.substr(0, 1) != \'?\' ? 0 : 1);">
617 <option value="">' . $txt[251] . ':</option>';
618 foreach ($context['jump_to'] as $category)
619 {
620 echo '
621 <option value="" disabled="disabled">-----------------------------</option>
622 <option value="#', $category['id'], '">', $category['name'], '</option>
623 <option value="" disabled="disabled">-----------------------------</option>';
624 foreach ($category['boards'] as $board)
625 echo '
626 <option value="?board=', $board['id'], '.0"', $board['is_current'] ? ' selected="selected"' : '', '> ' . str_repeat('==', $board['child_level']) . '=> ' . $board['name'] . '</option>';
627 }
628 echo '
629 </select>&nbsp;
630 <input type="button" value="', $txt[161], '" onclick="if (this.form.jumpto.options[this.form.jumpto.selectedIndex].value) window.location.href = \'', $scripturl, '\' + this.form.jumpto.options[this.form.jumpto.selectedIndex].value;" />
631 </form>
632 </div>
633 <br />';
634
635 if ($context['can_reply'] && !empty($options['display_quick_reply']))
636 {
637 echo '
638 <a name="quickreply"></a>
639 <table border="0" cellspacing="1" cellpadding="3" class="bordercolor" width="100%" style="clear: both;">
640 <tr>
641 <td colspan="2" class="catbg"><a href="javascript:swapQuickReply();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" border="0" id="quickReplyExpand" /></a> <a href="javascript:swapQuickReply();">', $txt['quick_reply_1'], '</a></td>
642 </tr>
643 <tr id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
644 <td class="windowbg" width="25%" valign="top">', $txt['quick_reply_2'], $context['is_locked'] ? '<br /><br /><b>' . $txt['quick_reply_warning'] . '</b>' : '', '</td>
645 <td class="windowbg" width="75%" align="center">
646 <form action="', $scripturl, '?action=post2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
647 <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
648 <input type="hidden" name="subject" value="' . $context['response_prefix'] . $context['subject'] . '" />
649 <input type="hidden" name="icon" value="xx" />
650 <input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
651 <input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
652 <input type="hidden" name="num_replies" value="', $context['num_replies'], '" />
653 <textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="1"></textarea><br />
654 <input type="submit" name="post" value="' . $txt[105] . '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="2" />
655 <input type="submit" name="preview" value="' . $txt[507] . '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="4" />';
656 if ($context['show_spellchecking'])
657 echo '
658 <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" />';
659 echo '
660 <input type="hidden" name="sc" value="' . $context['session_id'] . '" />
661 <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
662 </form>
663 </td>
664 </tr>
665 </table>';
666 }
667 if ($context['show_spellchecking'])
668 echo '
669 <form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
670
671 }
672
673 function theme_show_mod_buttons()
674 {
675 global $context, $settings, $options, $txt, $scripturl, $modSettings;
676
677 $moderationButtons = array();
678
679 if ($context['can_move'])
680 $moderationButtons[] = '<a href="' . $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_move.gif" alt="' . $txt[132] . '" border="0" />' : $txt[132]) . '</a>';
681 if ($context['can_delete'])
682 $moderationButtons[] = '<a href="' . $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt[162] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_rem.gif" alt="' . $txt[63] . '" border="0" />' : $txt[63]) . '</a>';
683 if ($context['can_lock'])
684 $moderationButtons[] = '<a href="' . $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_lock.gif" alt="' . (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280']) . '" border="0" />' : (empty($context['is_locked']) ? $txt['smf279'] : $txt['smf280'])) . '</a>';
685 if ($context['can_sticky'])
686 $moderationButtons[] = '<a href="' . $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_sticky.gif" alt="' . (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278']) . '" border="0" />' : (empty($context['is_sticky']) ? $txt['smf277'] : $txt['smf278'])) . '</a>';
687 if ($context['can_merge'])
688 $moderationButtons[] = '<a href="' . $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/merge.gif" alt="' . $txt['smf252'] . '" border="0" />' : $txt['smf252']) . '</a>';
689 if ($context['can_remove_poll'])
690 $moderationButtons[] = '<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin_remove_poll.gif" alt="' . $txt['poll_remove'] . '" border="0" />' : $txt['poll_remove']) . '</a>';
691
692 if ($context['calendar_post'])
693 $moderationButtons[] = '<a href="' . $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0;sesc=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/linktocal.gif" alt="' . $txt['calendar37'] . '" border="0" />' : $txt['calendar37']) . '</a>';
694
695 if ($context['can_remove_post'] && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
696 $moderationButtons[] = $settings['use_image_buttons'] ? '<input type="image" name="submit" id="quickmodSubmit" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/delete_selected.gif" alt="' . $txt['quickmod_delete_selected'] . '" />' : '<a href="javascript:document.forms.quickModForm.submit();" id="quickmodSubmit">' . $txt['quickmod_delete_selected'] . '</a>';
697
698 return implode($context['menu_separator'], $moderationButtons);
699 }
700
701 ?>