示例#1
0
/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:  	BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0 Alpha
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Let them know, if their report was a success!
    if ($context['report_sent']) {
        echo '
			<div class="infobox">
				', $txt['report_sent'], '
			</div>';
    }
    // Show the anchor for the top and for the first message. If the first message is new, say so.
    echo '
			<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a name="new" id="new"></a>' : '';
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
			<div id="poll">
				<div class="cat_bar">
					<h3 class="catbg">
						<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.png" alt="" class="icon" /> ', $txt['poll'], '
					</h3>
				</div>
				<div class="windowbg">
					<div class="content" id="poll_options">
						<h4 id="pollquestion">
							', $context['poll']['question'], '
						</h4>';
        // Are they not allowed to vote but allowed to view the options?
        if ($context['poll']['show_results'] || !$context['allow_vote']) {
            echo '
					<dl class="options">';
            // Show each option with its corresponding percentage bar.
            foreach ($context['poll']['options'] as $option) {
                echo '
						<dt class="', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
						<dd class="statsbar', $option['voted_this'] ? ' voted' : '', '">';
                if ($context['allow_poll_view']) {
                    echo '
							', $option['bar_ndt'], '
							<span class="percentage">', $option['votes'], ' (', $option['percent'], '%)</span>';
                }
                echo '
						</dd>';
            }
            echo '
					</dl>';
            if ($context['allow_poll_view']) {
                echo '
						<p><strong>', $txt['poll_total_voters'], ':</strong> ', $context['poll']['total_votes'], '</p>';
            }
        } else {
            echo '
						<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="UTF-8">';
            // Show a warning if they are allowed more than one option.
            if ($context['poll']['allowed_warning']) {
                echo '
							<p class="smallpadding">', $context['poll']['allowed_warning'], '</p>';
            }
            echo '
							<ul class="reset options">';
            // Show each option with its button - a radio likely.
            foreach ($context['poll']['options'] as $option) {
                echo '
								<li>', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
            }
            echo '
							</ul>
							<div class="submitbutton">
								<input type="submit" value="', $txt['poll_vote'], '" class="button_submit" />
								<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
							</div>
						</form>';
        }
        // Is the clock ticking?
        if (!empty($context['poll']['expire_time'])) {
            echo '
						<p><strong>', $context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on'], ':</strong> ', $context['poll']['expire_time'], '</p>';
        }
        echo '
					</div>
				</div>
			</div>
			<div id="pollmoderation">';
        template_button_strip($context['poll_buttons']);
        echo '
			</div>';
    }
    // Does this topic have some events linked to it?
    if (!empty($context['linked_calendar_events'])) {
        echo '
			<div class="linked_events">
				<div class="title_bar">
					<h3 class="titlebg headerpadding">', $txt['calendar_linked_events'], '</h3>
				</div>
				<div class="windowbg">
					<div class="content">
						<ul class="reset">';
        foreach ($context['linked_calendar_events'] as $event) {
            echo '
							<li>
								', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '"> <img src="' . $settings['images_url'] . '/icons/calendar_modify.png" alt="" title="' . $txt['modify'] . '" class="edit_event" /></a> ' : '', '<strong>', $event['title'], '</strong>: ', $event['start_date'], $event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '', '
							</li>';
        }
        echo '
						</ul>
					</div>
				</div>
			</div>';
    }
    // Show the page index... "Pages: [1]".
    echo '
			<div class="pagesection">
				', template_button_strip($context['normal_buttons'], 'right'), '
				', !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a id="pagetop" href="#bot" class="topbottom floatleft">' . $txt['go_down'] . '</a>' : '', '
				<div class="pagelinks floatleft">
					', $context['page_index'], '
				</div>
			</div>';
    // Show the topic information - icon, subject, etc.
    echo '
			<div id="forumposts">
				<div class="cat_bar">
					<h3 class="catbg">
						<img src="', $settings['images_url'], '/topic/', $context['class'], '.png" alt="" />
						', $txt['topic'], ': ', $context['subject'], '&nbsp;<span>(', $context['num_views_text'], ')</span>
						<span class="nextlinks floatright">', $context['previous_next'], '</span>
					</h3>
				</div>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
				<p id="whoisviewing">';
        // Show just numbers...?
        if ($settings['display_who_viewing'] == 1) {
            echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
        } else {
            echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . (empty($context['view_num_hidden']) || $context['can_moderate_forum'] ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
        }
        // Now show how many guests are here too.
        echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '
				</p>';
    }
    echo '
				<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm" style="margin: 0;" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\') : false">';
    $ignoredMsgs = array();
    $removableMessageIDs = array();
    $alternate = false;
    // Get all the messages...
    while ($message = $context['get_message']()) {
        $ignoring = false;
        $alternate = !$alternate;
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        // Are we ignoring this message?
        if (!empty($message['is_ignored'])) {
            $ignoring = true;
            $ignoredMsgs[] = $message['id'];
        }
        // Show the message anchor and a "new" anchor if this message is new.
        echo '
				<div class="', $message['approved'] ? $message['alternate'] == 0 ? 'windowbg' : 'windowbg2' : 'approvebg', '">', $message['id'] != $context['first_message'] ? '
					<a id="msg' . $message['id'] . '"></a>' . ($message['first_new'] ? '<a name="new" id="new"></a>' : '') : '', '
					<div class="post_wrapper">';
        // Showing the sidebar posting area?
        if (empty($options['hide_poster_area'])) {
            echo '
							<div class="poster">', template_build_poster_div($message, $ignoring), '</div>
							<div class="postarea">';
        }
        echo '
							<div class="keyinfo">
							', !empty($options['hide_poster_area']) ? '<div class="poster poster2" style="">' . template_build_poster_div($message, $ignoring) . '</div>' : '';
        if (!empty($context['follow_ups'][$message['id']])) {
            echo '
								<ul class="follow_ups quickbuttons">
									<li>', $txt['follow_ups'], '
										<ul>';
            foreach ($context['follow_ups'][$message['id']] as $follow_up) {
                echo '
											<li><a href="', $scripturl, '?topic=', $follow_up['follow_up'], '.0">', $follow_up['subject'], '</a></li>';
            }
            echo '
										</ul>
									</li>
								</ul>';
        }
        echo '
								<span id="post_subject_', $message['id'], '" class="post_subject">', $message['subject'], '</span>
								<span id="messageicon_', $message['id'], '" class="messageicon"  ', $message['icon_url'] !== $settings['images_url'] . '/post/xx.png' ? '' : 'style="display:none;"', '>
									<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
								</span>
								<h5 id="info_', $message['id'], '">
									<a href="', $message['href'], '" rel="nofollow" title="', !empty($message['counter']) ? sprintf($txt['reply_number'], $message['counter']) : '', '">', !empty($message['counter']) ? sprintf($txt['reply_number'], $message['counter']) : '', '</a>', !empty($message['counter']) ? ' &ndash; ' : '', $message['time'], '
								</h5>
								<div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' style="display:none;"' : '', '></div>
							</div>';
        // Ignoring this user? Hide the post.
        if ($ignoring) {
            echo '
							<div id="msg_', $message['id'], '_ignored_prompt">
								', $txt['ignoring_user'], '
								<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
							</div>';
        }
        // Show the post itself, finally!
        echo '
							<div class="post">';
        if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
            echo '
								<div class="approve_post">
									', $txt['post_awaiting_approval'], '
								</div>';
        }
        echo '
								<div class="inner" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div>
							</div>';
        // Assuming there are attachments...
        if (!empty($message['attachment'])) {
            echo '
							<div id="msg_', $message['id'], '_footer" class="attachments"', $ignoring ? ' style="display:none;"' : '', '>';
            $last_approved_state = 1;
            $attachments_per_line = 4;
            $i = 0;
            foreach ($message['attachment'] as $attachment) {
                // Show a special box for unapproved attachments...
                if ($attachment['is_approved'] != $last_approved_state) {
                    $last_approved_state = 0;
                    echo '
								<fieldset>
									<legend>', $txt['attach_awaiting_approve'];
                    if ($context['can_approve']) {
                        echo '
										&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]';
                    }
                    echo '
									</legend>';
                }
                echo '
									<div class="floatleft">';
                if ($attachment['is_image']) {
                    echo '
										<div class="attachments_top">';
                    if ($attachment['thumbnail']['has_thumb']) {
                        echo '
											<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" /></a>';
                    } else {
                        echo '
											<img src="' . $attachment['href'] . ';image" alt="" style="width:' . $attachment['width'] . 'px; height:' . $attachment['height'] . 'px"/>';
                    }
                    echo '
										</div>';
                }
                echo '
										<div class="attachments_bot">
											<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.png" class="centericon" alt="*" />&nbsp;' . $attachment['name'] . '</a> ';
                if (!$attachment['is_approved'] && $context['can_approve']) {
                    echo '
											[<a href="', $scripturl, '?action=attachapprove;sa=approve;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a>]&nbsp;|&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=reject;aid=', $attachment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['delete'], '</a>] ';
                }
                echo '
											<br />', $attachment['size'], $attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . '<br />' . sprintf($txt['attach_viewed'], $attachment['downloads']) : '<br />' . sprintf($txt['attach_downloaded'], $attachment['downloads']), '
										</div>';
                echo '
									</div>';
                // Next attachment line ?
                if (++$i % $attachments_per_line === 0) {
                    echo '
									<hr />';
                }
            }
            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0) {
                echo '
								</fieldset>';
            }
            echo '
							</div>';
        }
        if (empty($options['hide_poster_area'])) {
            echo '
						</div>';
        }
        // Show the quickbuttons, for various operations on posts.
        echo '
						<div class="quickbuttons_wrap"', empty($options['hide_poster_area']) ? '' : ' style="margin:0"', '>
							<ul class="quickbuttons nojs_visible">';
        // Show "Last Edit: Time by Person" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name'])) {
            echo '
								<li class="modified" id="modified_', $message['id'], '">
									', $message['modified']['last_edit_text'], '
								</li>';
        }
        // Show a checkbox for quick moderation?
        if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
            echo '
								<li class="inline_mod_check" style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
        }
        // Maybe they can modify the post (this is the more button)
        if ($message['can_modify']) {
            echo '
								<li class="post_options"><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '">', $txt['post_options'], '</a>';
        }
        if ($message['can_modify'] || $message['can_remove'] || $context['can_split'] && !empty($context['real_num_replies']) || $context['can_restore_msg'] || $message['can_approve'] || $message['can_unapprove'] || $context['can_report_moderator']) {
            // Let show them the other options they may have in a nice pulldown
            echo '
									<ul>';
            // Can the user modify the contents of this post?
            if ($message['can_modify']) {
                echo '
										<li><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="modify_button">', $txt['modify'], '</a></li>';
            }
            // How about... even... remove it entirely?!
            if ($message['can_remove']) {
                echo '
										<li><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="remove_button">', $txt['remove'], '</a></li>';
            }
            // What about splitting it off the rest of the topic?
            if ($context['can_split'] && !empty($context['real_num_replies'])) {
                echo '
										<li><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="split_button">', $txt['split'], '</a></li>';
            }
            // Can we restore topics?
            if ($context['can_restore_msg']) {
                echo '
										<li><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="restore_button">', $txt['restore_message'], '</a></li>';
            }
            // Maybe we can approve it, maybe we should?
            if ($message['can_approve']) {
                echo '
										<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="approve_button">', $txt['approve'], '</a></li>';
            }
            // Maybe we can unapprove it?
            if ($message['can_unapprove']) {
                echo '
										<li><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="unapprove_button">', $txt['unapprove'], '</a></li>';
            }
            // Maybe they want to report this post to the moderator(s)?
            if ($context['can_report_moderator']) {
                echo '
										<li><a href="' . $scripturl . '?action=reporttm;topic=' . $context['current_topic'] . '.' . $message['counter'] . ';msg=' . $message['id'] . '" class="warn_button">' . $txt['report_to_mod'] . '</a></li>';
            }
            echo '
									</ul>';
        }
        // Can the user quick modify the contents of this post?  Show the quick (inline) modify button.
        if ($message['can_modify']) {
            echo '
								</li>
								<li class="quick_edit"><img src="', $settings['images_url'], '/icons/modify_inline.png" alt="', $txt['modify_msg'], '" title="', $txt['modify_msg'], '" class="modifybutton" id="modify_button_', $message['id'], '" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />', $txt['quick_edit'], '</li>';
        }
        // Can they reply? Have they turned on quick reply?
        if ($context['can_quote'] && !empty($options['display_quick_reply'])) {
            echo '
								<li class="quote"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="quote_button">', $txt['quote'], '</a>';
        } elseif ($context['can_quote']) {
            echo '
								<li class="quote"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="quote_button">', $txt['quote'], '</a>';
        }
        if ($context['can_follow_up']) {
            echo '
									<ul>
										<li><a href="', $scripturl, '?action=post;board=', $context['current_board'], ';quote=', $message['id'], ';followup=', $message['id'], '">', $txt['quote_new'], '</a></li>
									</ul>
								</li>';
        }
        echo '
							</ul>
						</div>';
        echo '
						<div class="moderatorbar"', empty($options['hide_poster_area']) ? '' : ' style="margin:0"', '>';
        // Are there any custom profile fields for above the signature?
        if (!empty($message['member']['custom_fields'])) {
            $shown = false;
            foreach ($message['member']['custom_fields'] as $custom) {
                if ($custom['placement'] != 2 || empty($custom['value'])) {
                    continue;
                }
                if (empty($shown)) {
                    $shown = true;
                    echo '
							<div class="custom_fields_above_signature">
								<ul class="reset nolist">';
                }
                echo '
									<li>', $custom['value'], '</li>';
            }
            if ($shown) {
                echo '
								</ul>
							</div>';
            }
        }
        // Show the member's signature?
        if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
            echo '
							<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>';
        }
        echo '
						</div>
					</div>
				</div>
				<hr class="post_separator" />';
    }
    echo '
				</form>
			</div>';
    // Show the page index... "Pages: [1]".
    echo '
			<div class="pagesection">
				', template_button_strip($context['normal_buttons'], 'right'), '
				', !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a id="pagebot" href="#top" class="topbottom floatleft">' . $txt['go_up'] . '</a>' : '', '
				<div class="pagelinks floatleft">
					', $context['page_index'], '
				</div>
			</div>';
    // Show the lower breadcrumbs.
    theme_linktree();
    echo '
			<div id="moderationbuttons">', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
    // Show the jumpto box, or actually...let Javascript do it.
    echo '
			<div class="plainbox" id="display_jump_to">&nbsp;</div>';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
			<a id="quickreply"></a>
			<div class="tborder" id="quickreplybox">
				<div class="cat_bar">
					<h3 class="catbg">
						<a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] > 1 ? 'collapse' : 'expand', '.png" alt="+" id="quickReplyExpand" class="icon" /></a>
						<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
					</h3>
				</div>
				<div id="quickReplyOptions"', $options['display_quick_reply'] > 1 ? '' : ' style="display: none"', '>
					<div class="roundframe">
						<p class="smalltext lefttext">', $txt['quick_reply_desc'], '</p>
						', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '', $context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
						', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
						', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
						<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" onsubmit="submitonce(this);" >
							<input type="hidden" name="topic" value="', $context['current_topic'], '" />
							<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
							<input type="hidden" name="icon" value="xx" />
							<input type="hidden" name="from_qr" value="1" />
							<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
							<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
							<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
							<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
							<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';
        // Guests just need more.
        if ($context['user']['is_guest']) {
            echo '
							<strong>', $txt['name'], ':</strong> <input type="text" name="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
							<strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" /><br />';
        }
        // Is visual verification enabled?
        if ($context['require_verification']) {
            echo '
							<strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';
        }
        // Using the full editor
        if (empty($options['use_editor_quick_reply'])) {
            echo '
							<div class="quickReplyContent">
								<textarea cols="600" rows="7" name="message" tabindex="', $context['tabindex']++, '"></textarea>
							</div>';
        } else {
            // Show the actual posting area...
            if ($context['show_bbc']) {
                echo '
							<div id="bbcBox_message"></div>';
            }
            // What about smileys?
            if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) {
                echo '
							<div id="smileyBox_message"></div>';
            }
            echo '
							', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '
							<script><!-- // --><![CDATA[
								var post_box_name = "', $context['post_box_name'], '";
							// ]]></script>';
        }
        echo '
							<div class="padding">
								<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        if ($context['show_spellchecking']) {
            echo '
								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\', ', empty($options['use_editor_quick_reply']) ? 'false' : 'true', ')" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        if ($context['drafts_save'] && !empty($options['display_quick_reply'])) {
            echo '
								<input type="submit" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';
            if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
                echo '
								<div class="clear righttext padding"><span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span><span id="draft_lastautosave"></span></div>';
            }
        }
        echo '
							</div>
						</form>
					</div>
				</div>
			</div>';
    } else {
        echo '
		<br class="clear" />';
    }
    // draft autosave available and the user has it enabled?
    if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled']) && !empty($options['display_quick_reply'])) {
        echo '
			<script><!-- // --><![CDATA[
				var oDraftAutoSave = new elk_DraftAutoSave({
					sSelf: \'oDraftAutoSave\',
					sLastNote: \'draft_lastautosave\',
					sLastID: \'id_draft\',
					sSceditorID: ' . (!empty($context['post_box_name']) ? "'" . $context['post_box_name'] . "'" : "null") . ',
					sType: \'', !empty($options['use_editor_quick_reply']) ? 'qpost' : 'quick', '\',
					iBoard: ', empty($context['current_board']) ? 0 : $context['current_board'], ',
					iFreq: ', isset($context['drafts_autosave_frequency']) ? $context['drafts_autosave_frequency'] : 30000, ',
				});
			// ]]></script>';
    }
    // Spell check for quick modify and quick reply (w/o the editor)
    if ($context['show_spellchecking'] && (empty($options['use_editor_quick_reply']) || empty($options['display_quick_reply']))) {
        echo '
				<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
					<input type="hidden" name="spellstring" value="" />
					<input type="hidden" name="fulleditor" value="" />
				</form>
				<script src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
    }
    echo '
				<script><!-- // --><![CDATA[';
    if (!empty($options['display_quick_reply'])) {
        echo '
					var oQuickReply = new QuickReply({
						bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 1 ? 'false' : 'true', ',
						iTopicId: ', $context['current_topic'], ',
						iStart: ', $context['start'], ',
						sScriptUrl: smf_scripturl,
						sImagesUrl: smf_images_url,
						sContainerId: "quickReplyOptions",
						sImageId: "quickReplyExpand",
						sImageCollapsed: "collapse.png",
						sImageExpanded: "expand.png",
						sJumpAnchor: "quickreply",
						bIsFull: ', !empty($options['use_editor_quick_reply']) ? 'true' : 'false', '
					});';
    }
    if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) {
        echo '
					var oInTopicModeration = new InTopicModeration({
						sSelf: \'oInTopicModeration\',
						sCheckboxContainerMask: \'in_topic_mod_check_\',
						aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
						sSessionId: smf_session_id,
						sSessionVar: smf_session_var,
						sButtonStrip: \'moderationbuttons\',
						sButtonStripDisplay: \'moderationbuttons_strip\',
						bUseImageButton: false,
						bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
						sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
						sRemoveButtonImage: \'delete_selected.png\',
						sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
						bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
						sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
						sRestoreButtonImage: \'restore_selected.png\',
						sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
						bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
						sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
						sSplitButtonImage: \'split_selected.png\',
						sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
						sFormId: \'quickModForm\'
					});';
    }
    echo '
					if (\'XMLHttpRequest\' in window)
					{
						var oQuickModify = new QuickModify({
							sIconHide: \'xx.png\',
							sScriptUrl: smf_scripturl,
							sClassName: \'quick_edit\',
							sIDSubject: \'post_subject_\',
							sIDInfo: \'info_\',
							bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
							iTopicId: ', $context['current_topic'], ',
							sTemplateBodyEdit: ', JavaScriptEscape('
								<div id="quick_edit_body_container" style="width: 90%">
									<div id="error_box" class="errorbox" style="display:none;"></div>
									<textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
									<input type="hidden" name="\' + smf_session_var + \'" value="\' + smf_session_id + \'" />
									<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
									<input type="hidden" name="msg" value="%msg_id%" />
									<div class="righttext">
										<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" />&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
									</div>
								</div>'), ',
							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
							sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 85%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
							sTemplateSubjectNormal: ', JavaScriptEscape('%subject%'), ',
							sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
							sTemplateInfoNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a><span class="smalltext modified" id="modified_%msg_id%"></span>'), ',
							sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), $context['can_reply'] && !empty($options['display_quick_reply']) ? ',
							sFormRemoveAccessKeys: \'postmodify\'' : '', '
						});

						aJumpTo[aJumpTo.length] = new JumpTo({
							sContainerId: "display_jump_to",
							sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
							iCurBoardId: ', $context['current_board'], ',
							iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
							sCurBoardName: "', $context['jump_to']['board_name'], '",
							sBoardChildLevelIndicator: "==",
							sBoardPrefix: "=> ",
							sCatSeparator: "-----------------------------",
							sCatPrefix: "",
							sGoButtonLabel: "', $txt['go'], '"
						});

						aIconLists[aIconLists.length] = new IconList({
							sBackReference: "aIconLists[" + aIconLists.length + "]",
							sIconIdPrefix: "msg_icon_",
							sScriptUrl: smf_scripturl,
							bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
							iBoardId: ', $context['current_board'], ',
							iTopicId: ', $context['current_topic'], ',
							sSessionId: smf_session_id,
							sSessionVar: smf_session_var,
							sAction: "messageicons;board=', $context['current_board'], '" ,
							sLabelIconList: "', $txt['message_icon'], '",
							sBoxBackground: "transparent",
							sBoxBackgroundHover: "#ffffff",
							iBoxBorderWidthHover: 1,
							sBoxBorderColorHover: "#adadad" ,
							sContainerBackground: "#ffffff",
							sContainerBorder: "1px solid #adadad",
							sItemBorder: "1px solid #ffffff",
							sItemBorderHover: "1px dotted gray",
							sItemBackground: "transparent",
							sItemBackgroundHover: "#e0e0f0"
						});
					}';
    if (!empty($ignoredMsgs)) {
        echo '
					ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
    }
    echo '
				// ]]></script>';
}
示例#2
0
/**
 * The main template for displaying a topic, does it all, its the king, the bomb, the real deal
 */
