Ejemplo n.º 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;
    echo '
	<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">';
    if (!empty($context['search_errors'])) {
        echo '
		<p>', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    echo '
		<fieldset id="simple_search">
			<div data-role="fieldcontain">
				<label for="search">', $txt['search_for'], ':</label>
				<input id="search" type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
				', $context['require_verification'] ? '' : '<div><input type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit" /></div>
			</div>';
    if ($context['require_verification']) {
        echo '
			<div class="verification>
				<h4>', $txt['search_visual_verification_label'], ':</h4>
				<br />', template_control_verification($context['visual_verification_id'], 'all'), '<br />
				<input id="submit" type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit" />
			</div>';
    }
    echo '
			<input type="hidden" name="advanced" value="0" />
		</fieldset>';
    echo '
	</form>';
}
Ejemplo n.º 2
0
function template_main()
{
    global $scripturl, $txt, $context;
    echo '
<div class="cat_bar">
		<h3 class="catbg centertext">
        ', $txt['smfcontact_contact'], '
        </h3>
  </div>
<form method="post" action="', $scripturl, '?action=contact;sa=save" accept-charset="', $context['character_set'], '">
<table class="table_grid" align="center" width="100%">
  <tr>
    <td width="28%"  class="windowbg2"><b>', $txt['smfcontact_name'], '</b></td>
    <td width="72%"  class="windowbg2"><input type="text" name="from" size="64" /></td>
  </tr>
  <tr>
    <td width="28%"" class="windowbg2"><b>', $txt['smfcontact_subject'], '</b></td>
    <td width="72%"" class="windowbg2"><input type="text" name="subject" size="64" /></td>
  </tr>
  <tr>
    <td width="28%"  valign="top" class="windowbg2"><b>', $txt['smfcontact_body'], '</b></td>
    <td width="72%"  class="windowbg2"><textarea rows="6" name="message" cols="54"></textarea></td>
  </tr>';
    // Is visual verification enabled?
    if ($context['require_verification']) {
        echo '
							<tr class="windowbg2">
								<td align="right" valign="top"', !empty($context['post_error']['need_qr_verification']) ? ' style="color: red;"' : '', '>
									<b>', $txt['verification'], ':</b>
								</td>
								<td>
									', template_control_verification($context['visual_verification_id'], 'all'), '
								</td>
							</tr>';
    }
    echo '
  <tr>
    <td width="28%"" class="windowbg2"><span class="gen"><b>', $txt['smfcontact_emailaddress'], '</b></span></td>
    <td width="72%"" class="windowbg2"><input type="text" name="email" size="64" /></td>
  </tr>
  <tr>
    <td width="28%" colspan="2" align="center" class="windowbg2">
    <input type="submit" value="', $txt['smfcontact_sendemail'], '" name="submit" /></td>

  </tr>
</table>
</form>
';
    // Copyright link requird unless removal purchase is made
    echo '<br /><div align="center"><span class="smalltext">Powered by <a href="http://www.smfhacks.com" target="blank">Contact Page</a></span></div>';
}
Ejemplo n.º 3
0
function template_wap2_post()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;
    echo '
		<form action="', $scripturl, '?action=', $context['destination'], ';board=', $context['current_board'], '.0;wap2" method="post">
			<p class="titlebg">', $context['page_title'], '</p>';
    if (!$context['becomes_approved']) {
        echo '
			<p class="windowbg">
				' . $txt['wait_for_approval'] . '
				<input type="hidden" name="not_approved" value="1" />
			</p>';
    }
    if ($context['locked']) {
        echo '
			<p class="windowbg">
				' . $txt['topic_locked_no_reply'] . '
			</p>';
    }
    if (isset($context['name']) && isset($context['email'])) {
        echo '
			<p class="windowbg"' . (isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) ? ' style="color: #ff0000"' : '') . '>
				' . $txt['username'] . ': <input type="text" name="guestname" value="' . $context['name'] . '" class="input_text" />
			</p>';
        if (empty($modSettings['guest_post_no_email'])) {
            echo '
			<p class="windowbg"' . (isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' style="color: #ff0000"' : '') . '>
				' . $txt['email'] . ': <input type="text" name="email" value="' . $context['email'] . '" class="input_text" />
			</p>';
        }
    }
    if ($context['require_verification']) {
        echo '
			<p class="windowbg"', !empty($context['post_error']['need_qr_verification']) ? ' style="color: #ff0000"' : '', '>
				' . $txt['verification'] . ': ', template_control_verification($context['visual_verification_id'], 'all'), '
			</p>';
    }
    echo '
			<p class="windowbg"', isset($context['post_error']['no_subject']) ? ' style="color: #ff0000"' : '', '>
				', $txt['subject'], ': <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' maxlength="80" class="input_text" />
			</p>
			<p class="windowbg"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="color: #ff0000;"' : '', '>
				', $txt['message'], ': <br />
				<textarea name="message" id="message" rows="5" cols="20">', $context['message'], '</textarea>
			</p>
			<p class="windowbg">
				<input type="submit" name="post" value="', $context['submit_label'], '" class="button_submit" />
				<input type="hidden" name="icon" value="wireless" />
				<input type="hidden" name="goback" value="', $context['back_to_topic'] || !empty($options['return_to_post']) ? '1' : '0', '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />', isset($context['current_topic']) ? '
				<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', '
				<input type="hidden" name="notify" value="', $context['notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
			</p>
			<p class="windowbg">[0] ', !empty($context['current_topic']) ? '<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.new;wap2">' . $txt['wireless_navigation_topic'] . '</a>' : '<a href="' . $scripturl . '?board=' . $context['current_board'] . '.0;wap2" accesskey="0">' . $txt['wireless_navigation_index'] . '</a>', '</p>
		</form>';
}
Ejemplo n.º 4
0
function template_send()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    // Show which messages were sent successfully and which failed.
    if (!empty($context['send_log'])) {
        echo '
			<div class="cat_bar">
				<h3 class="catbg">', $txt['pm_send_report'], '</h3>
			</div>
			<div class="windowbg">
			<span class="topslice"><span></span></span>
				<div class="content">';
        if (!empty($context['send_log']['sent'])) {
            foreach ($context['send_log']['sent'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        if (!empty($context['send_log']['failed'])) {
            foreach ($context['send_log']['failed'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        echo '
				</div>
			<span class="botslice"><span></span></span>
			</div>
			<br />';
    }
    // Show the preview of the personal message.
    if (isset($context['preview_message'])) {
        echo '
		<div class="cat_bar">
			<h3 class="catbg">', $context['preview_subject'], '</h3>
		</div>
		<div class="windowbg">
		<span class="topslice"><span></span></span>
			<div class="content">
				', $context['preview_message'], '
			</div>
		<span class="botslice"><span></span></span>
		</div>
		<br />';
    }
    // Main message editing box.
    echo '
		<div class="cat_bar">
			<h3 class="catbg">
					<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/im_newmsg.gif" alt="', $txt['new_message'], '" title="', $txt['new_message'], '" />&nbsp;', $txt['new_message'], '</span>
			</h3>
		</div>';
    echo '
	<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
		<div>
			<span class="upperframe"><span></span></span>
			<div class="roundframe">';
    // If there were errors for sending the PM, show them.
    if (!empty($context['post_error']['messages'])) {
        echo '
				<div class="errorbox">
					<strong>', $txt['error_while_submitting'], '</strong>
					<ul>';
        foreach ($context['post_error']['messages'] as $error) {
            echo '
						<li class="error">', $error, '</li>';
        }
        echo '
					</ul>
				</div>';
    }
    echo '
				<dl id="post_header">';
    // To and bcc. Include a button to search for members.
    echo '
					<dt>
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : '', '>', $txt['pm_to'], ':</span>
					</dt>';
    // Autosuggest will be added by the JavaScript later on.
    echo '
					<dd>
						<input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />';
    // A link to add BCC, only visible with JavaScript enabled.
    echo '
						<span class="smalltext" id="bcc_link_container" style="display: none;"></span>';
    // A div that'll contain the items found by the autosuggest.
    echo '
						<div id="to_item_list_container"></div>';
    echo '
					</dd>';
    // This BCC row will be hidden by default if JavaScript is enabled.
    echo '
					<dt id="bcc_div">
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : '', '>', $txt['pm_bcc'], ':</span>
					</dt>
					<dd id="bcc_div2">
						<input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />
						<div id="bcc_item_list_container"></div>
					</dd>';
    // The subject of the PM.
    echo '
					<dt>
						<span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>', $txt['subject'], ':</span>
					</dt>
					<dd>
						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="40" maxlength="50" />
					</dd>
				</dl>';
    // Showing BBC?
    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>';
    }
    // Show BBC buttons, smileys and textbox.
    echo '
				', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
    // Require an image to be typed to save spamming?
    if ($context['require_verification']) {
        echo '
				<div class="post_verification">
					<strong>', $txt['pm_visual_verification_label'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</div>';
    }
    // Send, Preview, spellcheck buttons.
    echo '
				<p><label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label></p>
				<p id="shortcuts" class="smalltext">
					', $context['browser']['is_firefox'] ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
				</p>
				<p id="post_confirm_strip" class="righttext">
					', template_control_richedit_buttons($context['post_box_name']), '
				</p>
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
				<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
				<input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
				<input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
				<input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
			</div>
			<span class="lowerframe"><span></span></span>
		</div>
	</form>';
    // Show the message you're replying to.
    if ($context['reply']) {
        echo '
	<br />
	<br />
	<div class="cat_bar">
		<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
	</div>
	<div class="title_bar">
		<h3 class="titlebg">
			<span class="floatleft">', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</span>
			<span class="floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span>
		</h3>
	</div>
	<div class="windowbg2">
		<span class="topslice"><span></span></span>
		<div class="content">
			', $context['quoted_message']['body'], '
		</div>
		<span class="botslice"><span></span></span>
	</div>';
    }
    echo '
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/PersonalMessage.js?fin20"></script>
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oPersonalMessageSend = new smf_PersonalMessageSend({
				sSelf: \'oPersonalMessageSend\',
				sSessionId: \'', $context['session_id'], '\',
				sSessionVar: \'', $context['session_var'], '\',
				sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
				sToControlId: \'to_control\',
				aToRecipients: [';
    foreach ($context['recipients']['to'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
    }
    echo '
				],
				aBccRecipients: [';
    foreach ($context['recipients']['bcc'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
    }
    echo '
				],
				sBccControlId: \'bcc_control\',
				sBccDivId: \'bcc_div\',
				sBccDivId2: \'bcc_div2\',
				sBccLinkId: \'bcc_link\',
				sBccLinkContainerId: \'bcc_link_container\',
				bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ',
				sShowBccLinkTemplate: ', JavaScriptEscape('
					<a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=helpadmin;help=pm_bcc" onclick="return reqWin(this.href);">(?)</a>'), '
			});
		';
    echo '
		// ]]></script>';
}
Ejemplo n.º 5
0
/**
 * @name      EosAlpha BBS
 * @copyright 2011 Alex Vie silvercircle(AT)gmail(DOT)com
 *
 * 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.0pre
 */
function template_single_post()
{
    global $context, $settings, $options, $txt, $scripturl, $topic, $modSettings;
    echo '
		<div class="jqmWindow" style="display:none;" id="interpostlink_helper">
		<div class="jqmWindow_container">
		<div class="glass jsconfirm title">', $txt['quick_post_link_title'], '
		</div>
		<div class="flat_container lefttext smalltext">', $txt['quick_post_link_text'], '
		<dl class="common left" style="line-height:24px;">
		<dt><strong>', $txt['quick_post_link_bbcode'], '</strong></dt><dd><input size="78" type="text" id="interpostlink_helper_content" value="" /></dd>
		<dt><strong>', $txt['quick_post_link_full'], '</strong></dt><dd><input size="78" type="text" id="interpostlink_helper_content_full" value="" /></dd>
		</dl>
		</div>
		<div class="centertext smalltext smallpadding"><span class="button default centered" onclick="$(\'#interpostlink_helper\').css(\'position\',\'static\');$(\'#interpostlink_helper\').hide();setDimmed(0);">', $txt['quick_post_link_dismiss'], '</span></div>
		</div>
		</div>
		<div id="share_bar" style="display:none;position:absolute;right:0;white-space:nowrap;width:auto;">
		<div class="bmbar">
		 <span role="button" class="button icon share_this share_fb" data-href="http://www.facebook.com/sharer.php?u=%%uri%%">Share</span>
		 <span role="button" class="button icon share_this share_tw" data-href="http://twitter.com/share?text=%%txt%%&amp;url=%%uri%%">Tweet</span>
		 <span role="button" class="button icon share_this share_digg" data-href="http://digg.com/submit?phase=2&amp;title=%%txt%%&amp;url=%%uri%%">Digg</span>
		 <div class="clear"></div>
       	</div>
       	</div>';
    // Show the anchor for the top and for the first message. If the first message is new, say so.
    echo '
		<a id="top"></a>
		', $context['first_new_message'] ? '<a id="new"></a>' : '';
    // Build the normal button array.
    $normal_buttons = array('reply' => array('test' => 'can_reply', 'text' => 'reply', 'custom' => 'onclick="return oQuickReply.quote(0);" ', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true), 'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']), 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif', 'lang' => true, 'custom' => 'onclick="return Eos_Confirm(\'\', \'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\', $(this).attr(\'href\'));"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.gif', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'), 'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'));
    // Allow adding new buttons easily.
    HookAPI::callHook('integrate_display_buttons', array(&$normal_buttons));
    // Show the topic information - icon, subject, etc.
    echo '
			<div id="forumposts">';
    if ($context['tags_active']) {
        echo '
		<div id="tagstrip"><span id="tags">';
        foreach ($context['topic_tags'] as $i => $tag) {
            echo '<a href="' . $scripturl . '?action=tags;tagid=' . $tag['ID_TAG'] . '">' . $tag['tag'] . '</a>';
            if ($context['can_delete_tags']) {
                echo '<a href="' . $scripturl . '?action=tags;sa=deletetag;tagid=' . $tag['ID'] . '"><span onclick="sendRequest(\'action=xmlhttp;sa=tags;deletetag=1;tagid=' . $tag['ID'] . '\', $(\'#tags\'));return(false);" class="xtag">&nbsp;&nbsp;</span></a>';
            } else {
                echo '&nbsp;&nbsp;';
            }
        }
        echo '</span>';
        if ($context['can_add_tags']) {
            echo '
			&nbsp;<a rel="nofollow" id="addtag" onclick="$(\'#tagform\').remove();sendRequest(\'action=xmlhttp;sa=tags;addtag=1;topic=', $topic, '\', $(\'#addtag\'));return(false);" data-id="', $topic, '" href="' . $scripturl . '?action=tags;sa=addtag;topic=', $topic, '">' . $txt['smftags_addtag'] . '</a>';
        } else {
            echo '&nbsp;';
        }
        echo '
		</div>';
    }
    echo '
		<div class="clear"></div><form data-alt="', $scripturl, '?action=post;msg=%id_msg%;topic=', $context['current_topic'], '.', $context['start'], '" 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();
    // Get all the messages...
    while ($message = $context['get_message']()) {
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        $context['postbit_callbacks']['firstpost']($message);
    }
    echo '
				<input type="hidden" name="goadvanced" value="1" />
				</form>
			</div>
			<a id="lastPost"></a>';
    $context['inline_footer_script'] .= '
	var smf_likelabel = \'' . $txt['like_label'] . '\';
	var smf_unlikelabel = \'' . $txt['unlike_label'] . '\'
	';
    // Show the lower breadcrumbs.
    $remove_url = $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id'];
    $mod_buttons = array('move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'), 'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return Eos_Confirm(\'\',\'' . $txt['are_sure_remove_topic'] . '\',\'' . $remove_url . '\');"', 'url' => $remove_url), 'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']), 'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'));
    // Restore topic. eh?  No monkey business.
    if ($context['can_restore_topic']) {
        $mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
    }
    // Allow adding new mod buttons easily.
    HookAPI::callHook('integrate_mod_buttons', array(&$mod_buttons));
    echo '
		<div id="moderationbuttons">', template_button_strip($mod_buttons, 'right', array('id' => 'moderationbuttons_strip', 'class' => 'plainbuttonlist')), '</div>';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
			<a id="quickreply"></a>
			<div class="clear"></div>
			<div style="display:none;overflow:hidden;" id="quickreplybox">';
        echo '
					<div class="cat_bar">
					 <strong>', $txt['post_reply'], '</strong>&nbsp;&nbsp;<a href="', $scripturl, '?action=helpadmin;help=quickreply_help', '" onclick="return reqWin(this.href);" class="help tinytext">', $txt['post_reply_help'], '</a>
					</div>
					<div class="flat_container mediumpadding">';
        echo '
							<input type="hidden" name="_qr_board" value="', $context['current_board'], '" />
							<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 />';
        }
        if (isset($context['user']['avatar']['image']) && !empty($context['user']['avatar']['image'])) {
            echo '
					<div class="floatleft blue_container smallpadding avatar">', $context['user']['avatar']['image'], '
					</div>';
        }
        echo '
							<div class="quickReplyContent" style="margin-left:150px;">';
        echo $context['is_locked'] ? '<div class="red_container tinytext">' . $txt['quick_reply_warning'] . '</div>' : '', $context['oldTopicError'] ? '<div class="red_container tinytext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</div>' : '', '
						', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
						', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '';
        echo '
								<textarea id="quickReplyMessage" style="width:99%;" rows="18" name="message" tabindex="', $context['tabindex']++, '"></textarea>';
        if ($context['automerge']) {
            echo '
								<input type="checkbox" name="want_automerge" id="want_automerge" checked="checked" value="1" />', $txt['want_automerge'];
        }
        echo '
								</div>
								<div class="righttext 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['go_advanced'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="submit" name="cancel" value="', 'Cancel', '" onclick="return(oQuickReply.cancel());" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />
						</div>
				</div>
				<br>
			</div>';
    }
    theme_linktree();
    // Show the jumpto box, or actually...let Javascript do it.
    echo '
			<div class="plainbox" id="display_jump_to">&nbsp;</div>';
    $context['inline_footer_script'] .= '
	var oQuickReply = new QuickReply({
		bDefaultCollapsed: ' . (!empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true') . ',
		iTopicId: ' . $context['current_topic'] . ',
		iStart: ' . $context['start'] . ',
		sScriptUrl: smf_scripturl,
		sImagesUrl: "' . $settings['images_url'] . '",
		sContainerId: "quickReplyOptions",
		sImageId: "quickReplyExpand",
		sImageCollapsed: "collapse.gif",
		sImageExpanded: "expand.gif",
		iMarkedForMQ: ' . $context['multiquote_posts_count'] . ',
		sJumpAnchor: "quickreplybox",
		bEnabled: ' . (!empty($options['display_quick_reply']) ? 'true' : 'false') . '
	});
	';
    if (!empty($options['display_quick_mod']) && $context['can_remove_post']) {
        $context['inline_footer_script'] .= '
	var oInTopicModeration = new InTopicModeration({
		sSelf: \'oInTopicModeration\',
		sCheckboxContainerMask: \'in_topic_mod_check_\',
		aMessageIds: [\'' . implode('\', \'', $removableMessageIDs) . '\'],
		sSessionId: \'' . $context['session_id'] . '\',
		sSessionVar: \'' . $context['session_var'] . '\',
		sButtonStrip: \'moderationbuttons\',
		sButtonStripDisplay: \'moderationbuttons_strip\',
		bUseImageButton: false,
		bCanRemove: ' . ($context['can_remove_post'] ? 'true' : 'false') . ',
		sRemoveButtonLabel: \'' . $txt['quickmod_delete_selected'] . '\',
		sRemoveButtonImage: \'delete_selected.gif\',
		sRemoveButtonConfirm: \'' . $txt['quickmod_confirm'] . '\',
		bCanRestore: ' . ($context['can_restore_msg'] ? 'true' : 'false') . ',
		sRestoreButtonLabel: \'' . $txt['quick_mod_restore'] . '\',
		sRestoreButtonImage: \'restore_selected.gif\',
		sRestoreButtonConfirm: \'' . $txt['quickmod_confirm'] . '\',
		sFormId: \'quickModForm\'
	});
	';
    }
    $context['inline_footer_script'] .= '
	if (\'XMLHttpRequest\' in window)
	{
		var oQuickModify = new QuickModify({
		sScriptUrl: smf_scripturl,
		bShowModify: ' . ($settings['show_modify'] ? 'true' : 'false') . ',
		iTopicId: ' . $context['current_topic'] . ',
		sTemplateBodyEdit: ' . JavaScriptEscape('
			<div id="quick_edit_body_container">
			<div id="error_box" style="padding: 4px;" class="error"></div>
			<textarea class="editor" name="message" rows="20" style="' . ($context['browser']['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="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
			<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
			<input type="hidden" name="msg" value="%msg_id%" />
			<input type="hidden" style="width: 50%;" name="subject" value="%subject%" size="50" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />
			<div class="righttext">
				<span class="button floatright" onclick="return oQuickModify.goAdvanced(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" />Go Advanced</a></span>
				<span class="button floatright" onclick="return oQuickModify.modifyCancel();" >' . $txt['modify_cancel'] . '</span>
				<span class="button floatright" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s">' . $txt['save'] . '</span>
			</div>
			</div>') . ',
		sTemplateSubjectEdit: ' . JavaScriptEscape('<input type="text" style="width: 50%;" name="subject_edit" value="%subject%" size="50" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />') . ',
		sTemplateBodyNormal: ' . JavaScriptEscape('%body%') . ',
		sTemplateSubjectNormal: ' . JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>') . ',
		sTemplateTopSubject: ' . JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')') . ',
		sErrorBorderStyle: ' . JavaScriptEscape('1px solid red') . '
		});

		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'] . '"
		});
	}
	';
    if (!empty($ignoredMsgs)) {
        $context['inline_footer_script'] .= '';
    }
    $context['inline_footer_script'] .= '
	function getIntralink(e, mid) {
		var tid = ' . $context['current_topic'] . ';
		var _sid = "#subject_" + mid;
		var el = $("#interpostlink_helper");
		el.css("position", "fixed");
		var _content = "[ilink topic=" + tid + " post=" + mid + "]" + $(_sid).html().trim() + "[/ilink]";
		$("#interpostlink_helper_content").val(_content);
		$("#interpostlink_helper_content_full").val(e.attr("href"));
		centerElement(el, -200);
		el.css("z-index", 9999);
		setDimmed(1);
		el.show();
		$("#interpostlink_helper_content").focus();
		$("#interpostlink_helper_content").select();
	}
	$(document).keydown(function(e) {
		if(e.keyCode == 27 && $("#interpostlink_helper").css("display") != "none") {
        	$("#interpostlink_helper").css("position", "static");
        	$("#interpostlink_helper").hide();
			setDimmed(0);
    	}
	});
	var topic_id = ' . $context['current_topic'] . ';
	';
}
function template_adk_contact()
{
    global $txt, $scripturl, $context, $boardurl, $user_info, $adkFolder;
    if (isset($_REQUEST['sended'])) {
        echo '
			<br /><br /><br />
			<div class="information Adk_contact_send_message">
				', $txt['adkmodules_form_sendeded'], '
			</div>
			<script type="text/javascript">
				function redirection(){  
					window.location ="' . $scripturl . '";
				}
				setTimeout ("redirection()", 2000);
			</script>';
    } else {
        echo '
			<br />
			<form method="post" action="' . $scripturl . '?action=contact;sa=send">
				<div class="cat_bar">
					<h3 class="catbg">
						<img alt="', $txt['adkmodules_form_contact'], '" style="vertical-align: middle;" src="' . $adkFolder['images'] . '/contact/postscript.png" /> ', $txt['adkmodules_form_contact'], '
					</h3>
				</div>
				<span class="clear upperframe"><span>&nbsp;</span></span>
				<div class="roundframe">
					<div>
						<dl id="post_header">';
        if (!$context['user']['is_guest']) {
            echo '
							<dt><input type="hidden" name="name" value="', $user_info['name'], '" /></dt>
							<dd><input type="hidden" name="email" value="', $user_info['email'], '" /></dd>';
        }
        echo '					
							<dt>
								<img alt="" src="' . $adkFolder['images'] . '/contact/agt.png" />&nbsp;', $txt['subject'], '
							</dt>
							<dd>
								<input type="text" name="subject" value="" size="80" maxlength="80" class="input_text" />
							</dd>';
        if ($context['user']['is_guest']) {
            echo '
							<dt>
								<img alt="" src="' . $adkFolder['images'] . '/contact/user_suit.png" />&nbsp;', $txt['adkmodules_name'], '
							</dt>
							<dd>
								<input type="text" name="name" value="" size="80" maxlength="80" class="input_text" />
							</dd>
							<dt>
								<img alt="" src="' . $adkFolder['images'] . '/postscript.png" />&nbsp;', $txt['adkmodules_email'], '
							</dt>
							<dd>
								<input type="text" name="email" value="" size="80" maxlength="80" class="input_text" />
							</dd>';
        }
        echo '
							<dt>
								<img alt="" src="' . $adkFolder['images'] . '/contact/users.png" />&nbsp;', $txt['adkmodules_form_select_admin'], '
							</dt>
							<dd>
								<select name="admin">
									<option value="0">', $txt['adkmodules_form_send_all'], '</option>';
        foreach ($context['members_admin'] as $id_member => $name) {
            echo '
									<option value="', $id_member, '">', $name, '</option>';
        }
        echo '
								</select>&nbsp;', help_link('', 'adkhelp_form_select_admin', false), '
							</dd>
						</dl>
						<div class="Adk_contact">
							<table style="width:100%">
								<tr>
									<td class="ae_center" colspan="2">
										<div class="ae_desc">' . $txt['adkmodules_form_send_content'] . '</div>
										<textarea cols="600" rows="10" id="descript" name="descript" style="height:160px; width: 855px;"></textarea>
										<br />
									</td>
								</tr>
							</table>
						</div>
						<div id="form_contact" class="post_verification">
							', template_control_verification($context['visual_verification_id'], 'all'), '
						</div>
						<br />
						<div align="center">
							<input type="submit" value="', $txt['save'], '" class="button_submit" />
							<input type="hidden" name="sc" value="', $context['session_id'], '" />
						</div>
					</div>
				</div>
				<span class="lowerframe"><span>&nbsp;</span></span>
			</form>';
    }
}
Ejemplo n.º 7
0
function template_send()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    // Show which messages were sent successfully and which failed.
    if (!empty($context['send_log'])) {
        echo '
			<div class="cat_bar">
				<h3 class="catbg">', $txt['pm_send_report'], '</h3>
			</div>
			<div class="windowbg">
				<div class="content">';
        if (!empty($context['send_log']['sent'])) {
            foreach ($context['send_log']['sent'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        if (!empty($context['send_log']['failed'])) {
            foreach ($context['send_log']['failed'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        echo '
				</div>
			</div>
			<br />';
    }
    // Show the preview of the personal message.
    echo '
		<div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
			<div class="cat_bar">
				<h3 class="catbg">
					<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
				</h3>
			</div>
			<div class="windowbg">
				<div class="content">
					<div class="post" id="preview_body">
						', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
					</div>
				</div>
			</div>
		</div>';
    // Main message editing box.
    echo '
		<div class="cat_bar">
			<h3 class="catbg">
					<img src="', $settings['images_url'], '/icons/im_newmsg.png" class="icon" alt="', $txt['new_message'], '" title="', $txt['new_message'], '" />&nbsp;', $txt['new_message'], '
			</h3>
		</div>';
    echo '
	<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
		<div>
			<div class="roundframe">
				<br class="clear" />';
    // If there were errors for sending the PM, show them.
    echo '
				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
					<dl>
						<dt>
							<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
						</dt>
						<dd class="error" id="error_list">
							', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
						</dd>
					</dl>
				</div>';
    if (!empty($modSettings['drafts_pm_enabled'])) {
        echo '
				<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
				</div>';
    }
    echo '
				<dl id="post_header">';
    // To and bcc. Include a button to search for members.
    echo '
					<dt>
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : '', ' id="caption_to">', $txt['pm_to'], ':</span>
					</dt>';
    // Autosuggest will be added by the JavaScript later on.
    echo '
					<dd id="pm_to" class="clear_right">
						<input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />';
    // A link to add BCC, only visible with JavaScript enabled.
    echo '
						<span class="smalltext" id="bcc_link_container" style="display: none;"></span>';
    // A div that'll contain the items found by the autosuggest.
    echo '
						<div id="to_item_list_container"></div>';
    echo '
					</dd>';
    // This BCC row will be hidden by default if JavaScript is enabled.
    echo '
					<dt  class="clear_left" id="bcc_div">
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : '', ' id="caption_bbc">', $txt['pm_bcc'], ':</span>
					</dt>
					<dd id="bcc_div2">
						<input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />
						<div id="bcc_item_list_container"></div>
					</dd>';
    // The subject of the PM.
    echo '
					<dt class="clear_left">
						<span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
					</dt>
					<dd id="pm_subject">
						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
					</dd>
				</dl><hr class="clear" />';
    // Showing BBC?
    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>';
    }
    // Show BBC buttons, smileys and textbox.
    echo '
				', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
    // Require an image to be typed to save spamming?
    if ($context['require_verification']) {
        echo '
				<div class="post_verification">
					<strong>', $txt['pm_visual_verification_label'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</div>';
    }
    // Send, Preview, spellcheck buttons.
    echo '
				<p>
					<label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label>
				</p>
				<hr class="hrcolor" />
				<span id="post_confirm_strip" class="righttext">
					', template_control_richedit_buttons($context['post_box_name']), '
				</span>
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
				<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
				<input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
				<input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
				<input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
				<br class="clear_right" />
			</div>
		</div>
	</form>';
    // If the admin enabled the pm drafts feature, show a draft selection box
    if (!empty($modSettings['drafts_enabled']) && !empty($context['drafts_pm_save']) && !empty($context['drafts']) && !empty($options['drafts_show_saved_enabled'])) {
        echo '
			<br />
			<div id="postDraftOptionsHeader" class="title_bar">
				<h4 class="titlebg">
					<img id="postDraftExpand" class="panel_toggle" style="display: none;" src="', $settings['images_url'], '/collapse.png" alt="-" /> <strong><a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a></strong>
				</h4>
			</div>
			<div id="postDraftOptions" class="load_drafts padding">
				<dl class="settings">
					<dt><strong>', $txt['subject'], '</strong></dt>
					<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
        foreach ($context['drafts'] as $draft) {
            echo '
					<dt>', $draft['link'], '</dt>
					<dd>', $draft['poster_time'], '</dd>';
        }
        echo '
				</dl>
			</div>';
    }
    // The vars used to preview a personal message without loading a new page.
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			var post_box_name = "', $context['post_box_name'], '";
			var form_name = "postmodify";
			var preview_area = "pm";
			var txt_preview_title = "', $txt['preview_title'], '";
			var txt_preview_fetch = "', $txt['preview_fetch'], '";';
    // Code for showing and hiding drafts
    if (!empty($context['drafts'])) {
        echo '
			var oSwapDraftOptions = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: true,
				aSwappableContainers: [
					\'postDraftOptions\',
				],
				aSwapImages: [
					{
						sId: \'postDraftExpand\',
						srcExpanded: smf_images_url + \'/collapse.png\',
						altExpanded: \'-\',
						srcCollapsed: smf_images_url + \'/expand.png\',
						altCollapsed: \'+\'
					}
				],
				aSwapLinks: [
					{
						sId: \'postDraftExpandLink\',
						msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ',
						msgCollapsed: ', JavaScriptEscape($txt['draft_load']), '
					}
				]
			});';
    }
    echo '
		// ]]></script>';
    // Show the message you're replying to.
    if ($context['reply']) {
        echo '
	<br />
	<br />
	<div class="cat_bar">
		<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
	</div>
	<div class="windowbg2">
		<div class="content">
			<div class="clear">
				<span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span>
				<strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong>
			</div>
			<hr />
			', $context['quoted_message']['body'], '
		</div>
	</div><br class="clear" />';
    }
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			var oPersonalMessageSend = new smf_PersonalMessageSend({
				sSelf: \'oPersonalMessageSend\',
				sSessionId: smf_session_id,
				sSessionVar: smf_session_var,
				sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
				sToControlId: \'to_control\',
				aToRecipients: [';
    foreach ($context['recipients']['to'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
    }
    echo '
				],
				aBccRecipients: [';
    foreach ($context['recipients']['bcc'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
    }
    echo '
				],
				sBccControlId: \'bcc_control\',
				sBccDivId: \'bcc_div\',
				sBccDivId2: \'bcc_div2\',
				sBccLinkId: \'bcc_link\',
				sBccLinkContainerId: \'bcc_link_container\',
				bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ',
				sShowBccLinkTemplate: ', JavaScriptEscape('
					<a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=quickhelp;help=pm_bcc" onclick="return reqOverlayDiv(this.href);">(?)</a>'), '
			});
		';
    echo '
		// ]]></script>';
}
Ejemplo n.º 8
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2012 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 Alpha 1
 */
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 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="', $context['character_set'], '">';
            // 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 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>(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')</span>
						<span class="nextlinks floatright">', $context['previous_next'], '</span>
					</h3>
				</div>';
    echo '
				<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" 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.
        if ($message['id'] != $context['first_message']) {
            echo '
				<a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
        }
        echo '
				<div class="', $message['approved'] ? $message['alternate'] == 0 ? 'windowbg' : 'windowbg2' : 'approvebg', '">
					<div class="post_wrapper">';
        // Show information about the poster of this message.
        echo '
						<div class="poster">
							<ul class="dropmenu">
								<li>
									<h4>';
        // Show a link to the member's profile.
        echo '
										<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">
											<span style="padding: 6px; display: block;">', $message['member']['name'], '</span>';
        // Show avatars, images, etc.?
        if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
            echo '

											', $message['member']['avatar']['image'], '';
        }
        echo '
										</a>
									</h4>';
        // [WIP] The new member info dropdown starts here. Note that conditionals have not been fully checked yet.
        echo '
									<ul class="smalltext" id="msg_', $message['id'], '_extra_info"', $ignoring ? ' style="display:none;"' : '', '>';
        // Don't show these things for guests.
        if (!$message['member']['is_guest']) {
            // 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.
            if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') {
                echo '
										<li class="postgroup">', $message['member']['post_group'], '</li>';
            }
            // Show how many posts they have made.
            if (!isset($context['disabled_fields']['posts'])) {
                echo '
										<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
            }
            // Is karma display enabled?  Total or +/-?
            if ($modSettings['karmaMode'] == '1') {
                echo '
										<li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
            } elseif ($modSettings['karmaMode'] == '2') {
                echo '
										<li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';
            }
            // Is this user allowed to modify this member's karma?
            if ($message['member']['karma']['allow']) {
                echo '
										<li class="karma_allow">
											<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
											<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
										</li>';
            }
            // Show the member's gender icon?
            if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender'])) {
                echo '
										<li class="gender">', $txt['gender'], ': ', $message['member']['gender']['image'], '</li>';
            }
            // Show their personal text?
            if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '') {
                echo '
										<li class="blurb">', $message['member']['blurb'], '</li>';
            }
            // Any custom fields to show as icons?
            if (!empty($message['member']['custom_fields'])) {
                $shown = false;
                foreach ($message['member']['custom_fields'] as $custom) {
                    if ($custom['placement'] != 1 || empty($custom['value'])) {
                        continue;
                    }
                    if (empty($shown)) {
                        $shown = true;
                        echo '
										<li class="im_icons">
											<ol>';
                    }
                    echo '
												<li>', $custom['value'], '</li>';
                }
                if ($shown) {
                    echo '
											</ol>
										</li>';
                }
            }
            // This shows the popular messaging icons.
            if ($message['member']['has_messenger'] && $message['member']['can_view_profile']) {
                echo '
										<li class="im_icons">
											<hr />
											<ol>
												', !empty($message['member']['icq']['link']) ? '<li>' . $message['member']['icq']['link'] . '</li>' : '', '
												', !empty($message['member']['msn']['link']) ? '<li>' . $message['member']['msn']['link'] . '</li>' : '', '
												', !empty($message['member']['aim']['link']) ? '<li>' . $message['member']['aim']['link'] . '</li>' : '', '
												', !empty($message['member']['yim']['link']) ? '<li>' . $message['member']['yim']['link'] . '</li>' : '', '
											</ol>
										</li>';
            }
            // Show the website and email address buttons.
            if ($message['member']['show_profile_buttons']) {
                echo '
										<li class="profile">
											<ol>';
                // Don't show an icon if they haven't specified a website.
                if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) {
                    echo '
												<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.png" alt="' . $message['member']['website']['title'] . '" />' : $txt['www'], '</a></li>';
                }
                // Don't show the email address if they want it hidden.
                if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email']) {
                    echo '
												<li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email'], '</a></li>';
                }
                echo '
											</ol>
										</li>';
            }
            // Any custom fields for standard placement?
            if (!empty($message['member']['custom_fields'])) {
                foreach ($message['member']['custom_fields'] as $custom) {
                    if (empty($custom['placement']) || empty($custom['value'])) {
                        echo '
										<li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';
                    }
                }
            }
        } elseif (!empty($message['member']['email']) && in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $context['can_send_email']) {
            echo '
										<li class="email"><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email'], '</a></li>';
        }
        // Stuff for the staff to wallop them with.
        // Maybe they want to report this post to the moderator(s)?
        if ($context['can_report_moderator']) {
            echo '
										<li class="report_link"><hr /><a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a></li>';
        }
        // Can we issue a warning because of this post?  Remember, we can't give guests warnings.
        if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
            echo '
										<li class="issue_warning"><a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><img src="', $settings['images_url'], '/warn.png" alt="', $txt['issue_warning_post'], '" title="', $txt['issue_warning_post'], '" /></a></li>';
        }
        //echo '
        //						<img class="centericon" src="', $settings['images_url'], '/ip.png" alt="" />';
        // Show the IP to this user for this post - because you can moderate?
        if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) {
            echo '
										<li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>';
        } elseif ($message['can_see_ip']) {
            echo '
										<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>';
        } elseif (!$context['user']['is_guest']) {
            echo '
										<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>';
        } else {
            echo '
										<li class="poster_ip">', $txt['logged'], '</li>';
        }
        // Done with the information about the poster... on to the post itself.
        echo '
									</ul>
								</li>';
        // Show the post group icons, but not for guests.
        if (!$message['member']['is_guest']) {
            echo '
								<li class="icons">', $message['member']['group_icons'], '</li>';
        }
        // Show the member's primary group (like 'Administrator') if they have one.
        if (!empty($message['member']['group'])) {
            echo '
								<li class="membergroup">', $message['member']['group'], '</li>';
        }
        // Show the member's custom title, if they have one.
        if (!empty($message['member']['title'])) {
            echo '
								<li class="title">', $message['member']['title'], '</li>';
        }
        // Show online and offline buttons? PHP could do with a little bit of cleaning up here for brevity, but it works.
        // The plan is to make these buttons act sensibly, and link to your own inbox in your own posts (with new PM notification).
        // Still has a little bit of hard-coded text. This may be a place where translators should be able to write inclusive strings,
        // instead of dealing with $txt['by'] etc in the markup. Must be brief to work, anyway. Cannot ramble on at all.
        if ($context['can_send_pm'] && $message['is_message_author']) {
            echo '
								<li class="poster_online"><a href="', $scripturl, '?action=pm">', $txt['pm_short'], ' ', $context['user']['unread_messages'] > 0 ? '[<strong>' . $context['user']['unread_messages'] . '</strong>]' : '', '</a></li>';
        }
        if ($context['can_send_pm'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
            if (!empty($modSettings['onlineEnable'])) {
                echo '
								<li class="poster_online"><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $message['member']['name'] . ' is online' : $message['member']['name'] . ' is offline', '">', $txt['send_message'], ' <img src="' . $message['member']['online']['image_href'] . '" alt="" /></a></li>';
            } else {
                echo '
								<li class="poster_online"><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '">', $txt['send_message'], '</a></li>';
            }
        }
        if (!$context['can_send_pm'] && !empty($modSettings['onlineEnable'])) {
            echo '
								<li class="poster_online">', $message['member']['online']['is_online'] ? $txt['online'] : $txt['offline'], '<img src="' . $message['member']['online']['image_href'] . '" alt="" /></li>';
        }
        // Are we showing the warning status?
        // Don't show these things for guests.
        if (!$message['member']['is_guest'] && $message['member']['can_see_warning']) {
            echo '
								<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<img src="', $settings['images_url'], '/warning_', $message['member']['warning_status'], '.png" alt="', $txt['user_warn_' . $message['member']['warning_status']], '" />', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
        }
        echo '
							</ul>';
        echo '
						</div>
						<div class="postarea">
							<div class="keyinfo">
								<div class="messageicon" ', $message['icon_url'] !== $settings['images_url'] . '/post/xx.png' ? '' : 'style="position: absolute; z-index: -1;"', '>
									<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
								</div>
								<h5 id="subject_', $message['id'], '">
									<a href="', $message['href'], '" rel="nofollow" title="', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' - ', $message['subject'], '">', $message['time'], '</a>';
        // Show "<< Last Edit: Time by Person >>" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name'])) {
            echo '
									<span class="smalltext modified" id="modified_', $message['id'], '">
										', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '
									</span>';
        }
        echo '
								</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="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '"/>';
                    }
                    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 />' . $txt['attach_viewed'] : '<br />' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '
										</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>';
        }
        echo '
						</div>';
        // Show the quickbuttons, for various operations on posts.
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
						<ul class="quickbuttons">';
        }
        // 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>';
        }
        // Can they reply? Have they turned on quick reply?
        if ($context['can_quote'] && !empty($options['display_quick_reply'])) {
            echo '
							<li><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></li>';
        } elseif ($context['can_quote']) {
            echo '
							<li><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></li>';
        }
        // Can the user modify the contents of this post?  Show the modify inline image.
        if ($message['can_modify']) {
            echo '
							<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'], '" style="cursor: pointer; display: none; margin: 0 0 0 0;" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')" />', $txt['quick_edit'], '</li>';
        }
        // Can the user modify the contents of this post?
        if ($message['can_modify']) {
            echo '
							<li class="post_options">', $txt['post_options'], '';
        }
        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 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>';
        }
        echo '
								</ul>
							</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>';
        }
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
						</ul>';
        }
        echo '
						<div class="moderatorbar">';
        // 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 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="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
							<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 />';
        }
        if ($options['display_quick_reply'] < 3) {
            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 type="text/javascript"><!-- // --><![CDATA[
								function insertQuoteFast(messageid)
								{
									if (window.XMLHttpRequest)
										getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
									else
										reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
									return false;
								}
								function onDocReceived(XMLDoc)
								{
									var text = \'\';
									for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
										text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
									oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);

									ajax_indicator(false);
								}
							// ]]></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\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        if ($context['drafts_save'] && !empty($options['drafts_show_saved_enabled'])) {
            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" />';
    }
    if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
        echo '
			<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/drafts.js?alp21"></script>
			<script type="text/javascript"><!-- // --><![CDATA[
				var oDraftAutoSave = new smf_DraftAutoSave({
					sSelf: \'oDraftAutoSave\',
					sLastNote: \'draft_lastautosave\',
					sLastID: \'id_draft\',', !empty($context['post_box_name']) ? '
					sSceditorID: \'' . $context['post_box_name'] . '\',' : '', '
					sType: \'', !empty($options['display_quick_reply']) && $options['display_quick_reply'] > 2 ? 'quick' : 'quick', '\',
					iBoard: ', empty($context['current_board']) ? 0 : $context['current_board'], ',
					iFreq: ', empty($modSettings['masterAutoSaveDraftsDelay']) ? 60000 : $modSettings['masterAutoSaveDraftsDelay'] * 1000, '
				});
			// ]]></script>';
    }
    if ($context['show_spellchecking']) {
        echo '
			<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>
				<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>';
    }
    echo '
				<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/topic.js"></script>
				<script type="text/javascript"><!-- // --><![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['display_quick_reply']) && $options['display_quick_reply'] > 2 ? '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 '
					$(".quick_edit").css("display", "inline");
					if (\'XMLHttpRequest\' in window)
					{
						var oQuickModify = new QuickModify({
							sScriptUrl: smf_scripturl,
							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" style="padding: 4px;" class="error"></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>'), ',
							sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
							sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
							sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
							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,
							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>';
}
Ejemplo n.º 9
0
function template_registration_form()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;
    echo '
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/register.js"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			function verifyAgree()
			{
				if (currentAuthMethod == \'passwd\' && document.forms.registration.smf_autov_pwmain.value != document.forms.registration.smf_autov_pwverify.value)
				{
					alert("', $txt['register_passwords_differ_js'], '");
					return false;
				}

				return true;
			}

			var currentAuthMethod = \'passwd\';
		// ]]></script>';
    // Any errors?
    if (!empty($context['registration_errors'])) {
        echo '
		<div class="errorbox">
			<span>', $txt['registration_errors_occurred'], '</span>
			<ul class="reset">';
        // Cycle through each error and display an error message.
        foreach ($context['registration_errors'] as $error) {
            echo '
				<li>', $error, '</li>';
        }
        echo '
			</ul>
		</div>';
    }
    echo '
		<form action="', $scripturl, '?action=register2" method="post" accept-charset="', $context['character_set'], '" name="registration" id="registration" onsubmit="return verifyAgree();">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['registration_form'], '</h3>
			</div>
			<div class="title_bar">
				<h4 class="titlebg">', $txt['required_info'], '</h4>
			</div>
			<div class="windowbg2">
				<fieldset class="content">
					<dl class="register_form">
						<dt><strong><label for="smf_autov_username">', $txt['username'], ':</label></strong></dt>
						<dd>
							<input type="text" name="user" id="smf_autov_username" size="30" tabindex="', $context['tabindex']++, '" maxlength="25" value="', isset($context['username']) ? $context['username'] : '', '" class="input_text" />
							<span id="smf_autov_username_div" style="display: none;">
								<a id="smf_autov_username_link" href="#">
									<img id="smf_autov_username_img" src="', $settings['images_url'], '/icons/field_check.png" alt="*" />
								</a>
							</span>
						</dd>
						<dt><strong><label for="smf_autov_reserve1">', $txt['user_email_address'], ':</label></strong></dt>
						<dd>
							<input type="text" name="email" id="smf_autov_reserve1" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['email']) ? $context['email'] : '', '" class="input_text" />
						</dd>
						<dt><strong><label for="allow_email">', $txt['allow_user_email'], ':</label></strong></dt>
						<dd>
							<input type="checkbox" name="allow_email" id="allow_email" tabindex="', $context['tabindex']++, '" class="input_check" />
						</dd>
					</dl>';
    // If OpenID is enabled, give the user a choice between password and OpenID.
    if (!empty($modSettings['enableOpenID'])) {
        echo '
					<dl class="register_form" id="authentication_group">
						<dt>
							<strong>', $txt['authenticate_label'], ':</strong>
							<a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a>
						</dt>
						<dd>
							<label for="auth_pass" id="option_auth_pass">
								<input type="radio" name="authenticate" value="passwd" id="auth_pass" tabindex="', $context['tabindex']++, '" ', empty($context['openid']) ? 'checked="checked" ' : '', ' onclick="updateAuthMethod();" class="input_radio" />
								', $txt['authenticate_password'], '
							</label>
							<label for="auth_openid" id="option_auth_openid">
								<input type="radio" name="authenticate" value="openid" id="auth_openid" tabindex="', $context['tabindex']++, '" ', !empty($context['openid']) ? 'checked="checked" ' : '', ' onclick="updateAuthMethod();" class="input_radio" />
								', $txt['authenticate_openid'], '
							</label>
						</dd>
					</dl>';
    }
    echo '
					<dl class="register_form" id="password1_group">
						<dt><strong><label for="smf_autov_pwmain">', ucwords($txt['choose_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
							<span id="smf_autov_pwmain_div" style="display: none;">
								<img id="smf_autov_pwmain_img" src="', $settings['images_url'], '/icons/field_invalid.png" alt="*" />
							</span>
						</dd>
					</dl>
					<dl class="register_form" id="password2_group">
						<dt><strong><label for="smf_autov_pwverify">', ucwords($txt['verify_pass']), ':</label></strong></dt>
						<dd>
							<input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
							<span id="smf_autov_pwverify_div" style="display: none;">
								<img id="smf_autov_pwverify_img" src="', $settings['images_url'], '/icons/field_valid.png" alt="*" />
							</span>
						</dd>
					</dl>';
    // If OpenID is enabled, give the user a choice between password and OpenID.
    if (!empty($modSettings['enableOpenID'])) {
        echo '

					<dl class="register_form" id="openid_group">
						<dt><strong>', $txt['authenticate_openid_url'], ':</strong></dt>
						<dd>
							<input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', isset($context['openid']) ? $context['openid'] : '', '" class="input_text openid_login" />
						</dd>
					</dl>';
    }
    // If there is any field marked as required, show it here!
    if (!empty($context['custom_fields_required']) && !empty($context['custom_fields'])) {
        echo '

					<dl class="register_form">';
        foreach ($context['custom_fields'] as $field) {
            if ($field['show_reg'] > 1) {
                echo '
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
							<span class="smalltext">', $field['desc'], '</span>
						</dt>
						<dd>', preg_replace_callback('~<(input|select|textarea) ~', create_function('$matches', '
							global $context;
							return \'<\' . $matches[1] . \' tabindex="\' . $context[\'tabindex\']++ . \'"\';
						'), $field['input_html']), '</dd>';
            }
        }
        echo '
					</dl>';
    }
    echo '
				</fieldset>
			</div>';
    // If we have either of these, show the extra group.
    if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
        echo '
			<div class="title_bar">
				<h4 class="titlebg">', $txt['additional_information'], '</h4>
			</div>
			<div class="windowbg2">
				<fieldset class="content">
					<dl class="register_form" id="custom_group">';
    }
    if (!empty($context['profile_fields'])) {
        // Any fields we particularly want?
        foreach ($context['profile_fields'] as $key => $field) {
            if ($field['type'] == 'callback') {
                if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) {
                    $callback_func = 'template_profile_' . $field['callback_func'];
                    $callback_func();
                }
            } else {
                echo '
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['label'], ':</strong>';
                // Does it have any subtext to show?
                if (!empty($field['subtext'])) {
                    echo '
							<span class="smalltext">', $field['subtext'], '</span>';
                }
                echo '
						</dt>
						<dd>';
                // Want to put something infront of the box?
                if (!empty($field['preinput'])) {
                    echo '
							', $field['preinput'];
                }
                // What type of data are we showing?
                if ($field['type'] == 'label') {
                    echo '
							', $field['value'];
                } elseif (in_array($field['type'], array('int', 'float', 'text', 'password'))) {
                    echo '
							<input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" tabindex="', $context['tabindex']++, '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
                } elseif ($field['type'] == 'check') {
                    echo '
							<input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" tabindex="', $context['tabindex']++, '" class="input_check" ', $field['input_attr'], ' />';
                } elseif ($field['type'] == 'select') {
                    echo '
							<select name="', $key, '" id="', $key, '" tabindex="', $context['tabindex']++, '">';
                    if (isset($field['options'])) {
                        // Is this some code to generate the options?
                        if (!is_array($field['options'])) {
                            $field['options'] = eval($field['options']);
                        }
                        // Assuming we now have some!
                        if (is_array($field['options'])) {
                            foreach ($field['options'] as $value => $name) {
                                echo '
								<option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
                            }
                        }
                    }
                    echo '
							</select>';
                }
                // Something to end with?
                if (!empty($field['postinput'])) {
                    echo '
							', $field['postinput'];
                }
                echo '
						</dd>';
            }
        }
    }
    // Are there any custom fields?
    if (!empty($context['custom_fields'])) {
        foreach ($context['custom_fields'] as $field) {
            if ($field['show_reg'] < 2) {
                echo '
						<dt>
							<strong', !empty($field['is_error']) ? ' style="color: red;"' : '', '>', $field['name'], ':</strong>
							<span class="smalltext">', $field['desc'], '</span>
						</dt>
						<dd>', $field['input_html'], '</dd>';
            }
        }
    }
    // If we have either of these, close the list like a proper gent.
    if (!empty($context['profile_fields']) || !empty($context['custom_fields'])) {
        echo '
					</dl>
				</fieldset>
			</div>';
    }
    if ($context['visual_verification']) {
        echo '
			<div class="title_bar">
				<h4 class="titlebg">', $txt['verification'], '</h4>
			</div>
			<div class="windowbg2">
				<fieldset class="content centertext">
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</fieldset>
			</div>';
    }
    echo '
			<div id="confirm_buttons flow_auto">';
    // Age restriction in effect?
    if (!$context['require_agreement'] && $context['show_coppa']) {
        echo '
				<input type="submit" name="accept_agreement" value="', $context['coppa_agree_above'], '" class="button_submit" /><br /><br />
				<input type="submit" name="accept_agreement_coppa" value="', $context['coppa_agree_below'], '" class="button_submit" />';
    } else {
        echo '
				<input type="submit" name="regSubmit" value="', $txt['register'], '" tabindex="', $context['tabindex']++, '" class="button_submit" />';
    }
    echo '
			</div>
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			<input type="hidden" name="', $context['register_token_var'], '" value="', $context['register_token'], '" />
			<input type="hidden" name="step" value="2" />
		</form>
		
		<script type="text/javascript"><!-- // --><![CDATA[
			var regTextStrings = {
				"username_valid": "', $txt['registration_username_available'], '",
				"username_invalid": "', $txt['registration_username_unavailable'], '",
				"username_check": "', $txt['registration_username_check'], '",
				"password_short": "', $txt['registration_password_short'], '",
				"password_reserved": "', $txt['registration_password_reserved'], '",
				"password_numbercase": "', $txt['registration_password_numbercase'], '",
				"password_no_match": "', $txt['registration_password_no_match'], '",
				"password_valid": "', $txt['registration_password_valid'], '"
			};
			var verificationHandle = new smfRegister("registration", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
			// Update the authentication status.
			updateAuthMethod();
		// ]]></script>';
}
Ejemplo n.º 10
0
function template_send()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    // Show which messages were sent successfully and which failed.
    if (!empty($context['send_log'])) {
        echo '
			<div class="cat_bar">
				<h3 class="catbg">', $txt['pm_send_report'], '</h3>
			</div>
			<div class="windowbg">
				<div class="content">';
        if (!empty($context['send_log']['sent'])) {
            foreach ($context['send_log']['sent'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        if (!empty($context['send_log']['failed'])) {
            foreach ($context['send_log']['failed'] as $log_entry) {
                echo '<span class="error">', $log_entry, '</span><br />';
            }
        }
        echo '
				</div>
			</div>
			<br />';
    }
    // Show the preview of the personal message.
    echo '
		<div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
			<div class="cat_bar">
				<h3 class="catbg">
					<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
				</h3>
			</div>
			<div class="windowbg">
				<div class="content">
					<div class="post" id="preview_body">
						', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
					</div>
				</div>
			</div>
		</div><br />';
    // Main message editing box.
    echo '
		<div class="cat_bar">
			<h3 class="catbg">
					<img src="', $settings['images_url'], '/icons/im_newmsg.png" class="icon" alt="', $txt['new_message'], '" title="', $txt['new_message'], '" />&nbsp;', $txt['new_message'], '
			</h3>
		</div>';
    echo '
	<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
		<div>
			<div class="roundframe">
				<br class="clear" />';
    // If there were errors for sending the PM, show them.
    echo '
				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
					<dl>
						<dt>
							<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
						</dt>
						<dd class="error" id="error_list">
							', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
						</dd>
					</dl>
				</div>';
    if (!empty($modSettings['drafts_pm_enabled'])) {
        echo '
				<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), '
				</div>';
    }
    echo '
				<dl id="post_header">';
    // To and bcc. Include a button to search for members.
    echo '
					<dt>
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : '', ' id="caption_to">', $txt['pm_to'], ':</span>
					</dt>';
    // Autosuggest will be added by the JavaScript later on.
    echo '
					<dd id="pm_to" class="clear_right">
						<input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />';
    // A link to add BCC, only visible with JavaScript enabled.
    echo '
						<span class="smalltext" id="bcc_link_container" style="display: none;"></span>';
    // A div that'll contain the items found by the autosuggest.
    echo '
						<div id="to_item_list_container"></div>';
    echo '
					</dd>';
    // This BCC row will be hidden by default if JavaScript is enabled.
    echo '
					<dt  class="clear_left" id="bcc_div">
						<span', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : '', ' id="caption_bbc">', $txt['pm_bcc'], ':</span>
					</dt>
					<dd id="bcc_div2">
						<input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />
						<div id="bcc_item_list_container"></div>
					</dd>';
    // The subject of the PM.
    echo '
					<dt class="clear_left">
						<span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
					</dt>
					<dd id="pm_subject">
						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
					</dd>
				</dl><hr class="clear" />';
    // Showing BBC?
    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>';
    }
    // Show BBC buttons, smileys and textbox.
    echo '
				', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
    // Require an image to be typed to save spamming?
    if ($context['require_verification']) {
        echo '
				<div class="post_verification">
					<strong>', $txt['pm_visual_verification_label'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</div>';
    }
    // Send, Preview, spellcheck buttons.
    echo '
				<p>
					<label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['pm_save_outbox'], '</label>
				</p>
				<hr class="hrcolor" />
				<span id="shortcuts" class="smalltext">
					', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
				</span>
				<span id="post_confirm_strip" class="righttext">
					', template_control_richedit_buttons($context['post_box_name']), '
				</span>
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
				<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
				<input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
				<input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
				<input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
				<br class="clear_right" />
			</div>
		</div>
	</form>';
    // If the admin enabled the pm drafts feature, show a draft selection box
    if (!empty($modSettings['drafts_enabled']) && !empty($context['drafts_pm_save']) && !empty($context['drafts']) && !empty($options['drafts_show_saved_enabled'])) {
        echo '
			<br />
			<div id="postDraftOptionsHeader" class="title_bar">
				<h4 class="titlebg">
					<img id="postDraftExpand" class="panel_toggle" style="display: none;" src="', $settings['images_url'], '/collapse.png" alt="-" /> <strong><a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a></strong>
				</h4>
			</div>
			<div id="postDraftOptions" class="load_drafts padding">
				<dl class="settings">
					<dt><strong>', $txt['subject'], '</strong></dt>
					<dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
        foreach ($context['drafts'] as $draft) {
            echo '
					<dt>', $draft['link'], '</dt>
					<dd>', $draft['poster_time'], '</dd>';
        }
        echo '
				</dl>
			</div>';
    }
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[';
    // The functions used to preview a personal message without loading a new page.
    echo '
			var txt_preview_title = "', $txt['preview_title'], '";
			var txt_preview_fetch = "', $txt['preview_fetch'], '";
			function previewPost()
			{';
    if (isBrowser('is_firefox')) {
        echo '
				// Firefox doesn\'t render <marquee> that have been put it using javascript
				if (document.forms.postmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
				{
					return submitThisOnce(document.forms.postmodify);
				}';
    }
    echo '
				if (window.XMLHttpRequest)
				{
					// Opera didn\'t support setRequestHeader() before 8.01.
					// @todo Remove support for old browsers
					if (\'opera\' in window)
					{
						var test = new XMLHttpRequest();
						if (!(\'setRequestHeader\' in test))
							return submitThisOnce(document.forms.postmodify);
					}
					// @todo Currently not sending poll options and option checkboxes.
					var x = new Array();
					var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', \'to\', \'bcc\'];
					var numericFields = [\'recipient_to[]\', \'recipient_bcc[]\'];
					var checkboxFields = [\'outbox\'];

					for (var i = 0, n = textFields.length; i < n; i++)
						if (textFields[i] in document.forms.postmodify)
						{
							// Handle the WYSIWYG editor.
							if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
								x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
							else
								x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
						}
					for (var i = 0, n = numericFields.length; i < n; i++)
						if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]])
							x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
					for (var i = 0, n = checkboxFields.length; i < n; i++)
						if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
							x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value;

					sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=pm;sa=send2;preview;xml\', x.join(\'&\'), onDocSent);

					document.getElementById(\'preview_section\').style.display = \'\';
					setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
					setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);

					return false;
				}
				else
					return submitThisOnce(document.forms.postmodify);
			}
			function onDocSent(XMLDoc)
			{
				if (!XMLDoc)
				{
					document.forms.postmodify.preview.onclick = new function ()
					{
						return true;
					}
					document.forms.postmodify.preview.click();
				}

				// Show the preview section.
				var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
				setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);

				var bodyText = \'\';
				for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
					bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;

				setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
				document.getElementById(\'preview_body\').className = \'post\';

				// Show a list of errors (if any).
				var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
				var errorList = new Array();
				for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
					errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
				document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
				setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));

				// Adjust the color of captions if the given data is erroneous.
				var captions = errors.getElementsByTagName(\'caption\');
				for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
					if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
						document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');

				if (errors.getElementsByTagName(\'post_error\').length == 1)
					document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
				else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
				{
					if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ')
						document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\';
					else
						document.forms.postmodify.', $context['post_box_name'], '.style.border = null;
				}
				location.hash = \'#\' + \'preview_section\';
			}';
    // Code for showing and hiding drafts
    if (!empty($context['drafts'])) {
        echo '
			var oSwapDraftOptions = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: true,
				aSwappableContainers: [
					\'postDraftOptions\',
				],
				aSwapImages: [
					{
						sId: \'postDraftExpand\',
						srcExpanded: smf_images_url + \'/collapse.png\',
						altExpanded: \'-\',
						srcCollapsed: smf_images_url + \'/expand.png\',
						altCollapsed: \'+\'
					}
				],
				aSwapLinks: [
					{
						sId: \'postDraftExpandLink\',
						msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ',
						msgCollapsed: ', JavaScriptEscape($txt['draft_load']), '
					}
				]
			});';
    }
    echo '
		// ]]></script>';
    // Show the message you're replying to.
    if ($context['reply']) {
        echo '
	<br />
	<br />
	<div class="cat_bar">
		<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3>
	</div>
	<div class="windowbg2">
		<div class="content">
			<div class="clear">
				<span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span>
				<strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong>
			</div>
			<hr />
			', $context['quoted_message']['body'], '
		</div>
	</div><br class="clear" />';
    }
    echo '
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/PersonalMessage.js?alp21"></script>
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oPersonalMessageSend = new smf_PersonalMessageSend({
				sSelf: \'oPersonalMessageSend\',
				sSessionId: smf_session_id,
				sSessionVar: smf_session_var,
				sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
				sToControlId: \'to_control\',
				aToRecipients: [';
    foreach ($context['recipients']['to'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['to']) - 1 ? '' : ',';
    }
    echo '
				],
				aBccRecipients: [';
    foreach ($context['recipients']['bcc'] as $i => $member) {
        echo '
					{
						sItemId: ', JavaScriptEscape($member['id']), ',
						sItemName: ', JavaScriptEscape($member['name']), '
					}', $i == count($context['recipients']['bcc']) - 1 ? '' : ',';
    }
    echo '
				],
				sBccControlId: \'bcc_control\',
				sBccDivId: \'bcc_div\',
				sBccDivId2: \'bcc_div2\',
				sBccLinkId: \'bcc_link\',
				sBccLinkContainerId: \'bcc_link_container\',
				bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ',
				sShowBccLinkTemplate: ', JavaScriptEscape('
					<a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=helpadmin;help=pm_bcc" onclick="return reqOverlayDiv(this.href);">(?)</a>'), '
			});
		';
    echo '
		// ]]></script>';
}
Ejemplo n.º 11
0
function my_display()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings, $sourcedir;
    // Let them know, if their report was a success!
    if ($context['report_sent']) {
        echo '
	<div class="information" id="profile_success">
		<strong>', $txt['report_sent'], '</strong>
	</div>';
    }
    // Show the anchor for the top and for the first message. If the first message is new, say so.
    echo '
	<a id="top"></a>
	<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
	<div id="poll">
		<div class="catbg">
			<h3>', $txt['poll'], '</h3>
			<p class="subtitle">', $context['poll']['question'], '</p>
		</div>
		<div class="windowbg">	';
        // Are they not allowed to vote but allowed to view the options?
        if ($context['poll']['show_results'] || !$context['allow_vote']) {
            // Show each option with its corresponding percentage bar.
            foreach ($context['poll']['options'] as $option) {
                echo '
			<div class="bwgrid">
				<div class="bwcell4 right_align">
					<span class="smalltext">', $option['option'], '</span>
				</div>
				<div class="bwcell8">';
                if ($context['allow_poll_view']) {
                    echo '
					<div class="statsbar', $option['voted_this'] ? ' myvote' : '', '"><div style="width: ', $option['percent'], '%;"></div></div>';
                }
                echo '
				</div>
				<div class="bwcell4">';
                if ($context['allow_poll_view']) {
                    echo '
					<span class="smalltext">', $option['votes'], ' (', $option['percent'], '%)</span>';
                }
                echo '
				</div>
			</div>';
            }
            if ($context['allow_poll_view']) {
                echo '<hr>
			<p>', $txt['poll_total_voters'], ' <span class="dark_notice wide_notice" style="margin-top: -5px;">', $context['poll']['total_votes'], '</span</p>';
            }
        } else {
            echo '
			<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '">';
            // 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="nolist">';
            // 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>
				<hr>
				<input type="submit" value="', $txt['poll_vote'], '" class="button_submit" />
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			</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 id="pollmoderation" class="themepadding">';
        // Build the poll moderation button array.
        $poll_buttons = array('vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']), 'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'), 'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.gif', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'lock' => array('test' => 'allow_lock_poll', 'text' => !$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock', 'image' => 'poll_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']), 'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']));
        template_button_strip($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">', $txt['calendar_linked_events'], '</h3>
		</div>
		<div class="windowbg">
			<ul class="nolist">';
        foreach ($context['linked_calendar_events'] as $event) {
            echo '
				<li>
					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '"> <span class="icon-calendar" title="' . $txt['modify'] . '"></span></a> ' : '', '<strong>', $event['title'], '</strong>: ', $event['start_date'], $event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '', '
				</li>';
        }
        echo '
			</ul>
		</div>
	</div>';
    }
    // Build the normal button array.
    $normal_buttons = array('reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true), 'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']), 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.gif', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'), 'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'));
    // Allow adding new buttons easily.
    call_integration_hook('integrate_display_buttons', array(&$normal_buttons));
    // Show the page index... "Pages: [1]".
    echo '
	<div class="pagesection themepadding">
		<div class="bwgrid">
			<div class="bwcell4">
				<div class="pagelinks">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
				<div class="clear floatleft">', $context['previous_next'], '</div>
			</div>
			<div class="bwcell12">
				', template_button_strip($normal_buttons, 'right'), '
			</div>
		</div>
	</div>';
    // Show the topic information - icon, subject, etc.
    echo '
	<div class="catbg">
		<h3 id="top_subject">', $context['subject'], ' <span class="dark_notice wide_notice">', $context['num_views'], '</span></h3>
	</div>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
	<div id="whoisviewing" class="themepadding">';
        // 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'], '
	</div><hr>';
    }
    echo '
	<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" class="themepadding" 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.
        if ($message['id'] != $context['first_message']) {
            echo '
		<a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
        }
        echo '
		<div id="avvy_extra' . $message['id'] . '" class="avvy_closed" style="overflow: hidden; clear: both;">', template_poster_extra($message), '</div>
		<div class="bwgrid">
			<div class="bwcell2 center_align">
				<h4 class="largetext">', $message['member']['link'];
        // Show online and offline buttons?
        if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) {
            echo '
					', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', '<span class="', $message['member']['online']['is_online'] ? 'onoff_on' : 'onoff_off', '" style="position: absolute;" title="', $message['member']['online']['text'], '"></span>', $context['can_send_pm'] ? '</a>' : '';
        }
        echo '</h4>';
        // Show avatars, images, etc.?
        if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
            echo '
				<span onclick="showExtra(\'avvy_extra' . $message['id'] . '\');" class="roundavatar_full" style="cursor: pointer;"><img src="', $message['member']['avatar']['url'], '" alt="" /></span>';
        } else {
            echo '
				<span onclick="showExtra(\'avvy_extra' . $message['id'] . '\');"  class="roundavatar_full" style="cursor: pointer;"><img src="', $settings['images_url'], '/guest.png" alt="" /></span>';
        }
        // Are we showing the warning status?
        if ($message['member']['can_see_warning']) {
            echo '
				<div class="plainbox">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<img src="', $settings['images_url'], '/warning_', $message['member']['warning_status'], '.gif" alt="', $txt['user_warn_' . $message['member']['warning_status']], '" />', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></div>';
        }
        // Done with the information about the poster... on to the post itself.
        echo '
			</div>
			<div class="bwcell14">
				<div class="post_container">
					<div class="floatright">
						<div class="mess_icons_hit">
							<a href="', $scripturl, '?action=post;msg=' . $message['id'] . ';topic=' . $context['current_topic'] . '#icon">
								<img src="', $settings['images_url'], '/post/', $message['icon'] . '.png" id="messHit' . $message['id'] . '" alt="" />
							</a>
						</div>
					</div>
					<div class="post_top">
						<a href="', $message['href'], '" class="largetext" rel="nofollow"  id="subject_', $message['id'], '">', $message['subject'], '</a>
						<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>';
        // Ignoring this user? Hide the post.
        if ($ignoring) {
            echo '
						<div id="msg_', $message['id'], '_ignored_prompt" class="plainbox">
							', $txt['ignoring_user'], '
							<a href="#" id="msg_', $message['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
						</div>';
        }
        echo '
					</div>
					<div class="post" style="overflow: auto;">';
        if (!$message['approved'] && $message['member']['id'] != 0 && $message['member']['id'] == $context['user']['id']) {
            echo '
						<div class="plainbox">', $txt['post_awaiting_approval'], '</div>';
        }
        echo '
						<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>
					</div>';
        // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
					<ul class="horiz_list quickbuttons">';
        }
        // Maybe we can approve it, maybe we should?
        if ($message['can_approve']) {
            echo '
						<li class="approve_button"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a></li>';
        }
        // Can they reply? Have they turned on quick reply?
        if ($context['can_quote'] && !empty($options['display_quick_reply'])) {
            echo '
						<li class="quote_button"><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'], ');">', $txt['quote'], '</a></li>';
        } elseif ($context['can_quote']) {
            echo '
						<li class="quote_button"><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '">', $txt['quote'], '</a></li>';
        }
        // Can the user modify the contents of this post?
        if ($message['can_modify']) {
            echo '
						<li class="modify_button"><a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '">', $txt['modify'], '</a></li>';
        }
        // How about... even... remove it entirely?!
        if ($message['can_remove']) {
            echo '
						<li class="remove_button"><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'], '?\');">', $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 class="split_button"><a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '">', $txt['split'], '</a></li>';
        }
        // Can we restore topics?
        if ($context['can_restore_msg']) {
            echo '
						<li class="restore_button"><a href="', $scripturl, '?action=restoretopic;msgs=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['restore_message'], '</a></li>';
        }
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
					</ul>';
        }
        // Can the user modify the contents of this post?  Show the modify inline image.
        if ($message['can_modify']) {
            echo '
					<img class="floatright" src="', $settings['images_url'], '/pencil.png" id="modify_button_', $message['id'], '" style="cursor: pointer; width: 20px;" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')">';
        }
        // Show a checkbox for quick moderation?
        if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
            echo '
					&nbsp;| <span class="inline_mod_check" style="display: none;position: absolute; margin: 2px 0 0 1rem; " id="in_topic_mod_check_', $message['id'], '"></span>';
        }
        // Assuming there are attachments...
        if (!empty($message['attachment'])) {
            echo '
					<div id="msg_', $message['id'], '_footer" class="post smalltext wpost">
						<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';
            $last_approved_state = 1;
            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>';
                }
                $ext = substr($attachment['name'], strlen($attachment['name']) - 3, 3);
                if ($attachment['is_image']) {
                    if ($attachment['thumbnail']['has_thumb']) {
                        echo '
								<a href="#att', $attachment['id'], '" class="bwcell33" style="float: left; display: block; overflow: hidden;margin-bottom: 1px;height: 200px;">
									<span class="smalltext narrowcaps">', $attachment['size'], $attachment['is_image'] ? '<br>' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' | ' : '', $attachment['downloads'] . ' ' . $txt['downloads'] . '</span> 
									<img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" />
								</a>
								<a href="#_" id="att', $attachment['id'], '" class="lightbox2"><span>x</span><img src="', $attachment['href'], '" style="max-width: 100%;max-height: 100%;"></a>';
                    } else {
                        echo '
								<span class="bwcell33" style="float: left; display: block; overflow: hidden;margin-bottom: 1px;height: 200px;">
									<span class="smalltext narrowcaps">', $attachment['size'], ($attachment['is_image'] ? ' | ' . $attachment['real_width'] . 'x' . $attachment['real_height'] : ' | ' . $attachment['downloads'] . ' ' . $txt['downloads']) . '</span>
									<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '"/>
								</span>';
                    }
                } else {
                    echo '
								<a href="' . $attachment['href'] . '" class="bwcell33" style="float: left; display: block; overflow: hidden;margin-bottom: 1px;height: 200px;">
									<span class="smalltext narrowcaps">' . $attachment['name'] . '<br>', $attachment['size'], $attachment['is_image'] ? ' | ' . $attachment['real_width'] . 'x' . $attachment['real_height'] : ' | ' . $attachment['downloads'] . '  ' . $txt['downloads'] . '</span>
									<img src="' . $settings['images_url'] . '/filetypes/', $ext, '.png" align="middle" alt="*" />
								</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>] ';
                }
            }
            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0) {
                echo '
							</fieldset>';
            }
            echo '
						</div>
					</div>
			';
        }
        echo '
					<div class="clear description_board narrow">
						<div id="modified_', $message['id'], '">';
        // Show "� Last Edit: Time by Person �" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name'])) {
            echo '
							&#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';
        }
        echo '
						</div>
						<div class="reportlinks">';
        // Maybe they want to report this post to the moderator(s)?
        if ($context['can_report_moderator']) {
            echo '
							<a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> &nbsp;';
        }
        // Can we issue a warning because of this post?  Remember, we can't give guests warnings.
        if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
            echo '
							<a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><span class="icon-warning" style="color: red;font-size: 90%; " title="', $txt['issue_warning_post'], '"></span></a> ';
        }
        echo '
							<span class="icon-connection" style="font-size: 80%;"></span>';
        // Show the IP to this user for this post - because you can moderate?
        if ($context['can_moderate_forum'] && !empty($message['member']['ip'])) {
            echo '
							<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';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>';
        } elseif ($message['can_see_ip']) {
            echo '
							<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
        } elseif (!$context['user']['is_guest']) {
            echo '
							<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt['logged'], '</a>';
        } else {
            echo '
							', $txt['logged'];
        }
        echo '
						</div>';
        // 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 '	<hr>
						<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';
        }
        echo '
					</div>
				</div>
			</div>
		</div>';
    }
    echo '
	</form>
	<a id="lastPost"></a>';
    // Show the page index... "Pages: [1]".
    echo '
	<div class="themepadding"></div>
	<div class="pagesection themepadding">
		<div class="bwgrid">
			<div class="bwcell4">
				<div class="pagelinks ">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
			</div>
			<div class="bwcell12">
				<div class="bwfloatright">', template_button_strip($normal_buttons), '<span class="wclear">', $context['previous_next'], '</span></div>
			</div>
		</div>
	</div>';
    // Show the lower breadcrumbs.
    echo '
	<div class="themepadding wfull">', theme_linktree(), '</div>';
    $mod_buttons = array('move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'), 'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_remove_topic'] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']), 'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']), 'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'));
    // Restore topic. eh?  No monkey business.
    if ($context['can_restore_topic']) {
        $mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
    }
    // Allow adding new mod buttons easily.
    call_integration_hook('integrate_mod_buttons', array(&$mod_buttons));
    echo '
	<div id="moderationbuttons" class="themepadding wfull">', template_button_strip($mod_buttons, 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
    // Show the jumpto box, or actually...let Javascript do it.
    echo '
	<hr class="clear" />
	<div class="themepadding center_align" id="display_jump_to">&nbsp;</div>';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
	<a id="quickreply"></a>
	<div id="quickreplybox" class="clear" style="overflow: auto;">
		<div class="catbg">
			<h3>
				<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
			</h3>
		</div>
		<div id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' 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="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
					<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 />';
        }
        echo '
					<div class="quickReplyContent">
						<textarea style="width: 100%; height: 200px;" name="message" tabindex="', $context['tabindex']++, '"></textarea>
					</div>
					<div class="righttext 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\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        echo '
					</div>
				</form>
			</div>
		</div>
	</div>';
    } else {
        echo '
	<br class="clear" />';
    }
    if ($context['show_spellchecking']) {
        echo '
	<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>
	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
    }
    echo '
	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[';
    if (!empty($options['display_quick_reply'])) {
        echo '
					var oQuickReply = new QuickReply({
						bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ',
						iTopicId: ', $context['current_topic'], ',
						iStart: ', $context['start'], ',
						sScriptUrl: smf_scripturl,
						sImagesUrl: "', $settings['images_url'], '",
						sContainerId: "quickReplyOptions",
						sImageId: "quickReplyExpand",
						sImageCollapsed: "collapse.gif",
						sImageExpanded: "expand.gif",
						sJumpAnchor: "quickreply"
					});';
    }
    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: \'', $context['session_id'], '\',
						sSessionVar: \'', $context['session_var'], '\',
						sButtonStrip: \'moderationbuttons\',
						sButtonStripDisplay: \'moderationbuttons_strip\',
						bUseImageButton: false,
						bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
						sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
						sRemoveButtonImage: \'delete_selected.gif\',
						sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
						bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
						sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
						sRestoreButtonImage: \'restore_selected.gif\',
						sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
						sFormId: \'quickModForm\'
					});';
    }
    echo '
					if (\'XMLHttpRequest\' in window)
					{
						var oQuickModify = new QuickModify({
							sScriptUrl: smf_scripturl,
							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" style="padding: 4px;" class="error"></div>
									<textarea class="editor" name="message" rows="12" style="' . ($context['browser']['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="' . $context['session_var'] . '" value="' . $context['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>'), ',
							sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
							sTemplateSubjectNormal: ', JavaScriptEscape('%subject%'), ',
							sTemplateTopSubject: ', JavaScriptEscape('%subject%<span class="dark_notice wide_notice">' . $context['num_views'] . '</span>'), ',

							sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
							sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
						});

						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'], '"
						});
					}';
    if (!empty($ignoredMsgs)) {
        echo '
					var aIgnoreToggles = new Array();';
        foreach ($ignoredMsgs as $msgid) {
            echo '
					aIgnoreToggles[', $msgid, '] = new smc_Toggle({
						bToggleEnabled: true,
						bCurrentlyCollapsed: true,
						aSwappableContainers: [
							\'msg_', $msgid, '_extra_info\',
							\'msg_', $msgid, '\',
							\'msg_', $msgid, '_footer\',
							\'msg_', $msgid, '_quick_mod\',
							\'modify_button_', $msgid, '\',
							\'msg_', $msgid, '_signature\'

						],
						aSwapLinks: [
							{
								sId: \'msg_', $msgid, '_ignored_link\',
								msgExpanded: \'\',
								msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
							}
						]
					});';
        }
    }
    echo '
	// ]]></script>';
}
function template_report()
{
    global $context, $settings, $options, $txt, $scripturl;
    echo '
	<div id="report_topic">
		<form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
			<input type="hidden" name="msg" value="' . $context['message_id'] . '" />
				<div class="cat_bar">
					<h3 class="catbg">', $txt['report_to_mod'], '</h3>
				</div>
				<div class="windowbg">
					<span class="topslice"><span></span></span>
					<div class="content">';
    if (!empty($context['post_errors'])) {
        echo '
				<div class="errorbox">
					<ul>';
        foreach ($context['post_errors'] as $error) {
            echo '
						<li class="error">', $error, '</li>';
        }
        echo '
					</ul>
				</div>';
    }
    echo '
						<p>', $txt['report_to_mod_func'], '</p>
						<br />
						<dl class="settings" id="report_post">';
    if ($context['user']['is_guest']) {
        echo '
							<dt>
								<label for="email_address">', $txt['email'], '</label>:
							</dt>
							<dd>
								<input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" />
							</dd>';
    }
    echo '
							<dt>
								<label for="report_comment">', $txt['enter_comment'], '</label>:
							</dt>
							<dd>
								<input type="text" id="report_comment" name="comment" size="50" value="', $context['comment_body'], '" maxlength="255" />
							</dd>';
    if ($context['require_verification']) {
        echo '
							<dt>
								', $txt['verification'], ':
							</dt>
							<dd>
								', template_control_verification($context['visual_verification_id'], 'all'), '
							</dd>';
    }
    echo '
						</dl>
						<div class="righttext">
							<input type="submit" name="submit" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit" />
						</div>
					</div>
					<span class="botslice"><span></span></span>
				</div>
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
		</form>
	</div>
	<br class="clear" />';
}
Ejemplo n.º 13
0
function template_kb_knowcont()
{
    global $scripturl, $txt, $settings, $memberContext, $total_rates, $sc, $user_info, $modSettings, $context;
    $max_num_stars = 5;
    if (isset($_GET['reported'])) {
        echo '<div style="text-align: center;" class="information"><strong>' . $txt['kb_reports24'] . '</strong></div>';
    }
    if ($context['know'][0]['approved'] == 0) {
        echo '<div style="text-align: center;" class="errorbox"><strong>' . $txt['kb_appp24'] . '</strong></div>';
    }
    if (isset($_GET['yesa'])) {
        echo '<div style="text-align: center;" class="information"><strong>' . $txt['kb_appp244'] . '</strong></div>';
    }
    if (isset($_GET['noa'])) {
        echo '<div style="text-align: center;" class="errorbox"><strong>' . $txt['kb_appp2444'] . '</strong></div>';
    }
    foreach ($context['know'] as $knowl) {
        if ($knowl['approved'] == 1) {
            $approved = '<span style="color: #008000;">' . $txt['kb_alist6'] . '</span>';
        } else {
            $approved = '<span style="color: #f00;">' . $txt['kb_alist7'] . '</span>';
        }
        echo '
	        <div class="cat_bar">
				<h3 class="catbg">', $knowl['title'], '</h3>
			</div>';
        echo '
		    <span class="upperframe"><span></span></span>
			<div class="roundframe">';
        $float = empty($modSettings['kb_article_detaildisplay']) ? 'right' : 'left';
        $pos = $float == 'left' ? 'right' : 'left';
        echo '
		    <div style="position: relative; ' . $pos . ':10px; padding-right:10px; padding-left:10px" class="float' . $float . '">
			    <div class="information">
                    <strong>' . $txt['kb_pinfi9'] . '</strong><br /><br />';
        loadMemberData($knowl['id_member']);
        loadMemberContext($knowl['id_member']);
        if ($memberContext[$knowl['id_member']]['avatar']['href']) {
            echo ' <img class="resizeav" border="0" src="' . $memberContext[$knowl['id_member']]['avatar']['href'] . '" alt="" />';
        } else {
            echo ' <img border="0" src="', $settings['images_url'], '/icons/online.gif" width="50" height="50" alt="" />';
        }
        echo '
						     <br /><br />
	                <strong>' . $txt['kb_pinfi8'] . ':</strong>&nbsp;';
        if ($knowl['id_member'] != 0) {
            echo KB_profileLink($knowl['real_name'], $knowl['id_member']);
        } else {
            echo $txt['guest_title'];
        }
        echo '
						    <br />
                    <strong>' . $txt['kb_pinfi7'] . ':</strong>&nbsp;' . $knowl['kbnid'] . '';
        if (!empty($modSettings['kb_show_view'])) {
            echo '<br /><strong>' . $txt['kb_pinfi6'] . ':</strong>&nbsp;' . $knowl['views'] . '';
        }
        if (allowedTo('rate_kb') && $modSettings['kb_eratings']) {
            echo '<br />
					        <strong>' . $txt['kb_pinfi3'] . ':</strong>
				            <a href="' . $scripturl . '?action=kb;area=rate;value=1;kbnid=' . $knowl['kbnid'] . ';sesc=' . $sc . '">
						    <img src="', $settings['default_images_url'], '/sort_up.gif" title="' . $txt['kb_pinfi4'] . '" alt="' . $txt['kb_pinfi4'] . '" border="0" /></a>&nbsp;&nbsp;
						    <a href="' . $scripturl . '?action=kb;area=rate;value=0;kbnid=' . $knowl['kbnid'] . ';sesc=' . $sc . '">
						    <img src="', $settings['default_images_url'], '/sort_down.gif" title="' . $txt['kb_pinfi5'] . '" alt="' . $txt['kb_pinfi5'] . '" border="0" /></a><br /> ';
        } else {
            echo '<br />';
        }
        if (!empty($modSettings['kb_eratings'])) {
            echo '<strong>' . $txt['kb_pinfi2'] . ':</strong>&nbsp;' . KB_Stars_Precent($knowl['rate']) . '<br />';
        }
        echo '
						    <strong>' . $txt['kb_pinfi1'] . ': </strong>
							<span class="smalltext">' . $knowl['date'] . '</span>
				            <br /><strong>' . $txt['kb_alist5'] . ':</strong>&nbsp;' . $approved . '<br /><br />
		            </div>
			</div>';
        if (!empty($modSettings['kb_social'])) {
            echo '
				    <div style="position: relative; left:10px;">
			            <g:plusone size="small"></g:plusone><script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
				        <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">' . $txt['kb_tweet'] . '</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
				        <iframe src="http://www.facebook.com/plugins/like.php?href=', $scripturl, '?action=kb;area=article;cont=' . $_GET['cont'] . '&amp;layout=button_count&amp;show_faces=true&amp;width=85&amp;action=like&amp;font&amp;colorscheme=light&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:85px; height:20px;" allowTransparency="true"></iframe>
                    </div>';
            if (!empty($knowl['source'])) {
                echo '<br /> <strong>' . $txt['kb_osource'] . '</strong>:  ', $knowl['source'], '';
            }
            echo '<hr />';
        } else {
            if (!empty($knowl['source'])) {
                echo ' <strong>' . $txt['kb_osource'] . '</strong>:  ', $knowl['source'], '
				    <hr />';
            }
        }
        echo '
			<div style="padding-right:10px; padding-top:10px; padding-left:10px">

			 ', $knowl['content'], '

			</div>
		<br class="clear" /><br class="clear" />
		</div><span class="lowerframe"><span></span></span>';
    }
    if (!empty($context['kbimg']) && $modSettings['kb_enable_attachment']) {
        echo '<br />
		    <span class="upperframe"><span></span></span>
			    <div class="roundframe">';
        echo '
				<div class="highslide-gallery">';
        foreach ($context['kbimg'] as $img) {
            if (!empty($modSettings['kb_enablehs_attach'])) {
                echo '

                            <a id="thumb' . $img['id_article'] . '" href="' . $modSettings['kb_url_attachment'] . '' . $img['filename'] . '" class="highslide" onclick="return hs.expand(this, { slideshowGroup: 2, thumbnailId: \'thumb' . $img['id_article'] . '\' } )">
	                            <img class="resizeme" src="' . $modSettings['kb_url_attachment'] . '' . $img['filename'] . '" alt="' . $img['filename'] . '" title="' . $img['filename'] . '" />
							</a>';
                echo '
                            <div class="highslide-caption">
	                            ' . $img['filename'] . '
                             </div>';
            } else {
                echo '<a href="' . $modSettings['kb_url_attachment'] . '' . $img['filename'] . '" rel="lightbox[roadtrip]" title="' . $img['filename'] . '">
			            <img class="resizeme" src="' . $modSettings['kb_url_attachment'] . '' . $img['filename'] . '" alt="' . $img['filename'] . '" /></a> ';
            }
        }
        echo '</div>';
        echo '
			    </div>
	       <span class="lowerframe"><span></span></span>';
    }
    if (!empty($modSettings['kb_ecom'])) {
        echo '<br /> <div class="cat_bar">
				<h3 class="catbg">' . $txt['kb_ecom2'] . '';
        if (allowedTo('com_kb')) {
            echo '&nbsp;-&nbsp;<a href="javascript:void(0)" onclick="javascript:kbsearch_showhide(\'commentkb\');">' . $txt['kb_articlwnot_add_com'] . '</a>';
        }
        echo '</h3>
			</div>';
        echo '<div align="center"><div class="error" id="com_done" style="display:none;"><strong>' . $txt['kb_com_sub_compleat'] . '</strong></div></div>';
        echo '<div class="commentkb" id="commentkb" style="display:none;"> ';
        echo '<form id="mykbform" action="', $scripturl, '?action=kb;area=kb;area=article;comment;arid=' . $_GET['cont'] . ';cont=' . $_GET['cont'] . '" method="post" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'title\', \'description\']);">
	         <span class="upperframe"><span></span></span>
			<div class="roundframe centertext"><br class="clear" />
			<div class="error" id="ajax_in_progress" style="display:none;">' . $txt['kb_loading'] . '</div>';
        if (!allowedTo('auto_approvecom_kb')) {
            echo '<div class="error"><strong>' . $txt['kb_ecomauto'] . '</strong></div><br />';
        }
        if ($context['show_bbc']) {
            echo '<div id="bbcBox_message"></div>';
        }
        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');
        if ($user_info['is_guest']) {
            echo template_control_verification($context['visual_verification_id'], 'all');
        }
        echo '<br /><input type="submit" name="send" class="button_submit" value="' . $txt['kb_catperm6'] . '" />
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"/>
	  </div>
	       <span class="lowerframe"><span></span></span><br />
        </form></div>';
        if (!empty($context['kbcom'])) {
            echo '' . $txt['pages'] . ': ' . $context['page_index'] . '';
        }
        $windowclass = false;
        echo '<div id="results">';
        foreach ($context['kbcom'] as $com) {
            $windowclass = $windowclass == 'windowbg' ? 'windowbg2' : 'windowbg';
            echo '<div class="' . $windowclass . '">
				<span class="topslice"><span></span></span>';
            echo '<div class="poster">';
            echo '<ul class="reset">
			<li class="title">';
            if ($com['id_member'] != 0) {
                echo KB_profileLink($com['real_name'], $com['id_member']);
            } else {
                echo $txt['guest_title'];
            }
            loadMemberData($com['id_member']);
            loadMemberContext($com['id_member']);
            if ($memberContext[$com['id_member']]['avatar']['href']) {
                echo ' <br /><br /><img class="resizeav" border="0" src="' . $memberContext[$com['id_member']]['avatar']['href'] . '" alt="" />';
            } else {
                echo ' <br /><br /><img border="0" src="', $settings['images_url'], '/icons/online.gif" width="50" height="50" alt="" />';
            }
            echo '
			</li>
			</ul>';
            echo '</div>';
            echo '<div class="postarea">
					<div class="flow_hidden">
						<div class="keyinfo">
						<div class="messageicon">
							<img src="', $settings['images_url'] . '/post/xx.gif" alt="" border="0" />
						</div>
						<h5>' . $txt['kb_re'] . ': ', $context['know'][0]['title'], '</h5>
							<div class="smalltext">&#171; <strong>', $txt['on'], ':</strong> ', $com['date'], ' &#187;</div>
						</div>';
            if ($com['id_member'] == $user_info['id'] && $context['user']['is_logged'] && allowedTo('comdel_kb') || allowedTo('manage_kb')) {
                echo '<ul class="reset smalltext quickbuttons">

							   <li class="remove_button">
							   		<a href="', $scripturl, '?action=kb;area=kb;area=article;commentdel;arid=' . $com['id'] . ';cont=' . $_GET['cont'] . '" onclick="return confirm(\'' . $txt['knowledgebaseeditedsure101'] . '\');">
							   			', $txt['remove'], '
							   		</a>
							   	</li>
							</ul>';
            }
            echo '
						</div>
						<div class="post">
					<div class="inner">
						', $com['comment'], '
					</div>	</div>';
            echo '<br class="clear" /></div>
					<span class="botslice"><span></span></span></div>';
        }
        echo '</div>';
        if (!empty($context['kbcom'])) {
            echo '' . $txt['pages'] . ': ' . $context['page_index'] . '';
        }
    }
    template_kb_copy();
}
Ejemplo n.º 14
0
function article_comments($render = true)
{
    global $scripturl, $txt, $settings, $context;
    $code = '';
    if (in_array('comments', $context['TPortal']['article']['visual_options'])) {
        $code = '
	<h2 class="titlebg" style="padding: 0 1em;">' . $txt['tp-comments'] . '  ' . tp_hidepanel('articlecomments', false, true, '5px 5px 0 5px') . '</h2>
	<div id="articlecomments"' . (in_array('articlecomments', $context['tp_panels']) ? ' style="display: none;"' : '') . '>
		<div class="windowbg2" style="padding: 1em 2em;">';
        $counter = 1;
        if (isset($context['TPortal']['article']['comment_posts'])) {
            foreach ($context['TPortal']['article']['comment_posts'] as $comment) {
                $code .= '
				<div class="' . ($context['TPortal']['article']['authorID'] != $comment['posterID'] ? 'mycomment' : 'othercomment') . '">
					<a id="comment' . $comment['id'] . '"></a>
					<span class="comment_author">' . (!empty($comment['avatar']['image']) ? $comment['avatar']['image'] : '') . '</span>
					<strong>' . $counter++ . ') ' . $comment['subject'] . '</strong>
						' . ($comment['is_new'] && $context['user']['is_logged'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="" />' : '') . '
						<div class="middletext" style="padding-top: 0.5em;"> ' . $txt['tp-by'] . ' <a href="' . $scripturl . '?action=profile;u=' . $comment['posterID'] . '">' . $comment['poster'] . '</a>
							' . $txt['on'] . ' ' . $comment['date'] . '
						</div>
						<div class="textcomment"><div class="body">' . $comment['text'] . '</div></div>';
                // can we edit the comment or are the owner of it?
                if (allowedTo('tp_articles') || $comment['posterID'] == $context['user']['id']) {
                    $code .= '
						<div class="buttonlist align_right"><ul><li><a class="active" href="' . $scripturl . '?action=tpmod;sa=killcomment' . $comment['id'] . '" onclick="javascript:return confirm(\'' . $txt['tp-confirmdelete'] . '\')"><span>' . $txt['tp-delete'] . '</span></a></li></ul></div>';
                }
                $code .= '
				</div>';
            }
        }
        $code .= '
			</div>';
        if (in_array('commentallow', $context['TPortal']['article']['visual_options']) && !empty($context['TPortal']['can_artcomment'])) {
            $code .= '
			<div class="windowbg" style="padding: 1em;">
				<form accept-charset="' . $context['character_set'] . '"  name="tp_article_comment" action="' . $scripturl . '?action=tpmod;sa=comment" method="post" style="margin: 0; padding: 0;">
						<input name="tp_article_comment_title" type="text" style="width: 99%;" value="Re: ' . strip_tags($context['TPortal']['article']['subject']) . '">
						<textarea style="width: 99%; height: 8em;" name="tp_article_bodytext"></textarea>
';
            if (!empty($context['TPortal']['articles_comment_captcha'])) {
                loadtemplate('GenericControls');
                $code .= '
								<div class="">
									<span' . (!empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '') . '>
										<strong>' . $txt['verification'] . ':</strong>
									</span>
									' . template_control_verification($context['visual_verification_id'], 'all') . '
								</div>';
            }
            $code .= '
						<br />&nbsp;<input id="tp_article_comment_submit" type="submit" value="' . $txt['tp-submit'] . '">
						<input name="tp_article_type" type="hidden" value="article_comment">
						<input name="tp_article_id" type="hidden" value="' . $context['TPortal']['article']['id'] . '">
						<input type="hidden" name="sc" value="' . $context['session_id'] . '" />
				</form>
			</div>';
        } else {
            $code .= '
			<div style="padding: 1ex;" class="windowbg"><em>' . $txt['tp-cannotcomment'] . '</em></div>';
        }
        $code .= '
			</div>';
    } else {
        $code .= '';
    }
    if ($render) {
        echo $code;
    } else {
        return $code;
    }
}
Ejemplo n.º 15
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>';
}
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
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="windowbg" id="profile_success">
	', $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="top"></a>
<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
<div class="tborder marginbottom" id="poll">
	<h3 class="titlebg">
		<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="bottom" /> ', $txt['poll'], '
	</h3>
	<h4 class="windowbg headerpadding" id="pollquestion">
		', $context['poll']['question'], '
	</h4>
	<div class="windowbg clearfix" id="poll_options">';
        // 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="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
			<dd class="middletext">', $context['allow_poll_view'] ? $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)' : '', '</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="', $context['character_set'], '">';
            // 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 class="middletext">', $option['vote_button'], ' <label for="', $option['id'], '">', $option['option'], '</label></li>';
            }
            echo '
			</ul>

			<div class="submitbutton', !empty($context['poll']['expire_time']) ? ' border' : '', '">
				<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 id="pollmoderation" class="clearfix">';
        // Build the poll moderation button array.
        $poll_buttons = array('vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']), 'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'), 'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.gif', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'lock' => array('test' => 'allow_lock_poll', 'text' => !$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock', 'image' => 'poll_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']), 'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']));
        template_button_strip($poll_buttons);
        echo '
</div><br class="clear" />';
    }
    // Does this topic have some events linked to it?
    if (!empty($context['linked_calendar_events'])) {
        echo '
<div class="linked_events">
	<h3 class="titlebg headerpadding">', $txt['calendar_linked_events'], '</h3>
	<div class="content windowbg">
		<ul class="reset">';
        foreach ($context['linked_calendar_events'] as $event) {
            echo '
			<li>
				', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" 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>';
    }
    // Build the normal button array.
    $normal_buttons = array('reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message']), 'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']), 'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.gif', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'), 'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'));
    // Allow adding new buttons easily.
    call_integration_hook('integrate_display_buttons', array(&$normal_buttons));
    // Show the page index... "Pages: [1]".
    echo '