function template_messages()
{
    global $context, $settings, $options, $txt, $scripturl;
    // Yeah, I know, though at the moment is the only way...
    global $removableMessageIDs, $ignoredMsgs;
    $ignoredMsgs = array();
    $removableMessageIDs = array();
    // Get all the messages...
    $controller = $context['get_message'][0];
    while ($message = $controller->{$context['get_message'][1]}()) {
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        // Are we ignoring this message?
        if (!empty($message['is_ignored'])) {
            $ignoring = true;
            $ignoredMsgs[] = $message['id'];
        } else {
            $ignoring = false;
        }
        // Show the message anchor and a "new" anchor if this message is new.
        echo '
				<div class="post_wrapper ', $message['classes'], $message['approved'] ? $message['alternate'] == 0 ? ' windowbg' : ' windowbg2' : ' approvebg', '">', $message['id'] != $context['first_message'] ? '
					<a class="post_anchor" id="msg' . $message['id'] . '"></a>' . ($message['first_new'] ? '<a id="new"></a>' : '') : '';
        // Showing the sidebar posting area?
        if (empty($options['hide_poster_area'])) {
            echo '
					<ul class="poster">', template_build_poster_div($message, $ignoring), '</ul>';
        }
        echo '
					<div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '">
						<div class="keyinfo">
						', !empty($options['hide_poster_area']) ? '<ul class="poster poster2">' . template_build_poster_div($message, $ignoring) . '</ul>' : '';
        if (!empty($context['follow_ups'][$message['id']])) {
            echo '
							<ul class="quickbuttons follow_ups">
								<li class="listlevel1 subsections" aria-haspopup="true"><a class="linklevel1">', $txt['follow_ups'], '</a>
									<ul class="menulevel2">';
            foreach ($context['follow_ups'][$message['id']] as $follow_up) {
                echo '
										<li class="listlevel2"><a class="linklevel2" href="', $scripturl, '?topic=', $follow_up['follow_up'], '.0">', $follow_up['subject'], '</a></li>';
            }
            echo '
									</ul>
								</li>
							</ul>';
        }
        echo '
							<span id="post_subject_', $message['id'], '" class="post_subject">', $message['subject'], '</span>
							<span id="messageicon_', $message['id'], '" class="messageicon"  ', $message['icon_url'] !== $settings['images_url'] . '/post/xx.png' ? '' : 'style="display:none;"', '>
								<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
							</span>
							<h5 id="info_', $message['id'], '">
								<a href="', $message['href'], '" rel="nofollow">', !empty($message['counter']) ? sprintf($txt['reply_number'], $message['counter']) : '', '</a>', !empty($message['counter']) ? ' &ndash; ' : '', $message['html_time'], '
							</h5>
							<div id="msg_', $message['id'], '_quick_mod"', $ignoring ? ' style="display:none;"' : '', '></div>
						</div>';
        // Ignoring this user? Hide the post.
        if ($ignoring) {
            echo '
						<div id="msg_', $message['id'], '_ignored_prompt">
							', $txt['ignoring_user'], '
							<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
						</div>';
        }
        // Awaiting moderation?
        if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
            echo '
						<div class="approve_post">
							', $txt['post_awaiting_approval'], '
						</div>';
        }
        // Show the post itself, finally!
        echo '
						<div class="inner" id="msg_', $message['id'], '"', $ignoring ? ' style="display:none;"' : '', '>', $message['body'], '</div>';
        // Assuming there are attachments...
        if (!empty($message['attachment'])) {
            template_display_attachments($message, $ignoring);
        }
        // Show the quickbuttons, for various operations on posts.
        echo '
						<ul id="buttons_', $message['id'], '" class="quickbuttons">';
        // Show a checkbox for quick moderation?
        if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
            echo '
							<li class="listlevel1 inline_mod_check" style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
        }
        // Show "Last Edit: Time by Person" if this post was edited.
        if ($settings['show_modify']) {
            echo '
							<li class="listlevel1 modified" id="modified_', $message['id'], '"', !empty($message['modified']['name']) ? '' : ' style="display:none"', '>
								', !empty($message['modified']['name']) ? $message['modified']['last_edit_text'] : '', '
							</li>';
        }
        // Maybe they can modify the post (this is the more button)
        if ($message['can_modify'] || $context['can_report_moderator']) {
            echo '
							<li class="listlevel1 subsections" aria-haspopup="true"><a href="#" ', !empty($options['use_click_menu']) ? '' : 'onclick="event.stopPropagation();return false;" ', 'class="linklevel1 post_options">', $txt['post_options'], '</a>';
        }
        if ($message['can_modify'] || $message['can_remove'] || $context['can_follow_up'] || $context['can_split'] && !empty($context['real_num_replies']) || $context['can_restore_msg'] || $message['can_approve'] || $message['can_unapprove'] || $context['can_report_moderator']) {
            // Show them the other options they may have in a nice pulldown
            echo '
								<ul class="menulevel2">';
            // Can the user modify the contents of this post?
            if ($message['can_modify']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '" class="linklevel2 modify_button">', $txt['modify'], '</a></li>';
            }
            // How about... even... remove it entirely?!
            if ($message['can_remove']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=deletemsg;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="linklevel2 remove_button">', $txt['remove'], '</a></li>';
            }
            // Can they quote to a new topic? @todo - This needs rethinking for GUI layout.
            if ($context['can_follow_up']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=post;board=', $context['current_board'], ';quote=', $message['id'], ';followup=', $message['id'], '" class="linklevel2 quotetonew_button">', $txt['quote_new'], '</a></li>';
            }
            // What about splitting it off the rest of the topic?
            if ($context['can_split'] && !empty($context['real_num_replies']) && $context['topic_first_message'] !== $message['id']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '" class="linklevel2 split_button">', $txt['split_topic'], '</a></li>';
            }
            // Can we restore topics?
            if ($context['can_restore_msg']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel2 restore_button">', $txt['restore_message'], '</a></li>';
            }
            // Maybe we can approve it, maybe we should?
            if ($message['can_approve']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="linklevel2 approve_button">', $txt['approve'], '</a></li>';
            }
            // Maybe we can unapprove it?
            if ($message['can_unapprove']) {
                echo '
									<li class="listlevel2"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '"  class="linklevel2 unapprove_button">', $txt['unapprove'], '</a></li>';
            }
            // Maybe they want to report this post to the moderator(s)?
            if ($context['can_report_moderator']) {
                echo '
									<li class="listlevel2"><a href="' . $scripturl . '?action=reporttm;topic=' . $context['current_topic'] . '.' . $message['counter'] . ';msg=' . $message['id'] . '" class="linklevel2 warn_button">' . $txt['report_to_mod'] . '</a></li>';
            }
            // Anything else added by mods for example?
            if (!empty($context['additional_drop_buttons'])) {
                foreach ($context['additional_drop_buttons'] as $key => $button) {
                    echo '
									<li class="listlevel2"><a href="' . $button['href'] . '" class="linklevel2 ', $key, '">' . $button['text'] . '</a></li>';
                }
            }
            echo '
								</ul>';
        }
        // Hide likes if its off
        if ($message['likes_enabled']) {
            // Can they like/unlike this post?
            if ($message['can_like'] || $message['can_unlike']) {
                echo '
							<li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '>
								<a class="linklevel1 ', $message['can_unlike'] ? 'unlike_button' : 'like_button', '" href="javascript:void(0)" title="', !empty($message['like_counter']) ? $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) : '', '" onclick="likePosts.prototype.likeUnlikePosts(event,', $message['id'], ', ', $context['current_topic'], '); return false;">', !empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span>&nbsp;' . $txt['likes'] : $txt['like_post'], '
								</a>
							</li>';
            } else {
                echo '
							<li class="listlevel1', !empty($message['like_counter']) ? ' liked"' : '"', '>
								<a href="javascript:void(0)" title="', !empty($message['like_counter']) ? $txt['liked_by'] . ' ' . implode(', ', $context['likes'][$message['id']]['member']) : '', '" class="linklevel1 likes_button">', !empty($message['like_counter']) ? '<span class="likes_indicator">' . $message['like_counter'] . '</span>&nbsp;' . $txt['likes'] : '&nbsp;', '
								</a>
							</li>';
            }
        }
        // Can the user quick modify the contents of this post?  Show the quick (inline) modify button.
        if ($message['can_modify']) {
            echo '
							<li class="listlevel1 quick_edit" id="modify_button_', $message['id'], '" style="display: none"><a class="linklevel1 quick_edit" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')">', $txt['quick_edit'], '</a></li>';
        }
        // Can they reply? Have they turned on quick reply?
        if ($context['can_quote'] && !empty($options['display_quick_reply'])) {
            echo '
							<li class="listlevel1">
								<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="linklevel1 quote_button">', $txt['quote'], '</a>
							</li>';
        } elseif ($context['can_quote']) {
            echo '
							<li class="listlevel1">
								<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" class="linklevel1 quote_button">', $txt['quote'], '</a>
							</li>';
        }
        // Anything else added by mods for example?
        if (!empty($context['additional_quick_buttons'])) {
            foreach ($context['additional_quick_buttons'] as $key => $button) {
                echo '
								<li class="listlevel1"><a href="' . $button['href'] . '" class="linklevel1 ', $key, '">' . $button['text'] . '</a></li>';
            }
        }
        echo '
						</ul>';
        // Are there any custom profile fields for above the signature?
        // Show them if signatures are enabled and you want to see them.
        if (!empty($message['member']['custom_fields']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
            $shown = false;
            foreach ($message['member']['custom_fields'] as $custom) {
                if ($custom['placement'] != 2 || empty($custom['value'])) {
                    continue;
                }
                if (empty($shown)) {
                    $shown = true;
                    echo '
						<div class="custom_fields_above_signature">
							<ul>';
                }
                echo '
								<li>', $custom['value'], '</li>';
            }
            if ($shown) {
                echo '
							</ul>
						</div>';
            }
        }
        // Show the member's signature?
        if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
            echo '
						<div class="signature" id="msg_', $message['id'], '_signature"', $ignoring ? ' style="display:none;"' : '', '>', $message['member']['signature'], '</div>';
        }
        echo '
					</div>
				</div>
				<hr class="post_separator" />';
    }
}
/**
 * Messages folder, used to viewing a listing of messages
 */