<div class="clearfix margintop" id="postbuttons">
	<div class="next">', $context['previous_next'], '</div>
	<div class="margintop middletext floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
	<div class="nav floatright">', template_button_strip($normal_buttons, 'bottom'), '</div>
</div>';
    // Show the topic information - icon, subject, etc.
    echo '
<div id="forumposts" class="tborder">
	<h3 class="catbg3">
		<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" align="bottom" alt="" />
		<span>', $txt['author'], '</span>
		<span id="top_subject">', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')</span>
	</h3>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
	<div id="whoisviewing" class="smalltext headerpadding windowbg2">';
        // 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'], '
	</div>';
    }
    echo '
	<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\') : false">';
    // These are some cache image buttons we may want.
    $reply_button = create_button('quote.gif', 'reply', 'quote', 'align="middle"');
    $modify_button = create_button('modify.gif', 'modify', 'modify', 'align="middle"');
    $remove_button = create_button('delete.gif', 'remove', 'remove', 'align="middle"');
    $split_button = create_button('split.gif', 'split', 'split', 'align="middle"');
    $approve_button = create_button('approve.gif', 'approve', 'approve', 'align="middle"');
    $restore_message_button = create_button('restore_topic.gif', 'restore_message', 'restore_message', 'align="middle"');
    $ignoredMsgs = array();
    $removableMessageIDs = array();
    // Get all the messages...
    while ($message = $context['get_message']()) {
        $is_first_post = !isset($is_first_post) ? true : false;
        $ignoring = false;
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        echo '
		<div class="bordercolor">';
        // 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.
        if ($message['id'] != $context['first_message']) {
            echo '
			<a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
        }
        echo '
			<div class="clearfix ', !$is_first_post ? 'topborder ' : '', $message['approved'] ? $message['alternate'] == 0 ? 'windowbg' : 'windowbg2' : 'approvebg', ' largepadding">';
        // Show information about the poster of this message.
        echo '
				<div class="floatleft poster">
					<h4>', $message['member']['link'], '</h4>
					<ul class="reset smalltext" id="msg_', $message['id'], '_extra_info">';
        // Show the member's custom title, if they have one.
        if (isset($message['member']['title']) && $message['member']['title'] != '') {
            echo '
						<li>', $message['member']['title'], '</li>';
        }
        // Show the member's primary group (like 'Administrator') if they have one.
        if (isset($message['member']['group']) && $message['member']['group'] != '') {
            echo '
						<li>', $message['member']['group'], '</li>';
        }
        // Don't show these things for guests.
        if (!$message['member']['is_guest']) {
            // 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.
            if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') {
                echo '
						<li>', $message['member']['post_group'], '</li>';
            }
            echo '
						<li>', $message['member']['group_stars'], '</li>';
            // Is karma display enabled?  Total or +/-?
            if ($modSettings['karmaMode'] == '1') {
                echo '
						<li class="margintop">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
            } elseif ($modSettings['karmaMode'] == '2') {
                echo '
						<li class="margintop">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';
            }
            // Is this user allowed to modify this member's karma?
            if ($message['member']['karma']['allow']) {
                echo '
						<li>
							<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
							<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
						</li>';
            }
            // Show online and offline buttons?
            if (!empty($modSettings['onlineEnable'])) {
                echo '
						<li>', $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" style="margin-top: 2px;" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '</li>';
            }
            // Show the member's gender icon?
            if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender'])) {
                echo '
						<li>', $txt['gender'], ': ', $message['member']['gender']['image'], '</li>';
            }
            // Show how many posts they have made.
            if (!isset($context['disabled_fields']['posts'])) {
                echo '
						<li>', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';
            }
            // Any custom fields for standard placement?
            if (!empty($message['member']['custom_fields'])) {
                foreach ($message['member']['custom_fields'] as $custom) {
                    if (empty($custom['placement']) && !empty($custom['value'])) {
                        echo '
						<li>', $custom['title'], ': ', $custom['value'], '</li>';
                    }
                }
            }
            // Show avatars, images, etc.?
            if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
                echo '
						<li class="margintop" style="overflow: auto;">', $message['member']['avatar']['image'], '</li>';
            }
            // Show their personal text?
            if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '') {
                echo '
						<li class="margintop">', $message['member']['blurb'], '</li>';
            }
            // Any custom fields to show as icons?
            if (!empty($message['member']['custom_fields'])) {
                $shown = false;
                foreach ($message['member']['custom_fields'] as $custom) {
                    if ($custom['placement'] != 1 || empty($custom['value'])) {
                        continue;
                    }
                    if (empty($shown)) {
                        $shown = true;
                        echo '
						<li class="margintop">
							<ul class="reset nolist">';
                    }
                    echo '
								<li>', $custom['value'], '</li>';
                }
                if ($shown) {
                    echo '
							</ul>
						</li>';
                }
            }
            // This shows the popular messaging icons.
            if ($message['member']['has_messenger'] && $message['member']['can_view_profile']) {
                echo '
						<li class="margintop">
							<ul class="reset nolist">
								', !isset($context['disabled_fields']['icq']) && !empty($message['member']['icq']['link']) ? '<li>' . $message['member']['icq']['link'] . '</li>' : '', '
								', !isset($context['disabled_fields']['msn']) && !empty($message['member']['msn']['link']) ? '<li>' . $message['member']['msn']['link'] . '</li>' : '', '
								', !isset($context['disabled_fields']['aim']) && !empty($message['member']['aim']['link']) ? '<li>' . $message['member']['aim']['link'] . '</li>' : '', '
								', !isset($context['disabled_fields']['yim']) && !empty($message['member']['yim']['link']) ? '<li>' . $message['member']['yim']['link'] . '</li>' : '', '
							</ul>
						</li>';
            }
            // Show the profile, website, email address, and personal message buttons.
            if ($settings['show_profile_buttons']) {
                echo '
						<li class="margintop">
							<ul class="reset nolist">';
                // Don't show the profile button if you're not allowed to view the profile.
                if ($message['member']['can_view_profile']) {
                    echo '
								<li><a href="', $message['member']['href'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.gif" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '" border="0" />' : $txt['view_profile'], '</a></li>';
                }
                // Don't show an icon if they haven't specified a website.
                if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) {
                    echo '
								<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.gif" alt="' . $message['member']['website']['title'] . '" border="0" />' : $txt['www'], '</a></li>';
                }
                // Don't show the email address if they want it hidden.
                if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum'))) {
                    echo '
								<li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email'], '</a></li>';
                }
                // Since we know this person isn't a guest, you *can* message them.
                if ($context['can_send_pm']) {
                    echo '
								<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" border="0" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';
                }
                echo '
							</ul>
						</li>';
            }
            // Are we showing the warning status?
            if ($message['member']['can_see_warning']) {
                echo '
						<li>', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<img src="', $settings['images_url'], '/warning_', $message['member']['warning_status'], '.gif" alt="', $txt['user_warn_' . $message['member']['warning_status']], '" />', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>';
            }
        } elseif (!empty($message['member']['email']) && in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum'))) {
            echo '
						<li><a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" border="0" />' : $txt['email'], '</a></li>';
        }
        // Done with the information about the poster... on to the post itself.
        echo '
					</ul>
				</div>
				<div class="postarea">
					<div class="flow_hidden">
						<div class="keyinfo">
							<div class="messageicon"><img src="', $message['icon_url'] . '" alt="" border="0"', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' /></div>
							<h5 id="subject_', $message['id'], '">
								<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
							</h5>
							<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
							<div id="msg_', $message['id'], '_quick_mod"></div>
						</div>';
        // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
						<ul class="reset smalltext postingbuttons">';
        }
        // 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'], '">', $approve_button, '</a></li>';
        }
        // Can they reply? Have they turned on quick reply?
        if ($context['can_quote'] && !empty($options['display_quick_reply'])) {
            echo '
							<li><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'], ');">', $reply_button, '</a></li>';
        } elseif ($context['can_quote']) {
            echo '
							<li><a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '">', $reply_button, '</a></li>';
        }
        // 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'], '">', $modify_button, '</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'], '?\');">', $remove_button, '</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'], '">', $split_button, '</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'], '">', $restore_message_button, '</a></li>';
        }
        // Show a checkbox for quick moderation?
        if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
            echo '
							<li style="display: none;" id="in_topic_mod_check_', $message['id'], '"></li>';
        }
        if ($message['can_approve'] || $context['can_reply'] || $message['can_modify'] || $message['can_remove'] || $context['can_split'] || $context['can_restore_msg']) {
            echo '
						</ul>';
        }
        echo '
					</div>';
        // Ignoring this user? Hide the post.
        if ($ignoring) {
            echo '
					<div class="ignored" 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">
						<hr class="hrcolor" width="100%" size="1" />';
        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'], '"', '>', $message['body'], '</div>
					</div>', $message['can_modify'] ? '
					<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="' . $txt['modify_msg'] . '" title="' . $txt['modify_msg'] . '" class="modifybutton" id="modify_button_' . $message['id'] . '" style="cursor: ' . ($context['browser']['is_ie5'] || $context['browser']['is_ie5.5'] ? 'hand' : 'pointer') . '; display: none;" onclick="oQuickModify.modifyMsg(\'' . $message['id'] . '\')" />' : '';
        // Assuming there are attachments...
        if (!empty($message['attachment'])) {
            // Now for the attachments, signature, ip logged, etc...
            echo '
					<div id="msg_', $message['id'], '_footer" class="attachments smalltext">';
            $last_approved_state = 1;
            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>';
                }
                if ($attachment['is_image']) {
                    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'], '" border="0" /></a><br />';
                    } else {
                        echo '
								<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
                    }
                }
                echo '
								<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&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 '
										(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
            }
            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0) {
                echo '
							</fieldset>';
            }
            echo '
					</div>';
        }
        echo '
				</div>
				<div class="moderatorbar">
					<div class="smalltext floatleft" id="modified_', $message['id'], '">';
        // Show "« Last Edit: Time by Person »" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name'])) {
            echo '
						&#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';
        }
        echo '
					</div>
					<div class="smalltext largepadding floatright">';
        // Maybe they want to report this post to the moderator(s)?
        if ($context['can_report_moderator']) {
            echo '
						<a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> &nbsp;';
        }
        // Can we issue a warning because of this post?  Remember, we can't give guests warnings.
        if ($context['can_issue_warning'] && !$message['is_message_author'] && !$message['member']['is_guest']) {
            echo '
						<a href="', $scripturl, '?action=profile;area=issuewarning;u=', $message['member']['id'], ';msg=', $message['id'], '"><img src="', $settings['images_url'], '/warn.gif" alt="', $txt['issue_warning_post'], '" title="', $txt['issue_warning_post'], '" border="0" /></a>';
        }
        echo '
						<img src="', $settings['images_url'], '/ip.gif" alt="" border="0" />';
        // Show the IP to this user for this post - because you can moderate?
        if ($context['can_moderate_forum'] && !empty($message['member']['ip'])) {
            echo '
						<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';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>';
        } elseif ($message['can_see_ip']) {
            echo '
						<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
        } elseif (!$context['user']['is_guest']) {
            echo '
						<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt['logged'], '</a>';
        } else {
            echo '
						', $txt['logged'];
        }
        echo '
					</div>';
        // 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">', $message['member']['signature'], '</div>';
        }
        echo '
				</div>
			</div>
		</div>';
    }
    echo '
	</form>';
    echo '
</div>
<a id="lastPost"></a>';
    echo '
<div class="clearfix marginbottom" id="postbuttons_lower">
	<div class="nav floatright">', template_button_strip($normal_buttons, 'top'), '</div>
	<div class="middletext floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
	<div class="clear">', $context['previous_next'], '</div>
</div>';
    // Show the lower breadcrumbs.
    theme_linktree();
    $mod_buttons = array('move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'), 'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_remove_topic'] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']), 'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']), 'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'));
    // Restore topic. eh?  No monkey business.
    if ($context['can_restore_topic']) {
        $mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
    }
    // Allow adding new mod buttons easily.
    call_integration_hook('integrate_mod_buttons', array(&$mod_buttons));
    echo '
<div id="moderationbuttons" class="clearfix">', template_button_strip($mod_buttons, 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
    // Show the jumpto box, or actually...let Javascript do it.
    echo '
<div class="tborder">
	<div class="titlebg2" style="padding: 4px;" align="', !$context['right_to_left'] ? 'right' : 'left', '" id="display_jump_to">&nbsp;</div>
</div><br />';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
<a id="quickreply"></a>
<div class="tborder" id="quickreplybox">';
        echo '
	<h3 class="catbg">
		<a href="javascript:oQuickReply.swap();">
			<img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" id="quickReplyExpand" />
		</a>
		<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
	</h3>
	<div class="windowbg" id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
		<div class="floatleft" id="quickReplyWarning">
			', $txt['quick_reply_desc'], $context['is_locked'] ? '<p><strong>' . $txt['quick_reply_warning'] . '</strong></p>' : '', $context['oldTopicError'] ? '<p><strong>' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</strong></p>' : '', '
		</div>
		<div id="quickReplyContent">', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
			', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
			<form action="', $scripturl, '?action=post2', empty($context['current_board']) ? '' : ';board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\', \'guestname\', \'evtitle\', \'question\']);" style="margin: 0;">
				<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'], '" />';
        // 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 />';
        }
        echo '
				<textarea cols="600" rows="7" name="message" tabindex="', $context['tabindex']++, '"></textarea><br />
				<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\');" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        echo '
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
			</form>
		</div>
		<div class="clear"></div>
	</div>