function template_folder()
{
    global $context, $scripturl, $options, $txt;
    $start = true;
    // Do we have some messages to display?
    if ($context['get_pmessage']('message', true)) {
        echo '
					<div class="forumposts">';
        while ($message = $context['get_pmessage']('message')) {
            // Show the helpful titlebar - generally.
            if ($start && $context['display_mode'] != 1) {
                echo '
						<h2 class="category_header">
							', $context['display_mode'] == 0 ? $txt['messages'] : $txt['conversation'] . ': ' . $message['subject'], '
						</h2>';
                $start = false;
            }
            $window_class = $message['alternate'] === 0 ? 'windowbg' : 'windowbg2';
            echo '
						<a class="pm_anchor" id="msg_', $message['id'], '"></a><div class="', $window_class, '">';
            // Showing the sidebar posting area?
            if (empty($options['hide_poster_area'])) {
                echo '
							<ul class="poster">', template_build_poster_div($message), '</ul>';
            }
            echo '
							<div class="postarea', empty($options['hide_poster_area']) ? '' : '2', '">
								<div class="keyinfo">
									', !empty($options['hide_poster_area']) ? '<ul class="poster poster2">' . template_build_poster_div($message) . '</ul>' : '', '
									<span id="post_subject_', $message['id'], '" class="post_subject">', $message['subject'], '</span>
									<h5 id="info_', $message['id'], '">';
            // @todo - above needs fixing re document outlining (a11y stuffz).
            // Show who the message was sent to.
            echo '
										<strong>', $txt['sent_to'], ': </strong>';
            // People it was sent directly to....
            if (!empty($message['recipients']['to'])) {
                echo implode(', ', $message['recipients']['to']);
            } elseif ($context['folder'] != 'sent') {
                echo '(', $txt['pm_undisclosed_recipients'], ')';
            }
            echo '
										<strong> ', $txt['on'], ': </strong>', $message['time'];
            // If we're in the sent items folder, show who it was sent to besides the "To:" people.
            if (!empty($message['recipients']['bcc'])) {
                echo '
										<br /><strong> ', $txt['pm_bcc'], ': </strong>', implode(', ', $message['recipients']['bcc']);
            }
            if (!empty($message['is_replied_to'])) {
                echo '
										<br />', $txt['pm_is_replied_to'];
            }
            echo '
									</h5>
								</div>';
            // Done with the information about the poster... on to the post itself.
            echo '
								<div class="inner">', $message['body'], '</div>';
            // Show our quick buttons like quote and reply
            echo '
								<ul class="quickbuttons">';
            // Showing all then give a remove item checkbox
            if (empty($context['display_mode'])) {
                echo '
									<li class="listlevel1 quickmod_check">
										<input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;" class="input_check" />
									</li>';
            }
            // Maybe there is something...more :P (this is the more button)
            if (!empty($context['additional_pm_drop_buttons'])) {
                echo '
									<li class="listlevel1 subsections" aria-haspopup="true">
										<a class="linklevel1 post_options">', $txt['post_options'], '</a>
										<ul class="menulevel2">';
                foreach ($context['additional_pm_drop_buttons'] as $key => $button) {
                    echo '
											<li class="listlevel2">
												<a href="' . $button['href'] . '" class="linklevel2 ', $key, '">' . $button['text'] . '</a>
											</li>';
                }
                echo '
										</ul>
									</li>';
            }
            // Remove is always an option
            echo '
									<li class="listlevel1">
										<a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5B', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', addslashes($txt['remove_message']), '?\');" class="linklevel1 remove_button">', $txt['delete'], '</a>
									</li>';
            // Show reply buttons if you have the permission to send PMs.
            if ($context['can_send_pm']) {
                // You can't really reply if the member is gone.
                if (!$message['member']['is_guest']) {
                    // Is there than more than one recipient you can reply to?
                    if ($message['number_recipients'] > 1) {
                        echo '
									<li class="listlevel1">
										<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all" class="linklevel1 reply_all_button">', $txt['reply_to_all'], '</a></li>';
                    }
                    echo '
									<li class="listlevel1">
										<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '" class="linklevel1 reply_button">', $txt['reply'], '</a>
									</li>
									<li class="listlevel1">
										<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '" class="linklevel1 quote_button">', $txt['quote'], '</a>
									</li>';
                } else {
                    echo '
									<li class="listlevel1">
										<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote" class="linklevel1 quote_button">', $txt['reply_quote'], '</a>
									</li>';
                }
            }
            // Anything else added by mods for example?
            if (!empty($context['additional_quick_pm_buttons'])) {
                foreach ($context['additional_quick_pm_buttons'] as $key => $button) {
                    echo '
									<li class="listlevel1">
										<a href="' . $button['href'] . '" class="linklevel1 ', $key, '">' . $button['text'] . '</a>
									</li>';
                }
            }
            echo '
								</ul>';
            // Add a selection box if we have labels enabled.
            if ($context['folder'] !== 'sent' && !empty($context['currently_using_labels']) && $context['display_mode'] != 2) {
                echo '
								<div class="labels">';
                // Add the label drop down box.
                if (!empty($context['currently_using_labels'])) {
                    echo '
									<select name="pm_actions[', $message['id'], ']" onchange="if (this.options[this.selectedIndex].value) form.submit();">
										<option value="">', $txt['pm_msg_label_title'], ':</option>
										<option value="" disabled="disabled">' . str_repeat('&#8212;', strlen($txt['pm_msg_label_title'])) . '</option>';
                    // Are there any labels which can be added to this?
                    if (!$message['fully_labeled']) {
                        echo '
										<option value="" disabled="disabled">', $txt['pm_msg_label_apply'], ':</option>';
                        foreach ($context['labels'] as $label) {
                            if (!isset($message['labels'][$label['id']])) {
                                echo '
										<option value="', $label['id'], '">&nbsp;', $label['name'], '</option>';
                            }
                        }
                    }
                    // ... and are there any that can be removed?
                    if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1]))) {
                        echo '
										<option value="" disabled="disabled">', $txt['pm_msg_label_remove'], ':</option>';
                        foreach ($message['labels'] as $label) {
                            echo '
										<option value="', $label['id'], '">&nbsp;', $label['name'], '</option>';
                        }
                    }
                    echo '
									</select>
									<noscript>
										<input type="submit" value="', $txt['pm_apply'], '" class="button_submit" />
									</noscript>';
                }
                echo '
								</div>';
            }
            // Are there any custom profile fields for above the signature?
            // Show them if signatures are enabled and you want to see them.
            if (!empty($message['member']['custom_fields']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
                $shown = false;
                foreach ($message['member']['custom_fields'] as $custom) {
                    if ($custom['placement'] != 2 || empty($custom['value'])) {
                        continue;
                    }
                    if (!$shown) {
                        $shown = true;
                        echo '
								<div class="custom_fields_above_signature">
									<ul>';
                    }
                    echo '
										<li>', $custom['value'], '</li>';
                }
                if ($shown) {
                    echo '
									</ul>
								</div>';
                }
            }
            // Show the member's signature?
            if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) {
                echo '
								<div class="signature">', $message['member']['signature'], '</div>';
            }
            echo '
							</div>
						</div>';
        }
        echo '
					</div>';
    }
}