</div>';
    }
    if ($context['show_spellchecking']) {
        echo '
<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>
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
    }
    echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[';
    if (!empty($options['display_quick_reply'])) {
        echo '
	var oQuickReply = new QuickReply({
		bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ',
		iTopicId: ', $context['current_topic'], ',
		iStart: ', $context['start'], ',
		sScriptUrl: smf_scripturl,
		sImagesUrl: "', $settings['images_url'], '",
		sContainerId: "quickReplyOptions",
		sImageId: "quickReplyExpand",
		sImageCollapsed: "collapse.gif",
		sImageExpanded: "expand.gif",
		sJumpAnchor: "quickreply"
	});';
    }
    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: \'', $context['session_id'], '\',
		sSessionVar: \'', $context['session_var'], '\',
		sButtonStrip: \'moderationbuttons\',
		sButtonStripDisplay: \'moderationbuttons_strip\',
		bUseImageButton: false,
		bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
		sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
		sRemoveButtonImage: \'delete_selected.gif\',
		sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
		sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
		sRestoreButtonImage: \'restore_selected.gif\',
		sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		sFormId: \'quickModForm\'
	});';
    }
    echo '
	if (\'XMLHttpRequest\' in window)
	{
		var oQuickModify = new QuickModify({
			sScriptUrl: smf_scripturl,
			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" style="padding: 4px;" class="error"></div>
					<textarea class="editor" name="message" rows="12" style="' . ($context['browser']['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="' . $context['session_var'] . '" value="' . $context['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>'), ',
			sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
			sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
			sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
			sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
			sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
		});

		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: "', $context['session_id'], '",
			sSessionVar: "', $context['session_var'], '",
			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 '
	var aIgnoreToggles = new Array();';
        foreach ($ignoredMsgs as $msgid) {
            echo '
	aIgnoreToggles[', $msgid, '] = new smc_Toggle({
		bToggleEnabled: true,
		bCurrentlyCollapsed: true,
		aSwappableContainers: [
			\'msg_', $msgid, '_extra_info\',
			\'msg_', $msgid, '\',
			\'msg_', $msgid, '_footer\',
			\'msg_', $msgid, '_quick_mod\',
			\'modify_button_', $msgid, '\',
			\'msg_', $msgid, '_signature\'

		],
		aSwapLinks: [
			{
				sId: \'msg_', $msgid, '_ignored_link\',
				msgExpanded: \'\',
				msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
			}
		]
	});';
        }
    }
    echo '
	// ]]></script>';
}
Ejemplo n.º 17
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0.10
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    echo '
	<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
		<div class="cat_bar">
			<h3 class="catbg">
				<span class="ie6_header floatleft">', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" class="icon" />' : ' ', $txt['set_parameters'], '</span>
			</h3>
		</div>';
    if (!empty($context['search_errors'])) {
        echo '
		<p id="search_error" class="error">', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    // Simple Search?
    if ($context['simple_search']) {
        echo '
		<fieldset id="simple_search">
			<span class="upperframe"><span></span></span>
			<div class="roundframe">
				<div id="search_term_input">
					<strong>', $txt['search_for'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
					', $context['require_verification'] ? '' : '&nbsp;<input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<p class="smalltext">', $txt['search_example'], '</p>';
        }
        if ($context['require_verification']) {
            echo '
				<div class="verification>
					<strong>', $txt['search_visual_verification_label'], ':</strong>
					<br />', template_control_verification($context['visual_verification_id'], 'all'), '<br />
					<input id="submit" type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        }
        echo '
				<a href="', $scripturl, '?action=search;advanced" onclick="this.href += \';search=\' + escape(document.forms.searchform.search.value);">', $txt['search_advanced'], '</a>
				<input type="hidden" name="advanced" value="0" />
			</div>
			<span class="lowerframe"><span></span></span>
		</fieldset>';
    } else {
        echo '
		<fieldset id="advanced_search">
			<span class="upperframe"><span></span></span>
			<div class="roundframe">
				<input type="hidden" name="advanced" value="1" />
				<span class="enhanced">
					<strong>', $txt['search_for'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
					<script type="text/javascript"><!-- // --><![CDATA[
						function initSearch()
						{
							if (document.forms.searchform.search.value.indexOf("%u") != -1)
								document.forms.searchform.search.value = unescape(document.forms.searchform.search.value);
						}
						createEventListener(window);
						window.addEventListener("load", initSearch, false);
					// ]]></script>
					<select name="searchtype">
						<option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['all_words'], '</option>
						<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['any_words'], '</option>
					</select>
				</span>';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<em class="smalltext">', $txt['search_example'], '</em>';
        }
        echo '
				<dl id="search_options">
					<dt>', $txt['by_user'], ':</dt>
					<dd><input id="userspec" type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" /></dd>
					<dt>', $txt['search_order'], ':</dt>
					<dd>
						<select id="sort" name="sort">
							<option value="relevance|desc">', $txt['search_orderby_relevant_first'], '</option>
							<option value="num_replies|desc">', $txt['search_orderby_large_first'], '</option>
							<option value="num_replies|asc">', $txt['search_orderby_small_first'], '</option>
							<option value="id_msg|desc">', $txt['search_orderby_recent_first'], '</option>
							<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
						</select>
					</dd>
					<dt class="options">', $txt['search_options'], ':</dt>
					<dd class="options">
						<label for="show_complete"><input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['search_show_complete_messages'], '</label><br />
						<label for="subject_only"><input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['search_subject_only'], '</label>
					</dd>
					<dt class="between">', $txt['search_post_age'], ': </dt>
					<dd>', $txt['search_between'], ' <input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;', $txt['search_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '</dd>
				</dl>';
        // Require an image to be typed to save spamming?
        if ($context['require_verification']) {
            echo '
				<p>
					<strong>', $txt['verification'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</p>';
        }
        // If $context['search_params']['topic'] is set, that means we're searching just one topic.
        if (!empty($context['search_params']['topic'])) {
            echo '
				<p>', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.</p>
				<input type="hidden" name="topic" value="', $context['search_topic']['id'], '" />';
        }
        echo '
			</div>
			<span class="lowerframe"><span></span></span>
		</fieldset>';
        if (empty($context['search_params']['topic'])) {
            echo '
		<fieldset class="flow_hidden">
			<span class="upperframe"><span></span></span>
			<div class="roundframe">
				<div class="title_bar">
					<h4 class="titlebg">
						<a href="javascript:void(0);" onclick="expandCollapseBoards(); return false;"><img src="', $settings['images_url'], '/expand.gif" id="expandBoardsIcon" alt="" /></a> <a href="javascript:void(0);" onclick="expandCollapseBoards(); return false;"><strong>', $txt['choose_board'], '</strong></a>
					</h4>
				</div>
				<div class="flow_auto" id="searchBoardsExpand"', $context['boards_check_all'] ? ' style="display: none;"' : '', '>
					<ul class="ignoreboards floatleft">';
            $i = 0;
            $limit = ceil($context['num_boards'] / 2);
            foreach ($context['categories'] as $category) {
                echo '
						<li class="category">
							<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), ']); return false;">', $category['name'], '</a>
							<ul>';
                foreach ($category['boards'] as $board) {
                    if ($i == $limit) {
                        echo '
							</ul>
						</li>
					</ul>
					<ul class="ignoreboards floatright">
						<li class="category">
							<ul>';
                    }
                    echo '
								<li class="board">
									<label for="brd', $board['id'], '" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"><input type="checkbox" id="brd', $board['id'], '" name="brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '</label>
								</li>';
                    $i++;
                }
                echo '
							</ul>
						</li>';
            }
            echo '
					</ul>
				</div>
				<br class="clear" />';
            echo '
				<div class="padding">
					<input type="checkbox" name="all" id="check_all" value=""', $context['boards_check_all'] ? ' checked="checked"' : '', ' onclick="invertAll(this, this.form, \'brd\');" class="input_check floatleft" />
					<label for="check_all" class="floatleft">', $txt['check_all'], '</label>
					<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit floatright" />
				</div>
				<br class="clear" />
			</div>
			<span class="lowerframe"><span></span></span>
		</fieldset>';
        }
    }
    echo '
	</form>

	<script type="text/javascript"><!-- // --><![CDATA[
		function selectBoards(ids)
		{
			var toggle = true;

			for (i = 0; i < ids.length; i++)
				toggle = toggle & document.forms.searchform["brd" + ids[i]].checked;

			for (i = 0; i < ids.length; i++)
				document.forms.searchform["brd" + ids[i]].checked = !toggle;
		}

		function expandCollapseBoards()
		{
			var current = document.getElementById("searchBoardsExpand").style.display != "none";

			document.getElementById("searchBoardsExpand").style.display = current ? "none" : "";
			document.getElementById("expandBoardsIcon").src = smf_images_url + (current ? "/expand.gif" : "/collapse.gif");
		}';
    echo '
	// ]]></script>';
}
Ejemplo n.º 18
0
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings, $counter;
    // Start the javascript... and boy is there a lot.
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[';
    // When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
    if ($context['browser']['is_firefox']) {
        echo '
			function reActivate()
			{
				document.forms.postmodify.message.readOnly = false;
			}
			window.addEventListener("pageshow", reActivate, false);';
    }
    // Start with message icons - and any missing from this theme.
    echo '
			var icon_urls = {';
    foreach ($context['icons'] as $icon) {
        echo '
				\'', $icon['value'], '\': \'', $settings['images_url'] . '/post/' . $icon['value'], '.png\'', $icon['is_last'] ? '' : ',';
    }
    echo '
			};';
    // The actual message icon selector.
    echo '
			function showimage()
			{
				document.images.icons.src = icon_urls[document.forms.postmodify.icon.options[document.forms.postmodify.icon.selectedIndex].value];
			}';
    // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
    if ($context['make_poll']) {
        echo '
			function pollOptions()
			{
				var expire_time = document.getElementById(\'poll_expire\');

				if (isEmptyText(expire_time) || expire_time.value == 0)
				{
					document.forms.postmodify.poll_hide[2].disabled = true;
					if (document.forms.postmodify.poll_hide[2].checked)
						document.forms.postmodify.poll_hide[1].checked = true;
				}
				else
					document.forms.postmodify.poll_hide[2].disabled = false;
			}

			var pollOptionNum = 0, pollTabIndex;
			function addPollOption()
			{
				if (pollOptionNum == 0)
				{
					for (var i = 0, n = document.forms.postmodify.elements.length; i < n; i++)
						if (document.forms.postmodify.elements[i].id.substr(0, 8) == \'options-\')
						{
							pollOptionNum++;
							pollTabIndex = document.forms.postmodify.elements[i].tabIndex;
						}
				}
				pollOptionNum++

				setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<li><label for="options-'), ' + pollOptionNum + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>: <input type="text" name="options['), ' + pollOptionNum + ', JavaScriptEscape(']" id="options-'), ' + pollOptionNum + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text" /></li><li id="pollMoreOptions"></li>'), ');
			}';
    }
    // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
    if ($context['make_event']) {
        echo '
			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

			function generateDays()
			{
				var dayElement = document.getElementById(\'day\'), yearElement = document.getElementById(\'year\'), monthElement = document.getElementById(\'month\');
				var days, selected = dayElement.selectedIndex;

				monthLength[1] = yearElement.options[yearElement.selectedIndex].value % 4 == 0 ? 29 : 28;
				days = monthLength[monthElement.value - 1];

				while (dayElement.options.length)
					dayElement.options[0] = null;

				for (i = 1; i <= days; i++)
					dayElement.options[dayElement.length] = new Option(i, i);

				if (selected < days)
					dayElement.selectedIndex = selected;
			}';
    }
    // End of the javascript, start the form and display the link tree.
    echo '
		// ]]></script>
		<form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="', $context['becomes_approved'] ? '' : 'alert(\'' . $txt['js_post_will_require_approval'] . '\');', 'submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'', $context['post_box_name'], '\', \'guestname\', \'evtitle\', \'question\'], \'options\');" enctype="multipart/form-data">';
    // If the user wants to see how their message looks - the preview section is where it's at!
    echo '
			<div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
				<div class="cat_bar">
					<h3 class="catbg">
						<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
					</h3>
				</div>
				<div class="windowbg">
					<span class="topslice"><span></span></span>
					<div class="content">
						<div class="post" id="preview_body">
							', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
						</div>
					</div>
					<span class="botslice"><span></span></span>
				</div>
			</div><br />';
    if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) {
        echo '
			<input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
    }
    // Start the main table.
    echo '
			<div class="cat_bar">
				<h3 class="catbg">', $context['page_title'], '</h3>
			</div>
			<div>
				<span class="upperframe"><span></span></span>
				<div class="roundframe">', isset($context['current_topic']) ? '
					<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '';
    // If an error occurred, explain what happened.
    echo '
					<div class="errorbox"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
						<dl class="settings narrow">
							<dt>
								<strong style="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'display: none;' : '', '" id="error_serious">', $txt['error_while_submitting'], '</strong>
							</dt>
							<dt class="error" id="error_list">
								', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
							</dt>
						</dl>
					</div>';
    // If this won't be approved let them know!
    if (!$context['becomes_approved']) {
        echo '
					<p class="information">
						<em>', $txt['wait_for_approval'], '</em>
						<input type="hidden" name="not_approved" value="1" />
					</p>';
    }
    // If it's locked, show a message to warn the replyer.
    echo '
					<p class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
						', $txt['topic_locked_no_reply'], '
					</p>';
    // The post header... important stuff
    echo '
					<dl id="post_header" class="settings narrow">';
    // Guests have to put in their name and email...
    if (isset($context['name']) && isset($context['email'])) {
        echo '
						<dt>
							<span', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? ' class="error"' : '', ' id="caption_guestname">', $txt['name'], ':</span>
						</dt>
						<dd>
							<input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
						</dd>';
        if (empty($modSettings['guest_post_no_email'])) {
            echo '
						<dt>
							<span', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</span>
						</dt>
						<dd>
							<input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
						</dd>';
        }
    }
    // Now show the subject box for this post.
    echo '
						<dt>
							<span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
						</dt>
						<dd>
							<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />
						</dd>
						<dt class="clear_left">
							', $txt['message_icon'], ':
						</dt>
						<dd>
							<select name="icon" id="icon" onchange="showimage()">';
    // Loop through each message icon allowed, adding it to the drop down list.
    foreach ($context['icons'] as $icon) {
        echo '
								<option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
    }
    echo '
							</select>
							
							<img src="', $settings['images_url'] . '/post/' . $context['icon'], '.png" name="icons" alt="" style="display: inline-block; vertical-align: middle;margin-left: 1rem;" />
						</dd>
					</dl><hr class="clear" />';
    // Are you posting a calendar event?
    if ($context['make_event']) {
        echo '
					<div id="post_event">
						<fieldset id="event_main">
							<legend><span', isset($context['post_error']['no_event']) ? ' class="error"' : '', ' id="caption_evtitle">', $txt['calendar_event_title'], '</span></legend>
							<input type="text" name="evtitle" maxlength="255" size="60" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
							<div class="smalltext">
								<input type="hidden" name="calendar" value="1" />', $txt['calendar_year'], '
								<select name="year" id="year" tabindex="', $context['tabindex']++, '" onchange="generateDays();">';
        // Show a list of all the years we allow...
        for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) {
            echo '
									<option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '&nbsp;</option>';
        }
        echo '
								</select>
								', $txt['calendar_month'], '
								<select name="month" id="month" onchange="generateDays();">';
        // There are 12 months per year - ensure that they all get listed.
        for ($month = 1; $month <= 12; $month++) {
            echo '
									<option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '&nbsp;</option>';
        }
        echo '
								</select>
								', $txt['calendar_day'], '
								<select name="day" id="day">';
        // This prints out all the days in the current month - this changes dynamically as we switch months.
        for ($day = 1; $day <= $context['event']['last_day']; $day++) {
            echo '
									<option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
        }
        echo '
								</select>
							</div>
						</fieldset>';
        if (!empty($modSettings['cal_allowspan']) || $context['event']['new'] && $context['is_new_post']) {
            echo '
						<fieldset id="event_options">
							<legend>', $txt['calendar_event_options'], '</legend>
							<div class="event_options smalltext">
								<ul class="event_options">';
            // If events can span more than one day then allow the user to select how long it should last.
            if (!empty($modSettings['cal_allowspan'])) {
                echo '
									<li>
										', $txt['calendar_numb_days'], '
										<select name="span">';
                for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++) {
                    echo '
											<option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '&nbsp;</option>';
                }
                echo '
										</select>
									</li>';
            }
            // If this is a new event let the user specify which board they want the linked post to be put into.
            if ($context['event']['new'] && $context['is_new_post']) {
                echo '
									<li>
										', $txt['calendar_post_in'], '
										<select name="board">';
                foreach ($context['event']['categories'] as $category) {
                    echo '
											<optgroup label="', $category['name'], '">';
                    foreach ($category['boards'] as $board) {
                        echo '
												<option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
                    }
                    echo '
											</optgroup>';
                }
                echo '
										</select>
									</li>';
            }
            echo '
								</ul>
							</div>
						</fieldset>';
        }
        echo '
					</div>';
    }
    // If this is a poll then display all the poll options!
    if ($context['make_poll']) {
        echo '
					<div id="edit_poll">
						<fieldset id="poll_main">
							<legend><span ', isset($context['poll_error']['no_question']) ? ' class="error"' : '', '>', $txt['poll_question'], '</span></legend>
							<input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" />
							<ul class="poll_main">';
        // Loop through all the choices and print them out.
        foreach ($context['choices'] as $choice) {
            echo '
								<li>
									<label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>:
									<input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />
								</li>';
        }
        echo '
								<li id="pollMoreOptions"></li>
							</ul>
							<strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong>
						</fieldset>
						<fieldset id="poll_options">
							<legend>', $txt['poll_options'], '</legend>
							<dl class="settings narrow poll_options">
								<dt>
									<label for="poll_max_votes">', $txt['poll_max_votes'], ':</label>
								</dt>
								<dd>
									<input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" class="input_text" />
								</dd>
								<dt>
									<label for="poll_expire">', $txt['poll_run'], ':</label><br />
									<em class="smalltext">', $txt['poll_run_limit'], '</em>
								</dt>
								<dd>
									<input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4" class="input_text" /> ', $txt['days_word'], '
								</dd>
								<dt>
									<label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label>
								</dt>
								<dd>
									<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" />
								</dd>';
        if ($context['poll_options']['guest_vote_enabled']) {
            echo '
								<dt>
									<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
								</dt>
								<dd>
									<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" />
								</dd>';
        }
        echo '
								<dt>
									', $txt['poll_results_visibility'], ':
								</dt>
								<dd>
									<input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label><br />
									<input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label><br />
									<input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? 'disabled="disabled"' : '', ' class="input_radio" /> <label for="poll_results_expire">', $txt['poll_results_after'], '</label>
								</dd>
							</dl>
						</fieldset>
					</div>';
    }
    echo '		<div class="bwgrid">
						<div class="bwcell16">';
    // 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 '			</div>
						<div class="bwcell16">
					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '<br>
						</div>
					</div>
					<div class="bwgrid">
						<div class="bwcell4"><div class="inner_right"> ';
    // If this message has been edited in the past - display when it was.
    if (isset($context['last_modified'])) {
        echo '
					<div class="padding smalltext">
						<strong>', $txt['last_edit'], ':</strong>
						', $context['last_modified'], '
					</div>';
    }
    echo '
						</div></div>
						<div class="bwcell12">';
    // If the admin has enabled the hiding of the additional options - show a link and image for it.
    if (!empty($settings['additional_options_collapsable'])) {
        echo '
					<div id="postAdditionalOptionsHeader">
						<img src="', $settings['images_url'], '/collapse.gif" alt="-" id="postMoreExpand" style="display: none;" /> <strong><a href="#" id="postMoreExpandLink">', $txt['post_additionalopt'], '</a></strong>
					</div>';
    }
    // Display the check boxes for all the standard options - if they are available to the user!
    echo '
					<div id="postMoreOptions" class="smalltext">
						<ul class="post_options nolist">
							', $context['can_notify'] ? '<li><input type="hidden" name="notify" value="0" /><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['notify_replies'] . '</label></li>' : '', '
							', $context['can_lock'] ? '<li><input type="hidden" name="lock" value="0" /><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['lock_topic'] . '</label></li>' : '', '
							<li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['back_to_topic'] . '</label></li>
							', $context['can_sticky'] ? '<li><input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['sticky_after'] . '</label></li>' : '', '
							<li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="input_check" /> ', $txt['dont_use_smileys'], '</label></li>', '
							', $context['can_move'] ? '<li><input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="input_check" ' . (!empty($context['move']) ? 'checked="checked" ' : '') . '/> ' . $txt['move_after2'] . '</label></li>' : '', '
							', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="input_check" ' . (!empty($context['announce']) ? 'checked="checked" ' : '') . '/> ' . $txt['announce_topic'] . '</label></li>' : '', '
							', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
						</ul>
					</div>
						</div>
					</div>';
    // If this post already has attachments on it - give information about them.
    if (!empty($context['current_attachments'])) {
        echo '
					<dl id="postAttachment">
						<dt>
							', $txt['attached'], ':
						</dt>
						<dd class="smalltext">
							<input type="hidden" name="attach_del[]" value="0" />
							', $txt['uncheck_unwatchd_attach'], ':
						</dd>';
        foreach ($context['current_attachments'] as $attachment) {
            echo '
						<dd class="smalltext">
							<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : '', '
							', in_array(substr($attachment['name'], strlen($attachment['name']) - 4, 4), array('.jpg', '.png', '.gif')) ? '<br><img src="' . $scripturl . '?action=dlattach;topic=' . $context['current_topic'] . '.0;attach=' . $attachment['id'] . ';image" style="max-width: 120px;" alt="" />' : '', '
							</label>
						</dd>';
        }
        echo '
					</dl>';
    }
    // Is the user allowed to post any additional ones? If so give them the boxes to do it!
    if ($context['can_post_attachment']) {
        echo '
					<dl id="postAttachment2">
						<dt>
							', $txt['attach'], ':
						</dt>
						<dd class="smalltext">
							<input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
        // Show more boxes only if they aren't approaching their limit.
        if ($context['num_allowed_attachments'] > 1) {
            echo '
							<script type="text/javascript"><!-- // --><![CDATA[
								var allowed_attachments = ', $context['num_allowed_attachments'], ';
								var current_attachment = 1;

								function addAttachment()
								{
									allowed_attachments = allowed_attachments - 1;
									current_attachment = current_attachment + 1;
									if (allowed_attachments <= 0)
										return alert("', $txt['more_attachments_error'], '");

									setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '</a>)\' + \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

									return true;
								}
							// ]]></script>
						</dd>
						<dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
        }
        echo '
						<dd class="smalltext">';
        // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
        if (!empty($modSettings['attachmentCheckExtensions'])) {
            echo '
							', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';
        }
        if (!empty($context['attachment_restrictions'])) {
            echo '
							', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';
        }
        if (!$context['can_post_attachment_unapproved']) {
            echo '
							<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';
        }
        echo '
						</dd>
					</dl>';
    }
    // Is visual verification enabled?
    if ($context['require_verification']) {
        echo '
					<div class="post_verification">
						<span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
							<strong>', $txt['verification'], ':</strong>
						</span>
						', template_control_verification($context['visual_verification_id'], 'all'), '
					</div>';
    }
    // Finally, the submit buttons.
    echo '
					<p class="smalltext" id="shortcuts">
						', $context['browser']['is_firefox'] ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
					</p>
					<p id="post_confirm_buttons" class="righttext">
						', template_control_richedit_buttons($context['post_box_name']);
    // Option to delete an event if user is editing one.
    if ($context['make_event'] && !$context['event']['new']) {
        echo '
						<input type="submit" name="deleteevent" value="', $txt['event_delete'], '" onclick="return confirm(\'', $txt['event_delete_confirm'], '\');" class="button_submit" />';
    }
    echo '
					</p>
				</div>
				<span class="lowerframe"><span></span></span>
			</div>
			<br class="clear" />';
    // Assuming this isn't a new topic pass across the last message id.
    if (isset($context['topic_last_message'])) {
        echo '
			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
    }
    echo '
			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
		</form>';
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[';
    // The functions used to preview a posts without loading a new page.
    echo '
			var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ';
			var make_poll = ', $context['make_poll'] ? 'true' : 'false', ';
			var txt_preview_title = "', $txt['preview_title'], '";
			var txt_preview_fetch = "', $txt['preview_fetch'], '";
			var new_replies = new Array();
			var reply_counter = ', empty($counter) ? 0 : $counter, ';
			function previewPost()
			{';
    if ($context['browser']['is_firefox']) {
        echo '
				// Firefox doesn\'t render <marquee> that have been put it using javascript
				if (document.forms.postmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
				{
					return submitThisOnce(document.forms.postmodify);
				}';
    }
    echo '
				if (window.XMLHttpRequest)
				{
					// Opera didn\'t support setRequestHeader() before 8.01.
					if (\'opera\' in window)
					{
						var test = new XMLHttpRequest();
						if (!(\'setRequestHeader\' in test))
							return submitThisOnce(document.forms.postmodify);
					}
					// !!! Currently not sending poll options and option checkboxes.
					var x = new Array();
					var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', \'icon\', \'guestname\', \'email\', \'evtitle\', \'question\', \'topic\', ', JavaScriptEscape($context['session_var']), '];
					var numericFields = [
						\'board\', \'topic\', \'last_msg\',
						\'eventid\', \'calendar\', \'year\', \'month\', \'day\',
						\'poll_max_votes\', \'poll_expire\', \'poll_change_vote\', \'poll_hide\'
					];
					var checkboxFields = [
						\'ns\'
					];

					for (var i = 0, n = textFields.length; i < n; i++)
						if (textFields[i] in document.forms.postmodify)
						{
							// Handle the WYSIWYG editor.
							if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
								x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
							else
								x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
						}
					for (var i = 0, n = numericFields.length; i < n; i++)
						if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]])
							x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
					for (var i = 0, n = checkboxFields.length; i < n; i++)
						if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
							x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value;

					sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=post2\' + (current_board ? \';board=\' + current_board : \'\') + (make_poll ? \';poll\' : \'\') + \';preview;xml\', x.join(\'&\'), onDocSent);

					document.getElementById(\'preview_section\').style.display = \'\';
					setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
					setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);

					return false;
				}
				else
					return submitThisOnce(document.forms.postmodify);
			}
			function onDocSent(XMLDoc)
			{
				if (!XMLDoc)
				{
					document.forms.postmodify.preview.onclick = new function ()
					{
						return true;
					}
					document.forms.postmodify.preview.click();
				}

				// Show the preview section.
				var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
				setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);

				var bodyText = \'\';
				for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
					bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;

				setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
				document.getElementById(\'preview_body\').className = \'post\';

				// Show a list of errors (if any).
				var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
				var errorList = new Array();
				for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
					errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
				document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
				document.getElementById(\'error_serious\').style.display = errors.getAttribute(\'serious\') == 1 ? \'\' : \'none\';
				setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));

				// Show a warning if the topic has been locked.
				document.getElementById(\'lock_warning\').style.display = errors.getAttribute(\'topic_locked\') == 1 ? \'\' : \'none\';

				// Adjust the color of captions if the given data is erroneous.
				var captions = errors.getElementsByTagName(\'caption\');
				for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
					if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
						document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');

				if (errors.getElementsByTagName(\'post_error\').length == 1)
					document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
				else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
				{
					if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ')
						document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\';
					else
						document.forms.postmodify.', $context['post_box_name'], '.style.border = null;
				}

				// Set the new last message id.
				if (\'last_msg\' in document.forms.postmodify)
					document.forms.postmodify.last_msg.value = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'last_msg\')[0].firstChild.nodeValue;

				// Remove the new image from old-new replies!
				for (i = 0; i < new_replies.length; i++)
					document.getElementById(\'image_new_\' + new_replies[i]).style.display = \'none\';
				new_replies = new Array();

				var ignored_replies = new Array(), ignoring;
				var newPosts = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0] ? XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0].getElementsByTagName(\'post\') : {length: 0};
				var numNewPosts = newPosts.length;
				if (numNewPosts != 0)
				{
					var newPostsHTML = \'<span id="new_replies"><\' + \'/span>\';
					for (var i = 0; i < numNewPosts; i++)
					{
						new_replies[new_replies.length] = newPosts[i].getAttribute("id");

						ignoring = false;
						if (newPosts[i].getElementsByTagName("is_ignored")[0].firstChild.nodeValue != 0)
							ignored_replies[ignored_replies.length] = ignoring = newPosts[i].getAttribute("id");

						newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \' core_posts"><span class="topslice"><span></span></span><div class="content" id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <img src="\' + smf_images_url + \'/', $context['user']['language'], '/new.gif" alt="', $txt['preview_new'], '" id="image_new_\' + newPosts[i].getAttribute("id") + \'" /></div>\';';
    if ($context['can_quote']) {
        echo '
						newPostsHTML += \'<ul class="reset smalltext quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li class="quote_button"><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');"><span>', $txt['bbc_quote'], '</span><\' + \'/a></li></ul>\';';
    }
    echo '
						newPostsHTML += \'<br class="clear" />\';

						if (ignoring)
							newPostsHTML += \'<div id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_prompt" class="smalltext">', $txt['ignoring_user'], '<a href="#" id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a></div>\';

						newPostsHTML += \'<div class="list_posts smalltext" id="msg_\' + newPosts[i].getAttribute("id") + \'_body">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'<\' + \'/div></div><span class="botslice"><span></span></span></div>\';
					}
					setOuterHTML(document.getElementById(\'new_replies\'), newPostsHTML);
				}

				var numIgnoredReplies = ignored_replies.length;
				if (numIgnoredReplies != 0)
				{
					for (var i = 0; i < numIgnoredReplies; i++)
					{
						aIgnoreToggles[ignored_replies[i]] = new smc_Toggle({
							bToggleEnabled: true,
							bCurrentlyCollapsed: true,
							aSwappableContainers: [
								\'msg_\' + ignored_replies[i] + \'_body\',
								\'msg_\' + ignored_replies[i] + \'_quote\',
							],
							aSwapLinks: [
								{
									sId: \'msg_\' + ignored_replies[i] + \'_ignored_link\',
									msgExpanded: \'\',
									msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
								}
							]
						});
					}
				}

				if (typeof(smf_codeFix) != \'undefined\')
					smf_codeFix();
			}';
    // Code for showing and hiding additional options.
    if (!empty($settings['additional_options_collapsable'])) {
        echo '
			var oSwapAdditionalOptions = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
				funcOnBeforeCollapse: function () {
					document.getElementById(\'additional_options\').value = \'0\';
				},
				funcOnBeforeExpand: function () {
					document.getElementById(\'additional_options\').value = \'1\';
				},
				aSwappableContainers: [
					\'postMoreOptions\',
					\'postAttachment\',
					\'postAttachment2\',
					\'postAttachment3\'
				],
				aSwapImages: [
					{
						sId: \'postMoreExpand\',
						srcExpanded: smf_images_url + \'/collapse.gif\',
						altExpanded: \'-\',
						srcCollapsed: smf_images_url + \'/expand.gif\',
						altCollapsed: \'+\'
					}
				],
				aSwapLinks: [
					{
						sId: \'postMoreExpandLink\',
						msgExpanded: ', JavaScriptEscape($txt['post_additionalopt']), ',
						msgCollapsed: ', JavaScriptEscape($txt['post_additionalopt']), '
					}
				]
			});';
    }
    echo '
		// ]]></script>';
    // If the user is replying to a topic show the previous posts.
    if (isset($context['previous_posts']) && count($context['previous_posts']) > 0) {
        echo '
		<div id="recent" class="flow_hidden main_section">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['topic_summary'], '</h3>
			</div>
			<span id="new_replies"></span>';
        $ignored_posts = array();
        foreach ($context['previous_posts'] as $post) {
            $ignoring = false;
            if (!empty($post['is_ignored'])) {
                $ignored_posts[] = $ignoring = $post['id'];
            }
            echo '
				<div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
				<span class="topslice"><span></span></span>
				<div class="content" id="msg', $post['id'], '">
					<div class="floatleft">
						<h5>', $txt['posted_by'], ': ', $post['poster'], '</h5>
						<span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $post['time'], '&nbsp;&#187;</span>
					</div>';
            if ($context['can_quote']) {
                echo '
					<ul class="reset smalltext quickbuttons" id="msg_', $post['id'], '_quote">
						<li class="quote_button"><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');"><span>', $txt['bbc_quote'], '</span></a></li>
					</ul>';
            }
            echo '
					<br class="clear" />';
            if ($ignoring) {
                echo '
					<div id="msg_', $post['id'], '_ignored_prompt" class="smalltext">
						', $txt['ignoring_user'], '
						<a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
					</div>';
            }
            echo '
					<div class="list_posts smalltext" id="msg_', $post['id'], '_body">', $post['message'], '</div>
				</div>
				<span class="botslice"><span></span></span>
			</div>';
        }
        echo '
		</div>
		<script type="text/javascript"><!-- // --><![CDATA[
			var aIgnoreToggles = new Array();';
        foreach ($ignored_posts as $post_id) {
            echo '
			aIgnoreToggles[', $post_id, '] = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: true,
				aSwappableContainers: [
					\'msg_', $post_id, '_body\',
					\'msg_', $post_id, '_quote\',
				],
				aSwapLinks: [
					{
						sId: \'msg_', $post_id, '_ignored_link\',
						msgExpanded: \'\',
						msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
					}
				]
			});';
        }
        echo '
			function insertQuoteFast(messageid)
			{
				if (window.XMLHttpRequest)
					getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), onDocReceived);
				else
					reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=\' + (oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled ? 1 : 0), 240, 90);
				return true;
			}
			function onDocReceived(XMLDoc)
			{
				var text = \'\';
				for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
					text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
				oEditorHandle_', $context['post_box_name'], '.insertText(text, false, true);
			}
		// ]]></script>';
    }
}
Ejemplo n.º 19
0
/**
 * @name      EosAlpha BBS
 * @copyright 2011 Alex Vie silvercircle(AT)gmail(DOT)com
 *
 * 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.0pre
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings, $topic;
    echo '
		<div class="jqmWindow" style="display:none;" id="interpostlink_helper">
		<div class="jqmWindow_container">
		<div class="glass jsconfirm title">', $txt['quick_post_link_title'], '
		</div>
		<div class="blue_container norounded lefttext smalltext mediumpadding mediummargin">', $txt['quick_post_link_text'], '
		<dl class="common left" style="line-height:24px;">
		<dt><strong>', $txt['quick_post_link_bbcode'], '</strong></dt><dd><input size="78" type="text" id="interpostlink_helper_content" value="" /></dd>
		<dt><strong>', $txt['quick_post_link_full'], '</strong></dt><dd><input size="78" type="text" id="interpostlink_helper_content_full" value="" /></dd>
		</dl>
		</div>
		<div class="centertext smalltext smallpadding"><span class="button default centered" onclick="$(\'#interpostlink_helper\').css(\'position\',\'static\');$(\'#interpostlink_helper\').hide();setDimmed(0);">', $txt['quick_post_link_dismiss'], '</span></div>
		</div>
		</div>
		<div id="share_bar" style="display:none;position:absolute;right:0;white-space:nowrap;width:auto;">
		<div class="bmbar">
		 <span role="button" class="button icon share_this share_fb" data-href="http://www.facebook.com/sharer.php?u=%%uri%%">Share</span>
		 <span role="button" class="button icon share_this share_tw" data-href="http://twitter.com/share?text=%%txt%%&amp;url=%%uri%%">Tweet</span>
		 <span role="button" class="button icon share_this share_digg" data-href="http://digg.com/submit?phase=2&amp;title=%%txt%%&amp;url=%%uri%%">Digg</span>
		 <div class="clear"></div>
       	</div>
       	</div>';
    // Let them know, if their report was a success!
    if ($context['report_sent']) {
        echo '
			<div class="windowbg" id="profile_success">
				', $txt['report_sent'], '
			</div>';
    }
    // Show the anchor for the top and for the first message. If the first message is new, say so.
    echo $context['template_hooks']['display']['header'], '
		<a id="top"></a>
		', $context['first_new_message'] ? '<a id="new"></a>' : '';
    echo '<div class="bmbar gradient_darken_down">
	<div class="userbit_compact topic">
	<div class="floatleft">
	<span class="small_avatar">';
    if (!empty($context['topicstarter']['avatar']['image'])) {
        echo '
	<img class="fourtyeight" src="', $context['topicstarter']['avatar']['href'], '" alt="avatar" />';
    } else {
        echo '
	<img class="fourtyeight" src="', $settings['images_url'], '/unknown.png" alt="avatar" />';
    }
    echo '
	</span>
	</div>
	<div class="userbit_compact_textpart">
		 <h1 class="bigheader topic">', $context['prefix'], $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
		 </h1>
	', $txt['started_by'], '&nbsp;', $context['topicstarter']['link'], ', ', $context['topicstarter']['start_time'];
    if ($context['tags_active']) {
        echo '
		<div id="tagstrip" class="tinytext">
		<span id="tags">';
        foreach ($context['topic_tags'] as $i => $tag) {
            echo '
			<a class="tag" href="' . $scripturl . '?action=tags;tagid=' . $tag['ID_TAG'] . '">' . $tag['tag'] . '</a>';
            if ($context['can_delete_tags']) {
                echo '
			<a href="' . $scripturl . '?action=tags;sa=deletetag;tagid=' . $tag['ID'] . '"><span onclick="sendRequest(\'action=xmlhttp;sa=tags;deletetag=1;tagid=' . $tag['ID'] . '\', $(\'#tags\'));return(false);" class="xtag">&nbsp;&nbsp;</span></a>';
            } else {
                echo '
			&nbsp;&nbsp;';
            }
        }
        echo '
		</span>';
        if ($context['can_add_tags']) {
            echo '
			&nbsp;<a rel="nofollow" id="addtag" onclick="$(\'#tagform\').remove();sendRequest(\'action=xmlhttp;sa=tags;addtag=1;topic=', $topic, '\', $(\'#addtag\'));return(false);" data-id="', $topic, '" href="' . $scripturl . '?action=tags;sa=addtag;topic=', $topic, '">' . $txt['smftags_addtag'] . '</a>';
        } else {
            echo '&nbsp;';
        }
        echo '
		</div>
		<br>';
    }
    $notify_href = $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'];
    $notify_confirm = 'return Eos_Confirm(\'\', \'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\', $(this).attr(\'href\'));';
    echo '
		<div class="floatright">', $context['is_marked_notify'] ? $txt['you_are_subscribed'] . ', ' : '', '<a href="', $notify_href, '" onclick="', $notify_confirm, '">', $context['is_marked_notify'] ? $txt['unnotify'] : $txt['you_are_not_subscribed'], '</a>
		</div>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
			<div id="whoisviewing" class="tinytext">';
        // 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'], '
			</div>';
    }
    echo '
	<div class="clear"></div>
	</div>
	</div>
	<div class="floatright tinytext righttext" style="padding:0;line-height:100%;margin:0;">';
    if ($context['can_send_topic']) {
        echo '
		<a href="', $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0">', $txt['email_topic'], '</a><br>';
    }
    echo '
		<a rel="nofollow" href="', $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0', '">', $txt['view_printable'], '</a>';
    echo '
	</div>';
    //'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.gif', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
    //'print' => array('text' => 'print', 'image' => 'print.gif', 'lang' => true, 'custom' => 'rel="nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
    if ($context['use_share']) {
        echo '
	 <div class="title">', $txt['share_topic'], ':</div>
	 <div id="socialshareprivacy"></div><div class="clear"></div>';
    }
    echo '<div class="clear"></div>', $context['template_hooks']['display']['extend_topicheader'], '
	</div>
	', $context['template_hooks']['display']['above_posts'];
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
			<br>
			<div id="poll">
				<div class="cat_bar">
					<h3>
						<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" class="icon" /> ', $txt['poll'], '</span>
					</h3>
				</div>
				<div class="blue_container cleantop">
					<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="smalltext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
						<dd class="smalltext 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 class="smalltext">', $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">';
        // Build the poll moderation button array.
        $poll_buttons = array('vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']), 'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.gif', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'), 'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.gif', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'lock' => array('test' => 'allow_lock_poll', 'text' => !$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock', 'image' => 'poll_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']), 'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.gif', 'lang' => true, 'custom' => 'onclick="return Eos_Confirm(\'\', \'' . $txt['poll_remove_warn'] . '\', $(this).attr(\'href\'));"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']));
        template_button_strip($poll_buttons);
        echo '
			</div>';
    }
    // Does this topic have some events linked to it?
    if (!empty($context['linked_calendar_events'])) {
        echo '
			<div class="orange_container">
				<h3>', $txt['calendar_linked_events'], '</h3>
					<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/modify_small.gif" 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>';
    }
    // Build the normal button array.
    $normal_buttons = array('reply' => array('test' => 'can_reply', 'text' => 'reply', 'custom' => 'onclick="return oQuickReply.quote(0);" ', 'image' => 'reply.gif', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true), 'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']), 'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']));
    // Allow adding new buttons easily.
    HookAPI::callHook('integrate_display_buttons', array(&$normal_buttons));
    // Show the page index... "Pages: [1]".
    echo '
			<div class="pagesection top">';
    if ($context['multiquote_posts_count'] > 0) {
        echo '
				<div class="floatright tinytext red_container alert mediummargin mq_remove_msg">', sprintf($txt['posts_marked_mq'], $context['multiquote_posts_count']), ',&nbsp;<a href="#" onclick="return oQuickReply.clearAllMultiquote(', $context['current_topic'], ');">', $txt['remove'], '</a></div>';
    }
    echo '
				<div class="nextlinks">', $context['previous_next'], '</div>', template_button_strip($normal_buttons, 'right');
    echo '<div class="pagelinks floatleft">', $context['page_index'], $context['menu_separator'] . ' &nbsp;&nbsp;<a class="navPages topdown" href="#lastPost">' . $txt['go_down'] . '</a></div>
			</div>';
    // Show the topic information - icon, subject, etc.
    echo '
			<div id="forumposts">';
    echo '
		 <form data-alt="', $scripturl, '?action=post;msg=%id_msg%;topic=', $context['current_topic'], '.', $context['start'], '" 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">
		  <div class="posts_container nopadding" id="posts_container">';
    $removableMessageIDs = array();
    // Get all the messages...
    while ($message = $context['get_message']()) {
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        $message['postbit_callback']($message);
    }
    echo '
		  </div>
		  <input type="hidden" name="goadvanced" value="1" />
		 </form>
		</div>
		<a id="lastPost"></a>
		', $context['template_hooks']['display']['below_posts'];
    $remove_url = $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id'];
    $mod_buttons = array('move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.gif', 'lang' => true, 'url' => $scripturl . '?action=movetopic;topic=' . $context['current_topic'] . '.0'), 'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.gif', 'lang' => true, 'custom' => 'onclick="return Eos_Confirm(\'\',\'' . $txt['are_sure_remove_topic'] . '\',\'' . $remove_url . '\');"', 'url' => $remove_url), 'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.gif', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.gif', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.gif', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']), 'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.gif', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'));
    // Restore topic. eh?  No monkey business.
    if ($context['can_restore_topic']) {
        $mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
    }
    // Allow adding new mod buttons easily.
    HookAPI::callHook('integrate_mod_buttons', array(&$mod_buttons));
    echo '
		<div id="moderationbuttons">', template_button_strip($mod_buttons, 'right', array('id' => 'moderationbuttons_strip', 'class' => 'plainbuttonlist')), '</div>';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
			<a id="quickreply"></a>
			<div class="clear"></div>
			<div style="display:none;overflow:hidden;" id="quickreplybox">';
        echo '
					<div class="cat_bar">
					 <strong>', $txt['post_reply'], '</strong>&nbsp;&nbsp;<a href="', $scripturl, '?action=helpadmin;help=quickreply_help', '" onclick="return reqWin(this.href);" class="help tinytext">', $txt['post_reply_help'], '</a>
					</div>
					<div class="flat_container mediumpadding">';
        echo '
							<input type="hidden" name="_qr_board" value="', $context['current_board'], '" />
							<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 />';
        }
        if (isset($context['user']['avatar']['image']) && !empty($context['user']['avatar']['image'])) {
            echo '
					<div class="floatleft blue_container smallpadding avatar">', $context['user']['avatar']['image'], '
					</div>';
        }
        echo '
							<div class="quickReplyContent" style="margin-left:150px;">';
        echo $context['is_locked'] ? '<div class="red_container tinytext">' . $txt['quick_reply_warning'] . '</div>' : '', $context['oldTopicError'] ? '<div class="red_container tinytext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</div>' : '', '
						', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
						', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '';
        echo '
								<textarea id="quickReplyMessage" style="width:99%;" rows="18" name="message" tabindex="', $context['tabindex']++, '"></textarea>';
        if ($context['automerge']) {
            echo '
								<input type="checkbox" name="want_automerge" id="want_automerge" checked="checked" value="1" />', $txt['want_automerge'];
        }
        echo '
								</div>
								<div class="righttext 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['go_advanced'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="submit" name="cancel" value="', 'Cancel', '" onclick="return(oQuickReply.cancel());" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />
						</div>
				</div>
				<br>
			</div>';
    }
    $context['inline_footer_script'] .= '
	var smf_likelabel = \'' . $txt['like_label'] . '\';
	var smf_unlikelabel = \'' . $txt['unlike_label'] . '\'
	';
    // Show the page index... "Pages: [1]".
    echo '
			<div class="pagesection bottom">
				', template_button_strip($normal_buttons, 'right');
    if ($context['multiquote_posts_count'] > 0) {
        echo '
				<div class="floatright clear_right tinytext red_container alert mediummargin mq_remove_msg">', sprintf($txt['posts_marked_mq'], $context['multiquote_posts_count']), ',&nbsp;<a href="#" onclick="return oQuickReply.clearAllMultiquote(', $context['current_topic'], ');">', $txt['remove'], '</a></div>';
    }
    echo '
				<div class="pagelinks floatleft">', $context['page_index'], $context['menu_separator'] . ' &nbsp;&nbsp;<a class="navPages topdown" href="#top">' . $txt['go_up'] . '</a></div>
				<div class="nextlinks_bottom">', $context['previous_next'], '</div>
			</div>';
    // Added by Related Topics
    if (!empty($context['related_topics'])) {
        echo '
			<h1 class="bigheader">', $txt['related_topics'], '</h1>
			<div class="tborder topic_table">
				<table class="table_grid mlist">
					<thead>
						<tr>';
        // Are there actually any topics to show?
        if (!empty($context['related_topics'])) {
            echo '
							<th scope="col" class="blue_container smalltext first_th" style="width:8%;">&nbsp;</th>
							<th scope="col" class="blue_container smalltext">', $txt['subject'], ' / ', $txt['started_by'], '</th>
							<th scope="col" class="blue_container smalltext centertext" style="width:14%;">', $txt['replies'], '</th>
							<th scope="col" class="blue_container smalltext last_th" style="width:22%;">', $txt['last_post'], '</th>';
        } else {
            echo '
							<th scope="col" class="red_container smalltext first_th">&nbsp;</th>
							<th class="smalltext red_container" colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th>
							<th scope="col" class="red_container smalltext last_th" width="8%">&nbsp;</th>';
        }
        echo '
						</tr>
					</thead>
					<tbody>';
        foreach ($context['related_topics'] as $topic) {
            // Is this topic pending approval, or does it have any posts pending approval?
            $color_class = 'gradient_darken_down';
            // Some columns require a different shade of the color class.
            $alternate_class = $color_class . '2';
            echo '
						<tr>
							<td class="icon1 ', $color_class, '">
								<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
							</td>
							<td class="subject ', $alternate_class, '">
								<div ', !empty($topic['quick_mod']['modify']) ? 'id="topic_' . $topic['first_post']['id'] . '" onmouseout="mouse_on_div = 0;" onmouseover="mouse_on_div = 1;" ondblclick="modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\', \'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');"' : '', '>
									', $topic['is_sticky'] ? '<strong>' : '', '<span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], !$topic['board']['can_approve_posts'] && !$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : '', '</span>', $topic['is_sticky'] ? '</strong>' : '';
            // Is this topic new? (assuming they are logged in!)
            if ($topic['new'] && $context['user']['is_logged']) {
                echo '
									<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['images_url'], '/new.png" alt="', $txt['new'], '" /></a>';
            }
            echo '
									<p>', $txt['started_by'], ' ', $topic['first_post']['member']['link'], '
										<small id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '</small>
										<small>', $topic['board']['link'], '</small>
									</p>
								</div>
							</td>
							<td style="padding:2px 5px;" class="nowrap stats ', $color_class, '">
								', $topic['replies'], ' ', $txt['replies'], '
								<br />
								', $topic['views'], ' ', $txt['views'], '
							</td>
							<td class="lastpost ', $alternate_class, '">', $txt['by'], ': ', $topic['last_post']['member']['link'], '<br />
								<a class="lp_link" title="', $txt['last_post'], '" href="', $topic['last_post']['href'], '">', $topic['last_post']['time'], '</a>
							</td>
						</tr>';
        }
        echo '
				</table>
			</div><br />';
    }
    echo $context['template_hooks']['display']['footer'];
    // Show the lower breadcrumbs.
    theme_linktree();
    // Show the jumpto box, or actually...let Javascript do it.
    echo '
			<div class="plainbox" id="display_jump_to">&nbsp;</div>';
    $context['inline_footer_script'] .= '
	var oQuickReply = new QuickReply({
		bDefaultCollapsed: ' . (!empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true') . ',
		iTopicId: ' . $context['current_topic'] . ',
		iStart: ' . $context['start'] . ',
		sScriptUrl: smf_scripturl,
		sImagesUrl: "' . $settings['images_url'] . '",
		sContainerId: "quickReplyOptions",
		sImageId: "quickReplyExpand",
		sImageCollapsed: "collapse.gif",
		sImageExpanded: "expand.gif",
		iMarkedForMQ: ' . $context['multiquote_posts_count'] . ',
		sJumpAnchor: "quickreplybox",
		bEnabled: ' . (!empty($options['display_quick_reply']) ? 'true' : 'false') . '
	});
	';
    if (!empty($options['display_quick_mod']) && $context['can_remove_post']) {
        $context['inline_footer_script'] .= '
	var oInTopicModeration = new InTopicModeration({
		sSelf: \'oInTopicModeration\',
		sCheckboxContainerMask: \'in_topic_mod_check_\',
		aMessageIds: [\'' . implode('\', \'', $removableMessageIDs) . '\'],
		sSessionId: \'' . $context['session_id'] . '\',
		sSessionVar: \'' . $context['session_var'] . '\',
		sButtonStrip: \'moderationbuttons\',
		sButtonStripDisplay: \'moderationbuttons_strip\',
		bUseImageButton: false,
		bCanRemove: ' . ($context['can_remove_post'] ? 'true' : 'false') . ',
		sRemoveButtonLabel: \'' . $txt['quickmod_delete_selected'] . '\',
		sRemoveButtonImage: \'delete_selected.gif\',
		sRemoveButtonConfirm: \'' . $txt['quickmod_confirm'] . '\',
		bCanRestore: ' . ($context['can_restore_msg'] ? 'true' : 'false') . ',
		sRestoreButtonLabel: \'' . $txt['quick_mod_restore'] . '\',
		sRestoreButtonImage: \'restore_selected.gif\',
		sRestoreButtonConfirm: \'' . $txt['quickmod_confirm'] . '\',
		sFormId: \'quickModForm\'
	});
	';
    }
    $context['inline_footer_script'] .= '
	if (\'XMLHttpRequest\' in window)
	{
		var oQuickModify = new QuickModify({
		sScriptUrl: smf_scripturl,
		bShowModify: ' . ($settings['show_modify'] ? 'true' : 'false') . ',
		iTopicId: ' . $context['current_topic'] . ',
		sTemplateBodyEdit: ' . JavaScriptEscape('
			<div id="quick_edit_body_container">
			<div id="error_box" style="padding: 4px;" class="error"></div>
			<textarea class="editor" name="message" rows="20" style="' . ($context['browser']['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="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
			<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
			<input type="hidden" name="msg" value="%msg_id%" />
			<input type="hidden" style="width: 50%;" name="subject" value="%subject%" size="50" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />
			<div class="righttext">
				<span class="button floatright" onclick="return oQuickModify.goAdvanced(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" />' . $txt['go_advanced'] . '</a></span>
				<span class="button floatright" onclick="return oQuickModify.modifyCancel();" >' . $txt['modify_cancel'] . '</span>
				<span class="button floatright" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s">' . $txt['save'] . '</span>
			</div>
			</div>') . ',
		sTemplateSubjectEdit: ' . JavaScriptEscape('<input type="text" style="width: 50%;" name="subject_edit" value="%subject%" size="50" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />') . ',
		sTemplateBodyNormal: ' . JavaScriptEscape('%body%') . ',
		sTemplateSubjectNormal: ' . JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>') . ',
		sTemplateTopSubject: ' . JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')') . ',
		sErrorBorderStyle: ' . JavaScriptEscape('1px solid red') . '
		});

		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'] . '"
		});
	}
	';
    if (!empty($ignoredMsgs)) {
        $context['inline_footer_script'] .= '';
    }
    $context['inline_footer_script'] .= '
	function getIntralink(e, mid) {
		var tid = ' . $context['current_topic'] . ';
		var _sid = "#subject_" + mid;
		var el = $("#interpostlink_helper");
		el.css("position", "fixed");
		var _content = "[ilink topic=" + tid + " post=" + mid + "]" + $(_sid).html().trim() + "[/ilink]";
		$("#interpostlink_helper_content").val(_content);
		$("#interpostlink_helper_content_full").val(e.attr("href"));
		centerElement(el, -200);
		el.css("z-index", 9999);
		setDimmed(1);
		el.show();
		$("#interpostlink_helper_content").focus();
		$("#interpostlink_helper_content").select();
	}
	$(document).keydown(function(e) {
		if(e.keyCode == 27 && $("#interpostlink_helper").css("display") != "none") {
        	$("#interpostlink_helper").css("position", "static");
        	$("#interpostlink_helper").hide();
			setDimmed(0);
    	}
	});
	var topic_id = ' . $context['current_topic'] . ';
	';
}
Ejemplo n.º 20
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Show the anchor for the top and for the first message.  If the first message is new, say so.
    echo '
<a id="top"></a>
<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
    // Show the linktree as well as the "Who's Viewing" information.
    echo '
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
		<td align="center" class="smalltext">';
        // 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']) or $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'], '</td>';
    }
    // Show the previous/next links.
    echo '
		<td valign="bottom" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext">
			<span class="nav">', $context['previous_next'], '</span>
		</td>
	</tr>
</table>';
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
	<tr class="titlebg">
		<td colspan="2" valign="middle" style="padding-left: 6px;">
			<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="top" /> ', $txt['poll'], '
		</td>
	</tr>
	<tr class="windowbg">
		<td width="5%" valign="top"><strong>', $txt['poll_question'], ':</strong></td>
		<td>
			', $context['poll']['question'];
        if (!empty($context['poll']['expire_time'])) {
            echo '
			&nbsp;(', $context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on'], ': ', $context['poll']['expire_time'], ')';
        }
        // Are they not allowed to vote but allowed to view the options?
        if ($context['poll']['show_results'] || !$context['allow_vote']) {
            echo '
			<table>
				<tr>
					<td style="padding-top: 2ex;">
						<table border="0" cellpadding="0" cellspacing="0">';
            // Show each option with its corresponding percentage bar.
            foreach ($context['poll']['options'] as $option) {
                echo '
							<tr>
								<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
								<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
							</tr>';
            }
            echo '
						</table>
					</td>
					<td valign="bottom" style="padding-left: 15px;">';
            // If they are allowed to revote - show them a link!
            if ($context['allow_change_vote']) {
                echo '
						<a href="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['poll_change_vote'], '</a><br />';
            }
            // If we're viewing the results... maybe we want to go back and vote?
            if ($context['allow_return_vote']) {
                echo '
						<a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_return_vote'], '</a><br />';
            }
            // If they're allowed to lock the poll, show a link!
            if ($context['poll']['lock']) {
                echo '
						<a href="', $scripturl, '?action=lockvoting;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', !$context['poll']['is_locked'] ? $txt['poll_lock'] : $txt['poll_unlock'], '</a><br />';
            }
            // If they're allowed to edit the poll... guess what... show a link!
            if ($context['poll']['edit']) {
                echo '
						<a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_edit'], '</a><br />';
            }
            if ($context['can_remove_poll']) {
                echo '
						<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">', $txt['poll_remove'], '</a>';
            }
            echo '
					</td>
				</tr>', $context['allow_poll_view'] ? '
				<tr>
					<td colspan="2"><strong>' . $txt['poll_total_voters'] . ': ' . $context['poll']['total_votes'] . '</strong></td>
				</tr>' : '', '
			</table><br />';
        } else {
            echo '
			<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;">
				<table>
					<tr>
						<td colspan="2">';
            // Show a warning if they are allowed more than one option.
            if ($context['poll']['allowed_warning']) {
                echo '
							', $context['poll']['allowed_warning'], '
						</td>
					</tr><tr>
						<td>';
            }
            // Show each option with its button - a radio likely.
            foreach ($context['poll']['options'] as $option) {
                echo '
							<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br />';
            }
            echo '
						</td>
						<td valign="bottom" style="padding-left: 15px;">';
            // Allowed to view the results? (without voting!)
            if ($context['show_view_results_button']) {
                echo '
							<a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';viewresults">', $txt['poll_results'], '</a><br />';
            }
            // Show a link for locking the poll as well...
            if ($context['poll']['lock']) {
                echo '
							<a href="', $scripturl, '?action=lockvoting;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', !$context['poll']['is_locked'] ? $txt['poll_lock'] : $txt['poll_unlock'], '</a><br />';
            }
            // Want to edit it?  Click right here......
            if ($context['poll']['edit']) {
                echo '
							<a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_edit'], '</a><br />';
            }
            if ($context['can_remove_poll']) {
                echo '
						<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">', $txt['poll_remove'], '</a>';
            }
            echo '
						</td>
					</tr><tr>
						<td colspan="2"><input type="submit" value="', $txt['poll_vote'], '" class="button_submit" /></td>
					</tr>
				</table>
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			</form>';
        }
        echo '
		</td>
	</tr>
</table>';
    }
    // Does this topic have some events linked to it?
    if (!empty($context['linked_calendar_events'])) {
        echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
	<tr class="titlebg">
		<td colspan="2" valign="middle" align="left" style="padding-left: 6px;">
			', $txt['calendar_linked_events'], '
		</td>
	</tr>
	<tr class="windowbg">
		<td width="5%" valign="top">
			<ul>';
        foreach ($context['linked_calendar_events'] as $event) {
            echo '
				<li>
					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : '', '<strong>', $event['title'], '</strong>: ', $event['start_date'], $event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '', '
				</li>';
        }
        echo '
			</ul>
		</td>
	</tr>
</table>';
    }
    // Show the page index... "Pages: [1]".
    echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-bottom: 1ex;">
	<tr>
		<td class="catbg" width="100%" height="35">
			<table cellpadding="3" cellspacing="0" width="100%">
				<tr>
					<td>
						<strong>', $txt['pages'], ':</strong> ', $context['page_index'];
    // Show a "go down" link?
    if (!empty($modSettings['topbottomEnable'])) {
        echo $context['menu_separator'], '<a href="#bot">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/go_down.gif" alt="' . $txt['go_down'] . '" border="0" align="top" />' : $txt['go_down'], '</a>';
    }
    echo '
					</td>
					<td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller;">';
    $buttonArray = array();
    if ($context['can_reply']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/reply.gif" alt="' . $txt['reply'] . '" border="0" />' : $txt['reply']) . '</a>';
    }
    if ($context['can_mark_notify']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $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['lang_images_url'] . '/' . ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif" alt="' . $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify'] . '" border="0" />' : $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify']) . '</a>';
    }
    // This is a special case; if they can see mark unread, put it at the top... otherwise show add poll.
    if ($context['user']['is_logged'] && $settings['show_mark_read']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/markunread.gif" alt="' . $txt['mark_unread'] . '" border="0" />' : $txt['mark_unread']) . '</a>';
    } elseif ($context['can_add_poll']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/addpoll.gif" alt="' . $txt['add_poll'] . '" border="0" />' : $txt['add_poll']) . '</a>';
    }
    if ($context['can_send_topic']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/sendtopic.gif" alt="' . $txt['send_topic'] . '" border="0" />' : $txt['send_topic']) . '</a>';
    }
    $buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" rel="new_win nofollow">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/print.gif" alt="' . $txt['print'] . '" border="0" />' : $txt['print']) . '</a>';
    echo implode($context['menu_separator'], $buttonArray);
    echo '</td>
				</tr>
			</table>
		</td>
	</tr>
</table>';
    // Show the topic information - icon, subject, etc.
    echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
	<tr class="titlebg">
		<td valign="middle" width="15%" style="padding-left: 6px;">
			<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" alt="" align="middle" /> ', $txt['author'], '
		</td>
		<td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject">
			', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
		</td>
	</tr>
</table>

<form action="', $scripturl, '?action=quickmod2;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;" onsubmit="return oQuickModify.bInEditMode ? oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\') : false;">

<table cellpadding="0" cellspacing="0" border="0" width="100%" class="bordercolor">';
    $removableMessageIDs = array();
    // Get all the messages...
    while ($message = $context['get_message']()) {
        if ($message['can_remove']) {
            $removableMessageIDs[] = $message['id'];
        }
        echo '
	<tr><td style="padding: 1px 1px 0 1px;">';
        // Show the message anchor and a "new" anchor if this message is new.
        if ($message['id'] != $context['first_message']) {
            echo '
		<a id="msg', $message['id'], '"></a>', $message['first_new'] ? '<a id="new"></a>' : '';
        }
        echo '
		<table width="100%" cellpadding="3" cellspacing="0" border="0">
			<tr><td class="', $message['approved'] ? $message['alternate'] == 0 ? 'windowbg' : 'windowbg2' : 'approvebg', '">';
        // Show information about the poster of this message.
        echo '
				<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
					<tr>
						<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
							<strong>', $message['member']['link'], '</strong>
							<div class="smalltext">';
        // Show the member's custom title, if they have one.
        if (isset($message['member']['title']) && $message['member']['title'] != '') {
            echo '
								', $message['member']['title'], '<br />';
        }
        // Show the member's primary group (like 'Administrator') if they have one.
        if (isset($message['member']['group']) && $message['member']['group'] != '') {
            echo '
								', $message['member']['group'], '<br />';
        }
        // Don't show these things for guests.
        if (!$message['member']['is_guest']) {
            // 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.
            if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') {
                echo '
								', $message['member']['post_group'], '<br />';
            }
            echo '
								', $message['member']['group_stars'], '<br />';
            // Is karma display enabled?  Total or +/-?
            if ($modSettings['karmaMode'] == '1') {
                echo '
								<br />
								', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
            } elseif ($modSettings['karmaMode'] == '2') {
                echo '
								<br />
								', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';
            }
            // Is this user allowed to modify this member's karma?
            if ($message['member']['karma']['allow']) {
                echo '
								<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
								<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';
            }
            // Show online and offline buttons?
            if (!empty($modSettings['onlineEnable'])) {
                echo '
								', $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 />';
            }
            // Show the member's gender icon?
            if (!empty($settings['show_gender']) && $message['member']['gender']['image'] != '' && !isset($context['disabled_fields']['gender'])) {
                echo '
								', $txt['gender'], ': ', $message['member']['gender']['image'], '<br />';
            }
            // Show how many posts they have made.
            if (!isset($context['disabled_fields']['posts'])) {
                echo '
								', $txt['member_postcount'], ': ', $message['member']['posts'], '<br />';
            }
            // Any custom fields for standard placement?
            if (!empty($message['member']['custom_fields'])) {
                foreach ($message['member']['custom_fields'] as $custom) {
                    if (empty($custom['placement']) || empty($custom['value'])) {
                        echo '
								', $custom['title'], ': ', $custom['value'], '<br />';
                    }
                }
            }
            echo '<br />';
            // Show avatars, images, etc.?
            if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) {
                echo '
								<div style="overflow: auto; width: 100%;">', $message['member']['avatar']['image'], '</div><br />';
            }
            // Show their personal text?
            if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '') {
                echo '
								', $message['member']['blurb'], '<br />
								<br />';
            }
            // Any custom fields to show as icons?
            if (!empty($message['member']['custom_fields'])) {
                foreach ($message['member']['custom_fields'] as $custom) {
                    if ($custom['placement'] == 1 || empty($custom['value'])) {
                        echo '
								', $custom['value'];
                    }
                }
            }
            // This shows the popular messaging icons.
            if ($message['member']['has_messenger'] && $message['member']['can_view_profile']) {
                echo '
								', !isset($context['disabled_fields']['icq']) ? $message['member']['icq']['link'] : '', '
								', !isset($context['disabled_fields']['msn']) ? $message['member']['msn']['link'] : '', '
								', !isset($context['disabled_fields']['aim']) ? $message['member']['aim']['link'] : '', '
								', !isset($context['disabled_fields']['yim']) ? $message['member']['yim']['link'] : '', '
								<br />';
            }
            // Show the profile, website, email address, and personal message buttons.
            if ($settings['show_profile_buttons']) {
                // Don't show the profile button if you're not allowed to view the profile.
                if ($message['member']['can_view_profile']) {
                    echo '
								<a href="', $message['member']['href'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.gif" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '" border="0" />' : $txt['view_profile'], '</a>';
                }
                // Don't show an icon if they haven't specified a website.
                if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) {
                    echo '
								<a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.gif" alt="' . $message['member']['website']['title'] . '" border="0" />' : $txt['www'], '</a>';
                }
                // Don't show the email address if they want it hidden.
                if (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum'))) {
                    echo '
								<a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email'], '</a>';
                }
                // Since we know this person isn't a guest, you *can* message them.
                if ($context['can_send_pm']) {
                    echo '
								<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" border="0" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a>';
                }
            }
        } elseif (in_array($message['member']['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) && $message['member']['email']) {
            echo '
								<br />
								<br />
								<a href="', $scripturl, '?action=emailuser;sa=email;msg=', $message['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/email_sm.gif" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" border="0" />' : $txt['email'], '</a>';
        }
        // Done with the information about the poster... on to the post itself.
        echo '
							</div>
						</td>
						<td valign="top" width="85%" height="100%">
							<table width="100%" border="0"><tr>
								<td valign="middle"><img src="', $message['icon_url'] . '" alt="" border="0"', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' /></td>
								<td valign="middle">
									<div style="font-weight: bold;" id="subject_', $message['id'], '">
										<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
									</div>';
        // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
        echo '
									<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div></td>
								<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';
        // Maybe we can approve it, maybe we should?
        if ($message['can_approve']) {
            echo '
									<a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/approve.gif" alt="' . $txt['approve'] . '" border="0" />' : $txt['approve'], '</a>';
        }
        // Can they reply?  Have they turned on quick reply?
        if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
            echo '
									<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], '" onclick="return oQuickReply.quote(', $message['id'], ');">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/quote.gif" alt="' . $txt['reply_quote'] . '" border="0" />' : $txt['reply_quote'], '</a>';
        } elseif ($context['can_reply']) {
            echo '
									<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/quote.gif" alt="' . $txt['reply_quote'] . '" border="0" />' : $txt['reply_quote'], '</a>';
        }
        // Can the user modify the contents of this post?
        if ($message['can_modify']) {
            echo '
									<a href="', $scripturl, '?action=post;msg=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/modify.gif" alt="' . $txt['modify_msg'] . '" border="0" />' : $txt['modify'], '</a>';
        }
        // How about... even... remove it entirely?!
        if ($message['can_remove']) {
            echo '
									<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'], '?\');">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/delete.gif" alt="' . $txt['remove_message'] . '" border="0" />' : $txt['remove'], '</a>';
        }
        // What about splitting it off the rest of the topic?
        if ($context['can_split'] && !empty($context['num_replies'])) {
            echo '
									<a href="', $scripturl, '?action=splittopics;topic=', $context['current_topic'], '.0;at=', $message['id'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/split.gif" alt="' . $txt['split'] . '" border="0" />' : $txt['split'], '</a>';
        }
        // Show a checkbox for quick moderation?
        if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $message['can_remove']) {
            echo '
									<div style="display: none;" id="in_topic_mod_check_', $message['id'], '"></div>';
        }
        // Show the post itself, finally!
        echo '
								</td>
							</tr></table>
							<hr width="100%" size="1" class="hrcolor" />
							<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
							<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" title="' . $txt['modify_msg'] . '" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer;" onclick="oQuickModify.modifyMsg(\'' . $message['id'] . '\')" />' : '', '
						</td>
					</tr>';
        // Now for the attachments, signature, ip logged, etc...
        echo '
					<tr>
						<td valign="bottom" class="smalltext" width="85%">
							<table width="100%" border="0" style="table-layout: fixed;"><tr>
								<td colspan="2" class="smalltext" width="100%">';
        // Assuming there are attachments...
        if (!empty($message['attachment'])) {
            echo '
									<hr width="100%" size="1" class="hrcolor" />
									<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', '; width: 100%;">';
            $last_approved_state = 1;
            foreach ($message['attachment'] as $attachment) {
                // Show a special box for unpproved attachments...
                if ($attachment['is_approved'] != $last_approved_state) {
                    $last_approved_state = 0;
                    echo '
									<fieldset>
										<legend>', $txt['attach_awaiting_approve'], '&nbsp;[<a href="', $scripturl, '?action=attachapprove;sa=all;mid=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve_all'], '</a>]</legend>';
                }
                if ($attachment['is_image']) {
                    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'], '" border="0" /></a><br />';
                    } else {
                        echo '
									<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
                    }
                }
                echo '
										<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> ';
                if (!$attachment['is_approved']) {
                    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 '
										(', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
            }
            // If we had unapproved attachments clean up.
            if ($last_approved_state == 0) {
                echo '
									</fieldset>';
            }
            echo '
									</div>';
        }
        echo '
								</td>
							</tr><tr>
								<td valign="bottom" class="smalltext" id="modified_', $message['id'], '">';
        // Show "� Last Edit: Time by Person �" if this post was edited.
        if ($settings['show_modify'] && !empty($message['modified']['name'])) {
            echo '
									&#171; <em>', $txt['last_edit'], ': ', $message['modified']['time'], ' ', $txt['by'], ' ', $message['modified']['name'], '</em> &#187;';
        }
        echo '
								</td>
								<td align="', !$context['right_to_left'] ? 'right' : 'left', '" valign="bottom" class="smalltext">';
        // Maybe they want to report this post to the moderator(s)?
        if ($context['can_report_moderator']) {
            echo '
									<a href="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $message['counter'], ';msg=', $message['id'], '">', $txt['report_to_mod'], '</a> &nbsp;';
        }
        echo '
									<img src="', $settings['images_url'], '/ip.gif" alt="" border="0" />';
        // Show the IP to this user for this post - because you can moderate?
        if ($context['can_moderate_forum'] && !empty($message['member']['ip'])) {
            echo '
									<a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';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>';
        } elseif ($message['can_see_ip']) {
            echo '
									<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $message['member']['ip'], '</a>';
        } elseif (!$context['user']['is_guest']) {
            echo '
									<a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqWin(this.href);" class="help">', $txt['logged'], '</a>';
        } else {
            echo '
									', $txt['logged'];
        }
        echo '
								</td>
							</tr></table>';
        // 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">', $message['member']['signature'], '</div>';
        }
        echo '
						</td>
					</tr>
				</table>
			</td></tr>
		</table>
	</td></tr>';
    }
    echo '
	<tr><td style="padding: 0 0 1px 0;"></td></tr>
</table>
<a id="lastPost"></a>

<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-top: 1ex;">
	<tr>
		<td class="catbg" width="100%" height="30">
			<table cellpadding="3" cellspacing="0" width="100%">
				<tr>
					<td>
						<a id="bot"></a><strong>', $txt['pages'], ':</strong> ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '<a href="#top">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/go_up.gif" alt="' . $txt['go_up'] . '" border="0" align="top" />' : $txt['go_up']) . '</a>' : '', '
					</td>
					<td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller;">';
    $buttonArray = array();
    if ($context['can_reply']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/reply.gif" alt="' . $txt['reply'] . '" border="0" />' : $txt['reply']) . '</a>';
    }
    if ($context['can_mark_notify']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $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['lang_images_url'] . '/' . ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif" alt="' . $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify'] . '" border="0" />' : $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify']) . '</a>';
    }
    // Another special case, similar to above but reversed.  Show "add poll" unless they can't - then show unread here too.
    if ($context['can_add_poll']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/addpoll.gif" alt="' . $txt['add_poll'] . '" border="0" />' : $txt['add_poll']) . '</a>';
    } elseif ($context['user']['is_logged'] && $settings['show_mark_read']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/markunread.gif" alt="' . $txt['mark_unread'] . '" border="0" />' : $txt['mark_unread']) . '</a>';
    }
    if ($context['can_send_topic']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/sendtopic.gif" alt="' . $txt['send_topic'] . '" border="0" />' : $txt['send_topic']) . '</a>';
    }
    $buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank" class="new_win">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/print.gif" alt="' . $txt['print'] . '" border="0" />' : $txt['print']) . '</a>';
    echo implode($context['menu_separator'], $buttonArray);
    echo '&nbsp;
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr>';
    if ($settings['linktree_inline']) {
        echo '
		<td valign="top">', theme_linktree(), '</td> ';
    }
    echo '
		<td valign="top" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext"> <span class="nav"> ', $context['previous_next'], '</span></td>
	</tr>
</table>
<div style="padding-top: 4px; padding-bottom: 4px;" id="moderationbuttons">', theme_show_mod_buttons(), '</div>';
    echo '
</form>';
    echo '
<div class="righttext" style="margin-bottom: 1ex;" id="display_jump_to">&nbsp;</div><br />';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
<a id="quickreply"></a>
<table border="0" cellspacing="1" cellpadding="3" class="clear bordercolor" width="100%">
	<tr>
		<td colspan="2" class="catbg"><a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" border="0" id="quickReplyExpand" /></a> <a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a></td>
	</tr>
	<tr id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
		<td class="windowbg" width="25%" valign="top">', $txt['quick_reply_desc'], $context['is_locked'] ? '<br /><br /><strong>' . $txt['quick_reply_warning'] . '</strong>' : '', '</td>
		<td class="windowbg" width="75%" align="center">
			', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
			', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
			<form action="', $scripturl, '?action=post2', empty($context['current_board']) ? '' : ';board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
				<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="num_replies" value="', $context['num_replies'], '" />';
        // 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" />
				<strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" /><br />';
        }
        // Is visual verification enabled?
        if ($context['require_verification']) {
            echo '
				<strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';
        }
        echo '
				<textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="', $context['tabindex']++, '"></textarea><br />
				<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="2" class="button_submit" tabindex="', $context['tabindex']++, '" />
				<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="4" class="button_submit" tabindex="', $context['tabindex']++, '" />';
        if ($context['show_spellchecking']) {
            echo '
				<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" class="button_submit" />';
        }
        echo '
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
			</form>
		</td>
	</tr>
</table>';
    }
    if ($context['show_spellchecking']) {
        echo '
<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>
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
    }
    echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[';
    if (!empty($options['display_quick_reply'])) {
        echo '
	var oQuickReply = new QuickReply({
		bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ',
		iTopicId: ', $context['current_topic'], ',
		iStart: ', $context['start'], ',
		sScriptUrl: smf_scripturl,
		sImagesUrl: "', $settings['images_url'], '",
		sContainerId: "quickReplyOptions",
		sImageId: "quickReplyExpand",
		sImageCollapsed: "collapse.gif",
		sImageExpanded: "expand.gif",
		sJumpAnchor: "quickreply"
	});';
    }
    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: \'', $context['session_id'], '\',
		sSessionVar: \'', $context['session_var'], '\',
		sButtonStrip: \'moderationbuttons\',
		bUseImageButton: true,
		bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
		sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
		sRemoveButtonImage: \'', $settings['lang_images_url'], '/delete_selected.gif\',
		sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
		sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
		sRestoreButtonImage: \'', $settings['lang_images_url'], '/restore_selected.gif\',
		sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		sFormId: \'quickModForm\'
	});';
    }
    echo '
	if (\'XMLHttpRequest\' in window)
	{
		var oQuickModify = new QuickModify({
			sScriptUrl: smf_scripturl,
			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" style="padding: 4px;" class="error"></div>
					<textarea class="editor" name="message" rows="12" style="' . ($context['browser']['is_ie8'] ? 'max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
					<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['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="8" 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="9" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="9" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
					</div>
				</div>'), ',
			sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%" name="subject" value="%subject%" size="80" maxlength="80" tabindex="6" class="input_text" />'), ',
			sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
			sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
			sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
			sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
		});
		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: "', $context['session_id'], '",
			sSessionVar: "', $context['session_var'], '",
			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"
		});
	}
// ]]></script>';
}
Ejemplo n.º 21
0
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings, $counter;
    echo '
	<form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" enctype="multipart/form-data">';
    // If the user wants to see how their message looks - the preview section is where it's at!
    echo '
		<ul data-role="listview" data-inset="true" ', isset($context['preview_message']) ? '' : 'style="display: none;"', '>
			<li>
				<h3>
					<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
				</h3>
			</li>
			<li>
				<div class="post" id="preview_body">
					', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
				</div>
			</li>
		</ul>';
    if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) {
        echo '
		<input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
    }
    if (isset($context['current_topic'])) {
        echo '
		<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />';
    }
    // If an error occurred, explain what happened.
    echo '
		<ul data-role="listview" data-inset="true" ', empty($context['post_error']['messages']) ? 'style="display: none"' : '', '>
			<li>
				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '" id="errors">
					<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
					', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
				</div>
			</li>
		</ul>';
    // If this won't be approved let them know!
    if (!$context['becomes_approved']) {
        echo '
		<ul data-role="listview" data-inset="true">	
			<li class="information">
				<em>', $txt['wait_for_approval'], '</em>
				<input type="hidden" name="not_approved" value="1" />
			</li>
		</ul>';
    }
    // If it's locked, show a message to warn the replyer.
    echo '
		<ul data-role="listview" data-inset="true">
			<li class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
				', $txt['topic_locked_no_reply'], '
			</pli>
		</ul>';
    // The post header... important stuff
    // Start the main table.
    echo '<ul data-role="listview" data-inset="true">
			<li data-role="list-divider">', $context['page_title'], '</li>';
    // Guests have to put in their name and email...
    if (isset($context['name']) && isset($context['email'])) {
        echo '
			<li>
				<label for="guestname">', $txt['name'], ':</label>
				<input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" />';
        if (empty($modSettings['guest_post_no_email'])) {
            echo '
				<label for="email">', $txt['email'], ':</label>
				<input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" />';
        }
        echo '
			</li>';
    }
    // Now show the subject box for this post.
    echo '
			<li>
				<label for="subject" >', $txt['subject'], ':</label>
				<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', ' placeholder="', $txt['subject'], '" />
			</li>';
    echo '
			<li>
				<label for="icon">', $txt['message_icon'], ':<span><img src="', $context['icon_url'], '" name="icons" id="message_icon" hspace="15" alt="" /></span></label>
				
				<select name="icon" id="icon">';
    // Loop through each message icon allowed, adding it to the drop down list.
    foreach ($context['icons'] as $icon) {
        echo '
					<option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
    }
    echo '
				</select>
				<script><!-- // --><![CDATA[
						$(document).ready ( function () {
							$("#icon").bind("change", function () {
								// Get the value of the selected option
								var img_name = $(this).val();
								var url = "' . $settings['images_url'] . '/post/";
								if (img_name) {	
									$("#message_icon").attr("src", url + img_name + ".png");
								}
								return false;
							});
						});
				// ]]></script>
			</li>';
    // If this is a poll then display all the poll options!
    if ($context['make_poll']) {
        echo '
			<li>
				<span ', isset($context['poll_error']['no_question']) ? ' class="error"' : '', '>', $txt['poll_question'], '</span>
				<input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" />
			</li>
			<li id="pollMoreOptions">';
        // Loop through all the choices and print them out.
        foreach ($context['choices'] as $choice) {
            echo '
			
				<label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], ':</label>
				<input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />';
        }
        // Some javascript for adding more options.
        echo '	
				<script>
					var pollOptionNum = 0;
					var pollOptionId = ', $context['last_choice_id'], ';

					function addPollOption()
					{
						if (pollOptionNum == 0)
						{
							for (var i = 0; i < document.forms.postmodify.elements.length; i++)
								if (document.forms.postmodify.elements[i].id.substr(0, 8) == "options-")
									pollOptionNum++;
						}
						pollOptionNum++
						pollOptionId++

						$("#pollMoreOptions").append(\'<label class="ui-input-text" for="options-\' + pollOptionId + \'" ', isset($context['poll_error']['no_question']) ? ' class="error"' : '', '>', $txt['option'], ' \' + pollOptionNum + \':</label><input class="input_text ui-input-text ui-body-c ui-corner-all ui-shadow-inset" type="text" name="options[\' + (pollOptionId) + \']" id="options-\' + (pollOptionId) + \'" value="" size="80" maxlength="255" class="input_text" />\');
					}
				</script>
			</li>
			<li><strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong></li>
			
			<li>	
				<fieldset id="poll_options">
					<legend>', $txt['poll_options'], '</legend>

					<label for="poll_max_votes">', $txt['poll_max_votes'], ':</label>
					<input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" class="input_text" />

					<label for="poll_expire">', $txt['poll_run'], ': (', $txt['days_word'], ')</label>
					<span>', $txt['poll_run_limit'], '</span>
					<input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4" class="input_text" />

					<label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label>
					<input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" />';
        if ($context['poll_options']['guest_vote_enabled']) {
            echo '

					<label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
					<input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" />';
        }
        echo '
					', $txt['poll_results_visibility'], ':

					<input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label>
					<input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label>
					<input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? 'disabled="disabled"' : '', ' class="input_radio" /> <label for="poll_results_expire">', $txt['poll_results_after'], '</label>
				</fieldset>
			</li>';
    }
    echo '
			<li>
			', template_control_richedit($context['post_box_name']), '
			</li>
		</ul>
	<div data-role="collapsible" data-theme="b" data-content-theme="d">
		<h3>', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</h3>';
    // Display the check boxes for all the standard options - if they are available to the user!
    if ($context['can_notify']) {
        echo '
		<div data-role="fieldcontain">
			<input type="hidden" name="notify" value="0" />	
			<label for="notify">', $txt['notify_replies'], '</label>
			<select name="notify" id="notify" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . ($context['notify'] || !empty($options['auto_notify']) ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    if ($context['can_lock']) {
        echo '
		<div data-role="fieldcontain">
			<input type="hidden" name="lock" value="0" />				
			<label for="check_lock">', $txt['lock_topic'], '</label>
			<select name="lock" id="check_lock" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . ($context['locked'] ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    echo '
		<div data-role="fieldcontain">				
			<label for="check_back">', $txt['back_to_topic'], '</label>
			<select name="goback" id="check_back" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    if ($context['can_sticky']) {
        echo '
		<div data-role="fieldcontain">			
			<label for="check_sticky">', $txt['sticky_after'], '</label>
			<select name="sticky" id="check_sticky" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . ($context['sticky'] ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    echo '
		<div data-role="fieldcontain">
			<input type="hidden" name="check_smileys" value="0" />				
			<label for="check_smileys">', $txt['dont_use_smileys'], '</label>
			<select name="ns" id="check_smileys" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"', $context['use_smileys'] ? '' : ' selected="selected"', '>', $txt['yes'], '</option>
			</select>
		</div>';
    if ($context['can_move']) {
        echo '
		<div data-role="fieldcontain">				
			<label for="check_move">', $txt['move_after2'], '</label>
			<select name="move" id="check_move" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . (!empty($context['move']) ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    if ($context['can_announce'] && $context['is_first_post']) {
        echo '
		<div data-role="fieldcontain">			
			<label for="check_announce">', $txt['announce_topic'], '</label>
			<select name="announce_topic" id="check_announce" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . (!empty($context['announce']) ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    if ($context['show_approval']) {
        echo '
		<div data-role="fieldcontain">				
			<label for="check_announce">', $txt['announce_topic'], '</label>
			<select name="announce_topic" id="check_announce" data-role="slider" data-theme="c">
				<option value="0">', $txt['no'], '</option>
				<option value="1"' . ($context['show_approval'] === 2 ? ' selected="selected"' : '') . '>', $txt['yes'], '</option>
			</select>
		</div>';
    }
    echo '
		<div id="postMoreOptions" class="smalltext">
			<ul class="post_options">
				', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
			</ul>
		</div>';
    // If this post already has attachments on it - give information about them.
    if (!empty($context['current_attachments'])) {
        echo '
		<dl id="postAttachment">
			<dt>
				', $txt['attached'], ':
			</dt>
			<dd class="smalltext">
				<input type="hidden" name="attach_del[]" value="0" />
				', $txt['uncheck_unwatchd_attach'], ':
			</dd>';
        foreach ($context['current_attachments'] as $attachment) {
            echo '
			<dd class="smalltext">
				<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : '', !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label>
			</dd>';
        }
        if (!empty($context['files_in_session_warning'])) {
            echo '
			<dd class="smalltext">', $context['files_in_session_warning'], '</dd>';
        }
        echo '
		</dl>';
    }
    // Is the user allowed to post any additional ones? If so give them the boxes to do it!
    if ($context['can_post_attachment']) {
        echo '
		<dl id="postAttachment2">';
        // But, only show them if they haven't reached a limit. Or a mod author hasn't hidden them.
        if ($context['num_allowed_attachments'] > 0 || !empty($context['dont_show_them'])) {
            echo '
			<dt>
				', $txt['attach'], ':
			</dt>
			<dd class="smalltext">
				', empty($modSettings['attachmentSizeLimit']) ? '' : '<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '" />', '
				<input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
            // Show more boxes if they aren't approaching that limit.
            if ($context['num_allowed_attachments'] > 1) {
                echo '
				<script type="text/javascript"><!-- // --><![CDATA[
					var allowed_attachments = ', $context['num_allowed_attachments'], ';
					var current_attachment = 1;

					function addAttachment()
					{
						allowed_attachments = allowed_attachments - 1;
						current_attachment = current_attachment + 1;
						if (allowed_attachments <= 0)
							return alert("', $txt['more_attachments_error'], '");

						setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '<\\/a>)\' + \'<\\/dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');

						return true;
					}
				// ]]></script>
			</dd>
			<dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
            } else {
                echo '
			</dd>';
            }
        }
        // Add any template changes for an alternative upload system here.
        call_integration_hook('integrate_upload_template', array());
        echo '
			<dd class="smalltext">';
        // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
        if (!empty($modSettings['attachmentCheckExtensions'])) {
            echo '
				', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';
        }
        if (!empty($context['attachment_restrictions'])) {
            echo '
				', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';
        }
        if ($context['num_allowed_attachments'] == 0) {
            echo '
				', $txt['attach_limit_nag'], '<br />';
        }
        if (!$context['can_post_attachment_unapproved']) {
            echo '
				<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';
        }
        echo '
			</dd>
		</dl>';
    }
    echo '
	</div>';
    // Is visual verification enabled?
    if ($context['require_verification']) {
        echo '
					<div class="post_verification">
						<span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
							<strong>', $txt['verification'], ':</strong>
						</span>
						', template_control_verification($context['visual_verification_id'], 'all'), '
					</div>';
    }
    // Finally, the submit buttons.
    echo template_control_richedit_buttons($context['post_box_name']);
    // Assuming this isn't a new topic pass across the last message id.
    if (isset($context['topic_last_message'])) {
        echo '
			<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
    }
    echo '
			<input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
		</form>';
}
Ejemplo n.º 22
0
/**
 * @name      EosAlpha BBS
 * @copyright 2011 Alex Vie silvercircle(AT)gmail(DOT)com
 *
 * 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.0pre
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    echo '
	<form action="', $scripturl, '?action=search2" method="post" accept-charset="UTF-8" name="searchform" id="searchform">
		<div class="bigheader">';
    if (isset($modSettings['search_index']) && $modSettings['search_index'] == 'sphinx') {
        echo '<div class="floatright">
					Powered by: <a href="http://sphinxsearch.com"><img src="', $settings['images_url'], '/theme/sphinx.jpg" alt="sphinxlogo" style="vertical-align:middle;" /></a>
					</div>';
    }
    echo '<span class="ie6_header floatleft">', $txt['set_parameters'], '</span>
			<div class="clear"></div>
		</div>
		<div class="blue_container">';
    if (!empty($context['search_errors'])) {
        echo '
		<p id="search_error" class="error">', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    // Simple Search?
    if ($context['simple_search']) {
        echo '
		<fieldset id="simple_search">
			<div>
				<div id="search_term_input">
					<strong>', $txt['search_for'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
					', $context['require_verification'] ? '' : '&nbsp;<input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<p class="smalltext">', $txt['search_example'], '</p>';
        }
        if ($context['require_verification']) {
            echo '
				<div class="verification>
					<strong>', $txt['search_visual_verification_label'], ':</strong>
					<br />', template_control_verification($context['visual_verification_id'], 'all'), '<br />
					<input id="submit" type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        }
        echo '
				<a href="', $scripturl, '?action=search;advanced" onclick="this.href += \';search=\' + escape(document.forms.searchform.search.value);">', $txt['search_advanced'], '</a>
				<input type="hidden" name="advanced" value="0" />
			</div>
			<span class="lowerframe"><span></span></span>
		</fieldset>';
    } else {
        echo '
		<fieldset id="advanced_search">
			<div>
				<input type="hidden" name="advanced" value="1" />
				<span class="enhanced">
					<strong>', $txt['search_for'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
					<script type="text/javascript"><!-- // --><![CDATA[
						function initSearch()
						{
							if (document.forms.searchform.search.value.indexOf("%u") != -1)
								document.forms.searchform.search.value = unescape(document.forms.searchform.search.value);
						}
						createEventListener(window);
						window.addEventListener("load", initSearch, false);
					// ]]></script>
					<select name="searchtype">
						<option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['all_words'], '</option>
						<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['any_words'], '</option>
					</select>
				</span>';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<em class="smalltext">', $txt['search_example'], '</em>';
        }
        echo '
				<dl id="search_options">
					<dt>', $txt['by_user'], ':</dt>
					<dd><input id="userspec" type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" /></dd>
					<dt>', $txt['search_order'], ':</dt>
					<dd>
						<select id="sort" name="sort">
							<option value="relevance|desc">', $txt['search_orderby_relevant_first'], '</option>
							<option value="num_replies|desc">', $txt['search_orderby_large_first'], '</option>
							<option value="num_replies|asc">', $txt['search_orderby_small_first'], '</option>
							<option value="id_msg|desc">', $txt['search_orderby_recent_first'], '</option>
							<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
						</select>
					</dd>
					<dt class="options">', $txt['search_options'], ':</dt>
					<dd class="options">
						<label for="show_complete"><input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['search_show_complete_messages'], '</label><br />
						<label for="subject_only"><input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['search_subject_only'], '</label>
					</dd>
					<dt class="between">', $txt['search_post_age'], ': </dt>
					<dd>', $txt['search_between'], ' <input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;', $txt['search_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '</dd>
				</dl>';
        // Require an image to be typed to save spamming?
        if ($context['require_verification']) {
            echo '
				<p>
					<strong>', $txt['verification'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</p>';
        }
        // If $context['search_params']['topic'] is set, that means we're searching just one topic.
        if (!empty($context['search_params']['topic'])) {
            echo '
				<p>', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.</p>
				<input type="hidden" name="topic" value="', $context['search_topic']['id'], '" />';
        }
        echo '
			</div>
		</fieldset>';
        if (empty($context['search_params']['topic'])) {
            $collapser = array('id' => 'search_boards', 'title' => $txt['choose_board'], 'bodyclass' => 'flat_container');
            template_create_collapsible_container($collapser);
            echo '
		<fieldset class="flow_hidden">
			<div>
				<div class="flow_auto" id="searchBoardsExpand">';
            template_boardlisting('brd');
            echo '
		</div>
		<br class="clear" />';
            echo '
		<div class="padding">
			<input type="checkbox" name="all" id="check_all" value=""', $context['boards_check_all'] ? ' checked="checked"' : '', ' onclick="invertAll(this, this.form, \'brd\');" class="input_check floatleft" />
			<label for="check_all" class="floatleft">', $txt['check_all'], '</label>
		</div>
		<br class="clear" />
		</div>
		</fieldset>';
            echo '
		</div>';
        }
    }
    echo '
	<input style="margin-top:5px;" type="submit" name="submit" value="', $txt['search'], '" class="button_submit floatright" />
	<div class="clear"></div>
	</div>
	</form>

	<script type="text/javascript"><!-- // --><![CDATA[
		function selectBoards(ids)
		{
			var toggle = true;

			for (i = 0; i < ids.length; i++)
				toggle = toggle & document.forms.searchform["brd" + ids[i]].checked;

			for (i = 0; i < ids.length; i++)
				document.forms.searchform["brd" + ids[i]].checked = !toggle;
		}

		function expandCollapseBoards()
		{
			$("#searchBoardsExpand").toggle();
			$("#expandBoardsIcon").attr("src", smf_images_url + ($("#searchBoardsExpand").is(":visible") ? "/collapse.gif" : "/expand.gif"));
		}';
    echo '
	// ]]></script>';
}
Ejemplo n.º 23
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2012 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 Alpha 1
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    echo '
	<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform">
		<div class="cat_bar">
			<h3 class="catbg">
				', !empty($settings['use_buttons']) ? '<img src="' . $settings['images_url'] . '/buttons/search.png" alt="" class="icon" />' : ' ', $txt['set_parameters'], '
			</h3>
		</div>';
    if (!empty($context['search_errors'])) {
        echo '
		<p class="errorbox">', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    // Simple Search?
    if ($context['simple_search']) {
        echo '
		<fieldset id="simple_search">
			<div class="roundframe">
				<div id="search_term_input">
					<strong>', $txt['search_for'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
					', $context['require_verification'] ? '' : '&nbsp;<input type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<p class="smalltext">', $txt['search_example'], '</p>';
        }
        if ($context['require_verification']) {
            echo '
				<div class="verification>
					<strong>', $txt['search_visual_verification_label'], ':</strong>
					<br />', template_control_verification($context['visual_verification_id'], 'all'), '<br />
					<input id="submit" type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit" />
				</div>';
        }
        echo '
				<a href="', $scripturl, '?action=search;advanced" onclick="this.href += \';search=\' + escape(document.forms.searchform.search.value);">', $txt['search_advanced'], '</a>
				<input type="hidden" name="advanced" value="0" />
			</div>
		</fieldset>';
    } else {
        echo '
			<div class="roundframe">
				<dl class="settings" id="search_options">
					<dt class="righttext">
						<strong><label for="searchfor">', $txt['search_for'], ':</label></strong>
					</dt>
					<dd>
						<input type="text" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />';
        if (empty($modSettings['search_simple_fulltext'])) {
            echo '
				<em class="smalltext">', $txt['search_example'], '</em>';
        }
        echo '
					</dd>

					<dt class="righttext"><label for="searchtype">', $txt['search_match'], ':</label>
					</dt>
					<dd>
						<select name="searchtype" id="searchtype">
							<option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['all_words'], '</option>
							<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['any_words'], '</option>
						</select>
					</dd>
					<dt class="righttext"><label for="userspec">', $txt['by_user'], ':</label>
					</dt>
					<dd>
						<input id="userspec" type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" />
					</dd>
					<dt class="righttext"><label for="sort">', $txt['search_order'], ':</label>
					</dt>
					<dd>
						<select id="sort" name="sort">
							<option value="relevance|desc">', $txt['search_orderby_relevant_first'], '</option>
							<option value="num_replies|desc">', $txt['search_orderby_large_first'], '</option>
							<option value="num_replies|asc">', $txt['search_orderby_small_first'], '</option>
							<option value="id_msg|desc">', $txt['search_orderby_recent_first'], '</option>
							<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
						</select>
					</dd>
					<dt class="righttext options">', $txt['search_options'], ':
					</dt>
					<dd class="options">
						<label for="show_complete">', $txt['search_show_complete_messages'], '
							<input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" />
						</label><br />
						<label for="subject_only">', $txt['search_subject_only'], '
							<input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" />
						</label>
					</dd>
					<dt class="righttext between">', $txt['search_post_age'], ':
					</dt>
					<dd><label for="minage">', $txt['search_between'], '</label><input type="text" name="minage" id="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;<label for="maxage">', $txt['search_and'], '&nbsp;</label><input type="text" name="maxage" id="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '
					</dd>
				</dl>
				</fieldset>
				<script type="text/javascript"><!-- // --><![CDATA[
					createEventListener(window);
					window.addEventListener("load", initSearch, false);
				// ]]></script>
				<input type="hidden" name="advanced" value="1" />';
        // Require an image to be typed to save spamming?
        if ($context['require_verification']) {
            echo '
				<p>
					<strong>', $txt['verification'], ':</strong>
					', template_control_verification($context['visual_verification_id'], 'all'), '
				</p>';
        }
        // If $context['search_params']['topic'] is set, that means we're searching just one topic.
        if (!empty($context['search_params']['topic'])) {
            echo '
				<p>', $txt['search_specific_topic'], ' &quot;', $context['search_topic']['link'], '&quot;.</p>
				<input type="hidden" name="topic" value="', $context['search_topic']['id'], '" />';
        }
        echo '
			</div>
		';
        if (empty($context['search_params']['topic'])) {
            echo '
		<fieldset class="flow_hidden">
			<div class="roundframe">
				<div class="title_bar">
					<h4 class="titlebg">
						<span class="floatright">
							<a href="javascript:void(0);" onclick="expandCollapseBoards(); return false;"><img src="', $settings['images_url'], '/expand.png" id="expandBoardsIcon" alt=""  class="icon"/></a>
						</span>
						<span>
							<a href="javascript:void(0);" onclick="expandCollapseBoards(); return false;"><strong>', $txt['choose_board'], '</strong></a>
						</span>
					</h4>
				</div>
				<div class="flow_auto" id="searchBoardsExpand"', $context['boards_check_all'] ? ' style="display: none;"' : '', '>
					<ul class="ignoreboards floatleft">';
            $i = 0;
            $limit = ceil($context['num_boards'] / 2);
            foreach ($context['categories'] as $category) {
                echo '
						<li class="category">
							<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'searchform\'); return false;">', $category['name'], '</a>
							<ul>';
                foreach ($category['boards'] as $board) {
                    if ($i == $limit) {
                        echo '
							</ul>
						</li>
					</ul>
					<ul class="ignoreboards floatright">
						<li class="category">
							<ul>';
                    }
                    echo '
								<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
									<label for="brd', $board['id'], '">
										<input type="checkbox" id="brd', $board['id'], '" name="brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '
									</label>
								</li>';
                    $i++;
                }
                echo '
							</ul>
						</li>';
            }
            echo '
					</ul>
				</div>
				<br class="clear" />';
            echo '
				<div class="padding flow_auto">
					<input type="checkbox" name="all" id="check_all" value=""', $context['boards_check_all'] ? ' checked="checked"' : '', ' onclick="invertAll(this, this.form, \'brd\');" class="input_check floatleft" />
					<label for="check_all" class="floatleft"><em>', $txt['check_all'], '</em></label>
					<input type="submit" name="b_search" value="', $txt['search'], '" class="button_submit" />
				</div>
			</div>
		</fieldset>';
        }
        echo '
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oAddMemberSuggest = new smc_AutoSuggest({
				sSelf: \'oAddMemberSuggest\',
				sSessionId: smf_session_id,
				sSessionVar: smf_session_var,
				sControlId: \'userspec\',
				sSearchType: \'member\',
				bItemList: false
			});
		// ]]></script>';
    }
    echo '
	</form>';
}