예제 #1
0
function template_sidebar_memberlist()
{
    global $context, $settings, $scripturl, $txt;
    echo '
	<div>';
    // Display each of the column headers of the table.
    $sortlist = '';
    foreach ($context['columns'] as $column) {
        // We're not able (through the template) to sort the search results right now...
        //if (isset($context['old_search']))
        //	echo $column['label'];
        // This is a selected column, so underline it or some such.
        if (isset($column['selected']) || isset($column['link'])) {
            if ($column['selected']) {
                $sortlist .= '<li><span class="button" style="width:80%;"><a href="' . $column['href'] . '" rel="nofollow">' . $column['label'] . ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" /></a></span><br><br></li>';
            } else {
                $sortlist .= '<li><span class="button" style="width:80%;">' . $column['link'] . '</span><br><br></li>';
            }
        }
    }
    if (strlen($sortlist)) {
        $sortcontent = array('id' => 'mlist_sortform', 'title' => 'Sort', 'content' => '
			<ol class="centertext" style="list-style:none;">' . $sortlist . '</ol>');
        template_create_collapsible_container($sortcontent);
    }
    $formcontent = array('id' => 'mlist_sform', 'title' => $txt['mlist_search'], 'bodyclass' => 'cContainer_body mediumpadding flow_hidden');
    template_create_collapsible_container($formcontent);
    echo '
		<form action="' . $scripturl . '?action=mlist;sa=search" method="post" accept-charset="UTF-8">
		 <div id="mlist_search" class="flow_hidden">
		  <div id="search_term_input">
		   <input type="text" name="search" value="' . $context['old_search'] . '" size="35" class="input_text" />
		  </div>
		  <span class="floatleft tinytext">';
    $count = 0;
    if (isset($context['search_fields'])) {
        foreach ($context['search_fields'] as $id => $title) {
            echo '
			<label for="fields-', $id, '"><input type="checkbox" name="fields[]" id="fields-', $id, '" value="' . $id . '" ', in_array($id, $context['search_defaults']) ? 'checked="checked"' : '', ' class="input_check" />', $title, '</label><br />';
        }
    }
    echo '
		  </span>
	     </div>
	     <br>
		 <div class="centertext">
 	 	  <input type="submit" name="submit" value="' . $txt['search'] . '" class="button_submit" />
 	 	 </div>
		</form>
		<div class="cContainer_end"></div>
	   </div>
	</div>';
}
예제 #2
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>';
}
예제 #3
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_permission_index()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;
    // Not allowed to edit?
    if (!$context['can_modify']) {
        echo '
	<div class="errorbox">
		', sprintf($txt['permission_cannot_edit'], $scripturl . '?action=admin;area=permissions;sa=profiles'), '
	</div>';
    }
    echo '
	<div id="admincenter">
		<form action="', $scripturl, '?action=admin;area=permissions;sa=quick" method="post" accept-charset="UTF-8" name="permissionForm" id="permissionForm">';
    if (!empty($context['profile'])) {
        echo '
			<div class="cat_bar">
				<h3>', $txt['permissions_for_profile'], ': &quot;', $context['profile']['name'], '&quot;</h3>
			</div>';
    }
    echo '
			<table style="width:100%;" class="table_grid mlist mediumpadding">
				<thead>
					<tr>
						<th class="glass">', $txt['membergroups_name'], '</th>
						<th class="glass centertext" style="width:100%;">', $txt['membergroups_members_top'], '</th>';
    if (empty($modSettings['permission_enable_deny'])) {
        echo '
						<th class="glass" width="16%" align="center">', $txt['membergroups_permissions'], '</th>';
    } else {
        echo '
						<th class="glass" width="8%" align="center">', $txt['permissions_allowed'], '</th>
						<th class="glass" width="8%" align="center">', $txt['permissions_denied'], '</th>';
    }
    echo '
						<th class="glass centertext" style="width:8%;">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
						<th class="glass centertext" class="last_th" style="width:4%;">
							', $context['can_modify'] ? '<input type="checkbox" class="input_check" onclick="invertAll(this, this.form, \'group\');" />' : '', '
						</th>
					</tr>
				</thead>
				<tbody>';
    $alternate = false;
    foreach ($context['groups'] as $group) {
        $alternate = !$alternate;
        echo '
					<tr class="windowbg', $alternate ? '2' : '', '">
						<td class="nowrap">
							', $group['name'], $group['id'] == -1 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_guests" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 0 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_regular_members" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 1 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_administrator" onclick="return reqWin(this.href);">?</a>)' : ($group['id'] == 3 ? ' (<a href="' . $scripturl . '?action=helpadmin;help=membergroup_moderator" onclick="return reqWin(this.href);">?</a>)' : '')));
        if (!empty($group['children'])) {
            echo '
							<br /><span class="smalltext">', $txt['permissions_includes_inherited'], ': &quot;', implode('&quot;, &quot;', $group['children']), '&quot;</span>';
        }
        echo '
						</td>
						<td align="center">', $group['can_search'] ? $group['link'] : $group['num_members'], '</td>';
        if (empty($modSettings['permission_enable_deny'])) {
            echo '
						<td width="16%" align="center">', $group['num_permissions']['allowed'], '</td>';
        } else {
            echo '
						<td width="8%" align="center"', $group['id'] == 1 ? ' style="font-style: italic;"' : '', '>', $group['num_permissions']['allowed'], '</td>
						<td width="8%" align="center"', $group['id'] == 1 || $group['id'] == -1 ? ' style="font-style: italic;"' : (!empty($group['num_permissions']['denied']) ? ' style="color: red;"' : ''), '>', $group['num_permissions']['denied'], '</td>';
        }
        echo '
						<td align="center">', $group['allow_modify'] ? '<a href="' . $scripturl . '?action=admin;area=permissions;sa=modify;group=' . $group['id'] . (empty($context['profile']) ? '' : ';pid=' . $context['profile']['id']) . '">' . ($context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view']) . '</a>' : '', '</td>
						<td align="center">', $group['allow_modify'] && $context['can_modify'] ? '<input type="checkbox" name="group[]" value="' . $group['id'] . '" class="input_check" />' : '', '</td>
					</tr>';
    }
    echo '
				</tbody>
			</table>
			<br />';
    // Advanced stuff...
    if ($context['can_modify']) {
        $collapser = array('id' => 'permission_panel_advanced_div', 'title' => $txt['permissions_advanced_options']);
        template_create_collapsible_container($collapser);
        echo '
				<div class="content">
					<fieldset>
						<legend>', $txt['permissions_with_selection'], '</legend>
						<dl class="settings admin_permissions">
							<dt>
								', $txt['permissions_apply_pre_defined'], ' <a href="', $scripturl, '?action=helpadmin;help=permissions_quickgroups" onclick="return reqWin(this.href);">(?)</a>:
							</dt>
							<dd>
								<select name="predefined">
									<option value="">(', $txt['permissions_select_pre_defined'], ')</option>
									<option value="restrict">', $txt['permitgroups_restrict'], '</option>
									<option value="standard">', $txt['permitgroups_standard'], '</option>
									<option value="moderator">', $txt['permitgroups_moderator'], '</option>
									<option value="maintenance">', $txt['permitgroups_maintenance'], '</option>
								</select>
							</dd>
							<dt>
								', $txt['permissions_like_group'], ':
							</dt>
							<dd>
								<select name="copy_from">
									<option value="empty">(', $txt['permissions_select_membergroup'], ')</option>';
        foreach ($context['groups'] as $group) {
            if ($group['id'] != 1) {
                echo '
									<option value="', $group['id'], '">', $group['name'], '</option>';
            }
        }
        echo '
								</select>
							</dd>
							<dt>
								<select name="add_remove">
									<option value="add">', $txt['permissions_add'], '...</option>
									<option value="clear">', $txt['permissions_remove'], '...</option>';
        if (!empty($modSettings['permission_enable_deny'])) {
            echo '
									<option value="deny">', $txt['permissions_deny'], '...</option>';
        }
        echo '
								</select>
							</dt>
							<dd style="overflow:auto;">
								<select name="permissions">
									<option value="">(', $txt['permissions_select_permission'], ')</option>';
        foreach ($context['permissions'] as $permissionType) {
            if ($permissionType['id'] == 'membergroup' && !empty($context['profile'])) {
                continue;
            }
            foreach ($permissionType['columns'] as $column) {
                foreach ($column as $permissionGroup) {
                    if ($permissionGroup['hidden']) {
                        continue;
                    }
                    echo '
									<option value="" disabled="disabled">[', $permissionGroup['name'], ']</option>';
                    foreach ($permissionGroup['permissions'] as $perm) {
                        if ($perm['hidden']) {
                            continue;
                        }
                        if ($perm['has_own_any']) {
                            echo '
									<option value="', $permissionType['id'], '/', $perm['own']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['own']['name'], ')</option>
									<option value="', $permissionType['id'], '/', $perm['any']['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], ' (', $perm['any']['name'], ')</option>';
                        } else {
                            echo '
									<option value="', $permissionType['id'], '/', $perm['id'], '">&nbsp;&nbsp;&nbsp;', $perm['name'], '</option>';
                        }
                    }
                }
            }
        }
        echo '
								</select>
							</dd>
						</dl>
					</fieldset>
					<div class="righttext">
						<input type="submit" value="', $txt['permissions_set_permissions'], '" onclick="return checkSubmit();" class="button_submit" />
					</div>
				</div>
			</div>';
        // Javascript for the advanced stuff.
        echo '
	<script type="text/javascript"><!-- // --><![CDATA[
		function checkSubmit()
		{
			if ((document.forms.permissionForm.predefined.value != "" && (document.forms.permissionForm.copy_from.value != "empty" || document.forms.permissionForm.permissions.value != "")) || (document.forms.permissionForm.copy_from.value != "empty" && document.forms.permissionForm.permissions.value != ""))
			{
				alert("', $txt['permissions_only_one_option'], '");
				return false;
			}
			if (document.forms.permissionForm.predefined.value == "" && document.forms.permissionForm.copy_from.value == "" && document.forms.permissionForm.permissions.value == "")
			{
				alert("', $txt['permissions_no_action'], '");
				return false;
			}
			if (document.forms.permissionForm.permissions.value != "" && document.forms.permissionForm.add_remove.value == "deny")
				return confirm("', $txt['permissions_deny_dangerous'], '");

			return true;
		}
	// ]]></script>';
        if (!empty($context['profile'])) {
            echo '
			<input type="hidden" name="pid" value="', $context['profile']['id'], '" />';
        }
        echo '
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />';
    } else {
        echo '
			</table>';
    }
    echo '
		</form>
	</div>
	<br class="clear" />';
}
예제 #4
0
function template_notification()
{
    global $context, $txt, $scripturl, $modSettings;
    // The main containing header.
    echo '
			<div class="cat_bar2">
				<h3>
					<span class="ie6_header floatleft">', $txt['notifications_header'], '</span>
				</h3>
			</div>
			<div class="orange_container cleantop mediumpadding">', $txt['notification_info'], '</div><br>';
    $collapser = array('id' => 'notify_settings_profile', 'title' => $txt['notifications_settings'], 'bodyclass' => 'blue_container cleantop');
    template_create_collapsible_container($collapser);
    echo '
				<div class="content">
					<form action="', $scripturl, '?action=profile;area=notification;save" method="post" accept-charset="UTF-8" id="notify_options" class="flow_hidden">';
    // Allow notification on announcements to be disabled?
    if (!empty($modSettings['allow_disableAnnounce'])) {
        echo '
						<input type="hidden" name="notify_announcements" value="0" />
						<label for="notify_announcements"><input type="checkbox" id="notify_announcements" name="notify_announcements"', !empty($context['member']['notify_announcements']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['notify_important_email'], '</label><br />';
    }
    // More notification options.
    echo '
						<input type="hidden" name="default_options[auto_notify]" value="0" />
						<label for="auto_notify"><input type="checkbox" id="auto_notify" name="default_options[auto_notify]" value="1"', !empty($context['member']['options']['auto_notify']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['auto_notify'], '</label><br />';
    if (empty($modSettings['disallow_sendBody'])) {
        echo '
						<input type="hidden" name="notify_send_body" value="0" />
						<label for="notify_send_body"><input type="checkbox" id="notify_send_body" name="notify_send_body"', !empty($context['member']['notify_send_body']) ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['notify_send_body'], '</label><br />';
    }
    echo '
						<br />
						<label for="notify_regularity">', $txt['notify_regularity'], ':</label>
						<select name="notify_regularity" id="notify_regularity">
							<option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected="selected"' : '', '>', $txt['notify_regularity_instant'], '</option>
							<option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_regularity_first_only'], '</option>
							<option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_regularity_daily'], '</option>
							<option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_regularity_weekly'], '</option>
						</select>
						<br /><br />
						<label for="notify_types">', $txt['notify_send_types'], ':</label>
						<select name="notify_types" id="notify_types">
							<option value="1"', $context['member']['notify_types'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything'], '</option>
							<option value="2"', $context['member']['notify_types'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything_own'], '</option>
							<option value="3"', $context['member']['notify_types'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_send_type_only_replies'], '</option>
							<option value="4"', $context['member']['notify_types'] == 4 ? ' selected="selected"' : '', '>', $txt['notify_send_type_nothing'], '</option>
						</select><br class="clear" />

						<div class="floatright smallpadding">
							<input id="notify_submit" type="submit" value="', $txt['notify_save'], '" class="default" />
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
							<input type="hidden" name="u" value="', $context['id_member'], '" />
							<input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
						</div><br class="clear" />
					</form>
				</div>
			</div>
			<br>';
    template_topiclist($context['topiclist']);
    echo '
		<br />';
    template_show_list('board_notification_list');
}
예제 #5
0
function template_email_members()
{
    global $context, $settings, $options, $txt, $scripturl;
    // This is some javascript for the simple/advanced toggling stuff.
    echo '
	<script type="text/javascript"><!-- // --><![CDATA[
		function toggleAdvanced(mode)
		{
			// What styles are we doing?
			var divStyle = mode ? "" : "none";

			document.getElementById("advanced_settings_div").style.display = divStyle;
			document.getElementById("gosimple").style.display = divStyle;
			document.getElementById("goadvanced").style.display = mode ? "none" : "";
		}
	// ]]></script>';
    echo '
	<div id="admincenter">
		<form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" class="flow_hidden" accept-charset="UTF-8">
			<div class="cat_bar">
				<h3 class="catbg">', $txt['admin_newsletters'], '</h3>
			</div>
			<div class="orange_container cleantop mediumpadding">
				', $txt['admin_news_select_recipients'], '
			</div>
			<br>
			<div class="blue_container">
				<div class="content">
					<dl class="settings">
						<dt>
							<strong>', $txt['admin_news_select_group'], ':</strong><br />
							<span class="smalltext">', $txt['admin_news_select_group_desc'], '</span>
						</dt>
						<dd>';
    foreach ($context['groups'] as $group) {
        echo '
							<label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br />';
    }
    echo '
							<br />
							<label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked="checked" onclick="invertAll(this, this.form, \'groups\');" class="input_check" /> <em>', $txt['check_all'], '</em></label>';
    echo '
						</dd>
					</dl><br class="clear" />
				</div>
			</div>
			<br />';
    $collapser = array('id' => 'email_members_adv', 'title' => $txt['advanced']);
    template_create_collapsible_container($collapser);
    echo '
				<div class="content">
					<dl class="settings">
						<dt>
							<strong>', $txt['admin_news_select_email'], ':</strong><br />
							<span class="smalltext">', $txt['admin_news_select_email_desc'], '</span>
						</dt>
						<dd>
							<textarea name="emails" rows="5" cols="30" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 98%; min-width: 98%' : 'width: 98%') . ';"></textarea>
						</dd>
						<dt>
							<strong>', $txt['admin_news_select_members'], ':</strong><br />
							<span class="smalltext">', $txt['admin_news_select_members_desc'], '</span>
						</dt>
						<dd>
							<input type="text" name="members" id="members" value="" size="30" class="input_text" />
							<span id="members_container"></span>
						</dd>
					</dl>
					<hr class="bordercolor" />
					<dl class="settings">
						<dt>
							<strong>', $txt['admin_news_select_excluded_groups'], ':</strong><br />
							<span class="smalltext">', $txt['admin_news_select_excluded_groups_desc'], '</span>
						</dt>
						<dd>';
    foreach ($context['groups'] as $group) {
        echo '
							<label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br />';
    }
    echo '
							<br />
							<label for="checkAllGroupsExclude"><input type="checkbox" id="checkAllGroupsExclude" onclick="invertAll(this, this.form, \'exclude_groups\');" class="input_check" /> <em>', $txt['check_all'], '</em></label><br />
						</dd>
						<dt>
							<strong>', $txt['admin_news_select_excluded_members'], ':</strong><br />
							<span class="smalltext">', $txt['admin_news_select_excluded_members_desc'], '</span>
						</dt>
						<dd>
							<input type="text" name="exclude_members" id="exclude_members" value="" size="30" class="input_text" />
							<span id="exclude_members_container"></span>
						</dd>
					</dl>
					<hr class="bordercolor" />
					<dl class="settings">
						<dt>
							<label for="email_force"><strong>', $txt['admin_news_select_override_notify'], ':</strong></label><br />
							<span class="smalltext">', $txt['email_force'], '</span>
						</dt>
						<dd>
							<input type="checkbox" name="email_force" id="email_force" value="1" class="input_check" />
						</dd>
					</dl><br class="clear" />
				</div>
			</div>
			<br>
			<div class="righttext">
				<input type="submit" value="', $txt['admin_next'], '" class="button_submit" />
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			</div>
		</form>
	</div>
	<br class="clear" />';
    // Make the javascript stuff visible.
    echo '
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
	<script type="text/javascript"><!-- // --><![CDATA[
		document.getElementById("advanced_select_div").style.display = "";
		var oMemberSuggest = new smc_AutoSuggest({
			sSelf: \'oMemberSuggest\',
			sSessionId: \'', $context['session_id'], '\',
			sSessionVar: \'', $context['session_var'], '\',
			sSuggestId: \'members\',
			sControlId: \'members\',
			sSearchType: \'member\',
			bItemList: true,
			sPostName: \'member_list\',
			sURLMask: \'action=profile;u=%item_id%\',
			sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
			sItemListContainerId: \'members_container\',
			aListItems: []
		});
		var oExcludeMemberSuggest = new smc_AutoSuggest({
			sSelf: \'oExcludeMemberSuggest\',
			sSessionId: \'', $context['session_id'], '\',
			sSessionVar: \'', $context['session_var'], '\',
			sSuggestId: \'exclude_members\',
			sControlId: \'exclude_members\',
			sSearchType: \'member\',
			bItemList: true,
			sPostName: \'exclude_member_list\',
			sURLMask: \'action=profile;u=%item_id%\',
			sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
			sItemListContainerId: \'exclude_members_container\',
			aListItems: []
		});
	// ]]></script>';
}
예제 #6
0
function template_search()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    echo '
	<form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="UTF-8" name="searchform" id="searchform">
		<div class="cat_bar2">
			<h3>', $txt['pm_search_title'], '</h3>
		</div>
		<div class="blue_container mediumpadding cleantop">';
    if (!empty($context['search_errors'])) {
        echo '
		<div class="errorbox">
			', implode('<br />', $context['search_errors']['messages']), '
		</div>';
    }
    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['pm_search_text'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' size="40" class="input_text" />
					<input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit" />
				</div>
				<a href="', $scripturl, '?action=pm;sa=search;advanced" onclick="this.href += \';search=\' + escape(document.forms.searchform.search.value);">', $txt['pm_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['pm_search_text'], ':</strong>
					<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' 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['pm_search_match_all'], '</option>
						<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['pm_search_match_any'], '</option>
					</select>
				</span>
				<dl id="search_options">
					<dt>', $txt['pm_search_user'], ':</dt>
					<dd><input type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" /></dd>
					<dt>', $txt['pm_search_order'], ':</dt>
					<dd>
						<select name="sort">
							<option value="relevance|desc">', $txt['pm_search_orderby_relevant_first'], '</option>
							<option value="id_pm|desc">', $txt['pm_search_orderby_recent_first'], '</option>
							<option value="id_pm|asc">', $txt['pm_search_orderby_old_first'], '</option>
						</select>
					</dd>
					<dt class="options">', $txt['pm_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['pm_search_show_complete'], '</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['pm_search_subject_only'], '</label>
					</dd>
					<dt class="between">', $txt['pm_search_post_age'], ':</dt>
					<dd>', $txt['pm_search_between'], ' <input type="text" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" class="input_text" />&nbsp;', $txt['pm_search_between_and'], '&nbsp;<input type="text" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" class="input_text" /> ', $txt['pm_search_between_days'], '</dd>
				</dl>';
        if (!$context['currently_using_labels']) {
            echo '
				<input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit floatright" />';
        }
        echo '
				<br class="clear" />
			</div>
			<span class="lowerframe"><span></span></span>
		</fieldset>';
        // Do we have some labels setup? If so offer to search by them!
        if ($context['currently_using_labels']) {
            $collapser = array('title' => $txt['pm_search_choose_label'], 'id' => 'pmsearchlabels');
            template_create_collapsible_container($collapser);
            echo '
		<fieldset class="labels">
				<ul id="searchLabelsExpand" class="reset">';
            foreach ($context['search_labels'] as $label) {
                echo '
					<li>
						<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '" ', $label['checked'] ? 'checked="checked"' : '', ' class="input_check" />
						', $label['name'], '</label>
					</li>';
            }
            echo '
				</ul>
				<p>
					<span class="floatleft"><input type="checkbox" name="all" id="check_all" value="" ', $context['check_all'] ? 'checked="checked"' : '', ' onclick="invertAll(this, this.form, \'searchlabel\');" class="input_check" /><em> <label for="check_all">', $txt['check_all'], '</label></em></span>
					<input type="submit" name="submit" value="', $txt['pm_search_go'], '" class="button_submit floatright" />
				</p><br class="clear" />
		</fieldset>
		</div>';
        }
    }
    echo '
	</div>
	</form>';
}
예제 #7
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, $scripturl, $modSettings, $txt;
    echo '
	<a id="top"></a>
	<h1 class="bigheader">', $context['name'], '</h1>';
    if (!empty($options['show_board_desc']) && $context['description'] != '') {
        echo '
	<div class="smalltext">', $context['description'], '</div>';
    }
    if (count($context['boards']) && (!empty($options['show_children']) || $context['start'] == 0)) {
        $collapser = array('id' => $context['current_board'] . '_childboards', 'title' => $txt['parent_boards'], 'bodyclass' => 'generic_container');
        echo '<br>';
        template_create_collapsible_container($collapser);
        echo '<div class="framed_region smallpadding"><ol id="board_', $context['current_board'], '_children" class="commonlist category">';
        $context['alternate'] = 1;
        foreach ($context['boards'] as &$board) {
            if (!$board['ignored']) {
                template_boardbit($board);
            }
        }
        echo '
			</ol>
			</div>
			</div>
			';
    }
    if ($context['hidden_boards']['hidden_count']) {
        echo '
			<br>
			<div id="show_hidden_boards" class="orange_container norounded gradient_darken_down tinytext"><span class="floatright">', $context['hidden_boards']['setup_notice'], '</span><strong>', sprintf($context['hidden_boards']['notice'], $context['hidden_boards']['hidden_count'], '<a onclick="$(\'div#hidden_boards\').fadeIn();return(false);" href="!#">'), '</strong></div>
			<div class="category" id="hidden_boards" style="display:none;">
				<div class="framed_region cleantop root_cat" id="category_0">
					<ol class="commonlist category">';
        foreach ($context['hidden_boards']['boards'] as &$board) {
            if ($board['ignored']) {
                template_boardbit($board);
            }
        }
        echo '
					</ol>
				</div>
			</div>
			<div class="cContainer_end"></div>';
    }
    if (!$context['act_as_cat']) {
        $normal_buttons = array('new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true), 'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.gif', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'), '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_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), 'markread' => array('text' => 'mark_read_short', 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']));
        // They can only mark read if they are logged in and it's enabled!
        if (!$context['user']['is_logged'] || !$settings['show_mark_read']) {
            unset($normal_buttons['markread']);
        }
        // Allow adding new buttons easily.
        HookAPI::callHook('integrate_messageindex_buttons', array(&$normal_buttons));
        if (!$context['no_topic_listing']) {
            echo '
	<div class="pagesection top smallpadding">
		<div class="pagelinks floatleft">', $context['page_index'], '&nbsp;&nbsp;<a class="navPages" href="#bot">' . $txt['go_down'] . '</a></div>
		', template_button_strip($normal_buttons, 'right'), '
	</div>';
            // If Quick Moderation is enabled start the form.
            if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
                echo '
	<form action="', $scripturl, '?action=quickmod;board=', $context['current_board'], '.', $context['start'], '" method="post" accept-charset="UTF-8" class="clear" name="quickModForm" id="quickModForm">';
            }
            echo '
		<div class="framed_region">
		<table class="topic_table">';
            // Are there actually any topics to show?
            if (!empty($context['topics'])) {
                echo '
					<thead>
					<tr class="mediumpadding">
					<th scope="col" colspan="2" class="first_th glass cleantop" style="width:8%;">&nbsp;</th>
					<th scope="col" class="lefttext nowrap glass cleantop"><a rel="nofollow" href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a rel="nofollow" href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['started_by'], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
					<th scope="col" class="nowrap glass cleantop"><a rel="nofollow" href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>
					<th scope="col" class="centertext nowrap glass cleantop"><a rel="nofollow" href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>';
                // Show a "select all" box for quick moderation?
                if (!empty($context['can_quick_mod'])) {
                    echo '
					<th scope="col" class="glass cleantop last_th" style="width:24px;"><input type="checkbox" class="input_check cb_invertall" /></th>';
                }
            } else {
                echo '
					<thead>
					<tr>
					<th class="red_container"><strong>', $txt['msg_alert_none'], '</strong></th>';
            }
            echo '
				</tr>
			</thead>';
            if (!empty($settings['display_who_viewing'])) {
                echo '
				<tr class="whos_viewing mediumpadding">
					<td colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '" class="smalltext">';
                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'] . ')');
                }
                echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_board'], '
					</td>
				</tr>';
            }
            // If this person can approve items and we have some awaiting approval tell them.
            if (!empty($context['unapproved_posts_message'])) {
                echo '
				<tr class="windowbg2">
					<td colspan="', !empty($context['can_quick_mod']) ? '6' : '5', '">
						<span class="alert">!</span> ', $context['unapproved_posts_message'], '
					</td>
				</tr>';
            }
            foreach ($context['topics'] as &$topic) {
                template_topicbit($topic);
            }
            if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] && !empty($context['topics'])) {
                echo '
				<tr>
					<td colspan="6" class="righttext">
						<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
							<option value="">--------</option>', $context['can_remove'] ? '
							<option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
							<option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
							<option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? '
							<option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
							<option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? '
							<option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? '
							<option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? '
							<option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
						</select>';
                // Show a list of boards they can move the topic to.
                if ($context['can_move']) {
                    echo '
						<select class="qaction" id="moveItTo" name="move_to" disabled="disabled">';
                    foreach ($context['move_to_boards'] 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'], '</option>';
                        }
                        echo '
							</optgroup>';
                    }
                    echo '
						</select>';
                }
                echo '
						<input type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.quickModForm.qaction.value != \'\' &amp;&amp; confirm(\'', $txt['quickmod_confirm'], '\');" class="button_submit qaction" />
					</td>
				</tr>';
            }
            echo '
			</tbody>
		</table>
	</div>';
        }
        echo '
	<a id="bot"></a>';
        // Finish off the form - again.
        if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] > 0 && !empty($context['topics'])) {
            echo '
	<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
	</form>';
        }
        echo '
	<div class="pagesection bottom smallpadding">
		', template_button_strip($normal_buttons, 'right'), '
		<div class="pagelinks floatleft">', $context['page_index'], '&nbsp;&nbsp;<a class="navPages" href="#top">' . $txt['go_up'] . '</a></div>
	</div>';
    }
    theme_linktree();
    echo '
	<div class="tborder" id="topic_icons">
		<div class="description">
			<p class="floatright" id="message_index_jump_to">&nbsp;</p>';
    $context['inline_footer_script'] .= '
	if (typeof(window.XMLHttpRequest) != "undefined")
		aJumpTo[aJumpTo.length] = new JumpTo({
		sContainerId: "message_index_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['quick_mod_go'] . '"
	});
	';
    echo '
			<br class="clear" />
		</div>
	</div>';
    // Javascript for inline editing.
    $context['inline_footer_script'] .= '
	// Hide certain bits during topic edit.
	hide_prefixes.push("lockicon", "stickyicon", "pages", "newicon");

	// Use it to detect when we\'ve stopped editing.
	document.onclick = modify_topic_click;

	var mouse_on_div;
	function modify_topic_click()
	{
		if (in_edit_mode == 1 && mouse_on_div == 0)
			modify_topic_save("' . $context['session_id'] . '", "' . $context['session_var'] . '");
	}

	function modify_topic_keypress(oEvent)
	{
		if (typeof(oEvent.keyCode) != "undefined" && oEvent.keyCode == 13)
		{
			modify_topic_save("' . $context['session_id'] . '", "' . $context['session_var'] . '");
			if (typeof(oEvent.preventDefault) == "undefined")
				oEvent.returnValue = false;
			else
				oEvent.preventDefault();
		}
	}

	// For templating, shown when an inline edit is made.
	function modify_topic_show_edit(subject)
	{
		// Just template the subject.
		setInnerHTML(cur_subject_div, \'<input type="text" name="subject" value="\' + subject + \'" size="60" style="width: 95%;" maxlength="80" onkeypress="modify_topic_keypress(event)" class="input_text" /><input type="hidden" name="topic" value="\' + cur_topic_id + \'" /><input type="hidden" name="msg" value="\' + cur_msg_id.substr(4) + \'" />\');
	}

	// And the reverse for hiding it.
	function modify_topic_hide_edit(subject)
	{
		// Re-template the subject!
		setInnerHTML(cur_subject_div, \'<a href="' . $scripturl . '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\' +\'/a>\');
	}
	';
}
예제 #8
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, $options, $txt, $scripturl, $modSettings, $counter;
    // Start the javascript... and boy is there a lot.
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			var txtlabel_zoom = "', $txt['zoom_editor'], '";
			var txtlabel_restore = "', $txt['restore_editor'], '";
		';
    // 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'], '\': \'', $icon['url'], '\'', $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="UTF-8" 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>
						<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
					</h3>
				</div>
				<div class="post_wrapper blue_container cleantop">
					<div id="preview_body" class="post">
						', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
					</div>
				</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 '
			<h1 class="bigheader">', $context['page_title'], '</h1>
			<div class="generic_container"><br />
				<div class="blue_container" style="margin:0 auto;padding:10px;max-width:900px;">', 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>
							<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['draft_locked'] ? '' : ' style="display: none"', ' id="lock_warning">
						', $txt['topic_locked_no_reply'], '
					</p>';
    // The post header... important stuff
    echo '
					<dl id="post_header">';
    // 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>
							', isset($context['prefix_selector']) ? $context['prefix_selector'] : '', '<input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" class="input_text" />
						</dd>
		';
    // Tagging system Mod
    if (!(isset($context['previous_posts']) && count($context['previous_posts']) > 0)) {
        echo $context['tagging_ui'];
    }
    //End Tagging system mod
    echo '
		
		
		
						<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="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
						</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 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>';
    }
    // Show the actual posting area...
    echo '<div id="editor_main_content">
		<div class="floatright" style="margin:10px 10px 0 0;">
		 <div id="smiley_popup_anchor" style="position:relative;">
		 <span id="editor_main_content_zoom" class="button">', $txt['zoom_editor'], '</span>
		 <span onclick="popupSmileySelector($(this));return(false);" id="editor_main_smiley_popup" class="button">Smileys</span>
		 </div>
		</div>';
    if ($context['show_bbc']) {
        echo '
					<div id="bbcBox_message"></div>';
    }
    echo '
					', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
    echo '</div>';
    // 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>';
    }
    $collapser = array('id' => 'editor_options', 'title' => $txt['post_additionalopt']);
    echo '<br>';
    template_create_collapsible_container($collapser);
    // 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">
							', $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>' : '', '
							', isset($context['can_lock_message']) ? '<li><label for="lock_message"><input type="checkbox" name="lock_message" class="input_check" value="1"' . ($context['message_locked'] ? ' checked="checked"' : '') . ' />' . $txt['lock_message'] . '</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>' : '', '
							', isset($context['can_stick_firstpost']) && !empty($context['can_stick_firstpost']) ? '<li><label for="stickfirst"><input type="checkbox" name="stickfirst" id="stickfirst" value="1" class="input_check" ' . (isset($context['first_is_sticky']) && !empty($context['first_is_sticky']) ? 'checked="checked"' : '') . ' /> ' . $txt['first_post_sticky'] . '</label></li>' : '', '
							', $context['can_merge_with_last'] ? '<li><label for="want_automerge"><input type="checkbox" name="want_automerge" id="want_automerge" class="input_check" checked="checked" value="1" class="input_check" /> ' . $txt['want_automerge'] . '</label></li>' : '', '
							', $modSettings['astream_active'] ? '<li><label for="noactivity"><input type="checkbox" name="noactivity" id="noactivity" value="1" class="input_check" /> ' . $txt['no_activity_record'] . '</label></li>' : '', '
							', $context['can_tag_users'] ? '<li><label for="allowtags"><input type="checkbox" name="allowtags" id="allowtags" value="1" class="input_check" /> ' . $txt['disable_user_tagging'] . '</label></li>' : '', '
						</ul>';
    if (isset($context['can_stick_firstpost']) && $context['can_stick_firstpost'] && isset($context['first_has_layout'])) {
        echo '
						<hr>
						<select name="firstlayout">
							<option value="0"', $context['first_has_layout'] == 0 ? ' selected="selected"' : '', '>Standard layout</option>
							<option value="1"', $context['first_has_layout'] == 1 ? ' selected="selected"' : '', '>Standard layout, first post with blog-style</option>
							<option value="2"', $context['first_has_layout'] == 2 ? ' selected="selected"' : '', '>Blog-like display with simplified comments</option>
						</select>';
    }
    echo '
						</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'] . ')' : '', '</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>';
    }
    echo '<div class="clear"></div>
		</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><br />
			</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\'];
					var numericFields = [
						\'board\', \'topic\', \'last_msg\',
						\'eventid\', \'calendar\', \'year\', \'month\', \'day\',
						\'poll_max_votes\', \'poll_expire\', \'poll_change_vote\', \'poll_hide\'
					];
					var checkboxFields = [
						\'ns\', \'allowtags\'
					];

					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);
				bbc_refresh();
				if(typeof(prettyPrint) != \'undefined\') {
					prettyPrint();
				}

				// 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 + \'/', 'new.png" alt="', $txt['preview_new'], '" id="image_new_\' + newPosts[i].getAttribute("id") + \'" /></div>\';';
    if ($context['can_quote']) {
        echo '
						newPostsHTML += \'<ul class="reset buttonlist" 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)
				{
				}

				if (typeof(smf_codeFix) != \'undefined\')
					smf_codeFix();
			}';
    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 rounded_top">
				<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_wrapper ', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
				<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="buttonlist" 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>
			</div>';
        }
        echo '
		</div>
		<script type="text/javascript"><!-- // --><![CDATA[
			var aIgnoreToggles = new Array();';
        foreach ($ignored_posts as $post_id) {
            echo '';
        }
        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);
			}
			
			var this_post = ', empty($context['quoted_id']) ? 0 : $context['quoted_id'], ';
			function getMultiQuotes()
			{
               var _c = readCookie("mquote") || "";
               if(_c.length > 1) {
               	var _s = _c.split(",");
               	for (var i = 0; i < _s.length; i++)
					loadMultiQuoteById(_s[i]);
				createCookie("mquote", "", -1);
               }
            }
			function loadMultiQuoteById(mid)
			{
			   var message_id = parseInt(mid);
               if(parseInt(message_id) != parseInt(this_post))
               	   insertQuoteFast(message_id);
			}
			$(document).ready(function() {
				getMultiQuotes();
			});
		// ]]></script>';
    }
}
예제 #9
0
function template_sidebar_content_index()
{
    global $context, $txt, $modSettings, $scripturl, $settings, $user_info, $options;
    $widgetstyle = 'framed_region cleantop tinypadding';
    echo $context['template_hooks']['global']['sidebar_top'];
    $collapser = array('id' => 'user_panel', 'title' => 'User panel', 'bodyclass' => $widgetstyle);
    echo '<script>
		   // <![CDATA[
		   sidebar_content_loaded = 1;
           // ]]>
		  </script>';
    template_create_collapsible_container($collapser);
    //<h1 class="bigheader greyback" style="margin-top:0;">User panel</h1>';
    // If the user is logged in, display stuff like their name, new messages, etc.
    // for the logo -> <img style="margin-left:30px;margin-top:10px;float:left;display:inline-block;" src="'.$settings['images_url'].'/bloglogo.png" alt="logo" />
    echo '
		<div class="blue_container smallpadding norounded gradient_darken_down">';
    if ($context['user']['is_logged']) {
        echo '<div class="smalltext user">';
        if (!empty($context['user']['avatar'])) {
            echo '
				<div class="avatar floatleft">', $context['user']['avatar']['image'], '</div>';
        } else {
            echo '
				<div class="avatar floatleft"><img src="', $settings['images_url'], '/unknown.png" alt="avatar" /></div>';
        }
        echo '
				 <ul class="reset" style="line-height:110%;">
					<li class="greeting"><a href="', URL::user($context['user']['id'], $context['user']['name']), '">', $context['user']['name'], '</a></li>
					<li class="smalltext">', $user_info['posts'], ' ', $txt['posts'], '<li>
					<li class="smalltext">', $user_info['likesreceived'], ' ', $txt['likes'], '<li>
					<li class="smalltext"><span class="smalltext floatright"><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], '">Sign out</a></span><li>
				 </ul>
				 <div class="clear">
					<a href="', URL::parse($scripturl . '?action=unread">'), $txt['unread_since_visit'], '</a><br>
					<a href="', URL::parse($scripturl . '?action=unreadreplies">'), $txt['show_unread_replies'], '</a>
				 </div>';
        echo '<div style="margin-top:3px;">';
        // Is the forum in maintenance mode?
        if ($context['in_maintenance'] && $context['user']['is_admin']) {
            echo '
					<div class="errorbox smallpadding">', $txt['maintain_mode_on'], '</div>';
        }
        // Are there any members waiting for approval?
        if (!empty($context['unapproved_members'])) {
            echo '
					<div>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</div>';
        }
        if (!empty($context['open_mod_reports']) && $context['show_open_reports']) {
            echo '
					<div><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></div>';
        }
        echo '</div></div></div>';
    } else {
        echo '
				<div class="smalltext">
				<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/min/sha1.js', $context['jsver'], '"></script>
				<div>
					<form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="UTF-8" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
					<div class="orange_container centertext">', sprintf($txt['welcome_guest'], $txt['guest_title']), '</div>
					<table>
					<tr>
					<td class="nowrap"><strong>', $txt['username'], ':</strong></td>
					<td><input type="text" name="user" size="20" class="input_text" /></td>
					</tr>
					<tr>
					<td class="nowrap"><strong>', $txt['password'], ':</strong></td>
					<td><input type="password" name="passwrd" size="20" class="input_password" /></td>
					</tr>
					</table>
					<span style="line-height:20px;">', $txt['always_logged_in'], '<input type="checkbox" name="cookielength" value="-1"></span>
					<input style="width:90%;margin-left:5%;margin-top:10px;" type="submit" value="', $txt['login'], '" class="button_submit" /><br />';
        if (!empty($modSettings['enableOpenID'])) {
            echo '
					<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';
        }
        echo '
					<input type="hidden" name="hash_passwrd" value="" />
					</form>
					<br>';
        if (!(!empty($modSettings['registration_method']) && $modSettings['registration_method'] == 3)) {
            echo '
					<div class="orange_container">
					', $txt['login_or_register'], '
					</div>';
        } else {
            echo '
					<div class="orange_container">
					', $txt['registration_disabled'], '
					</div>';
        }
        echo '
					</div>
				</div>
			</div>';
    }
    echo '</div>
		<div class="cContainer_end"></div>';
    // Show statistical style information...
    if ($settings['show_stats_index'] && isset($context['show_stats'])) {
        $collapser = array('bodyclass' => $widgetstyle, 'id' => 'stats_panel', 'title' => $txt['forum_stats']);
        template_create_collapsible_container($collapser);
        echo '
			<div class="blue_container norounded smallpadding gradient_darken_down">
			<div class="smallpadding smalltext">
				<dl class="common">
				 <dt>', $txt['posts'], ': </dt><dd class="righttext">', $context['common_stats']['total_posts'], '</dd>
				 <dt>', $txt['topics'], ': </dt><dd class="righttext">', $context['common_stats']['total_topics'], '</dd>
				 <dt>', $txt['members'], ': </dt><dd class="righttext">', $context['common_stats']['total_members'], '</dd>';
        if (!empty($settings['show_latest_member'])) {
            echo '<dt>', $txt['latest_member'] . ': </dt><dd class="righttext"><strong><a href="', URL::user($context['common_stats']['latest_member']['id'], $context['common_stats']['latest_member']['name']), '">', $context['common_stats']['latest_member']['name'] . '</a></strong></dd>';
        }
        echo '</dl>';
        echo '
				<div>
				  <div class="floatright righttext"><a href="', URL::action($scripturl . '?action=recent') . '">', $txt['recent_view'], '</a>', $context['show_stats'] ? '
				  </div>
				 <a href="' . URL::action($scripturl . '?action=stats') . '">' . $txt['more_stats'] . '</a>' : '', '
				</div>
			</div>
			</div>
			</div>
			<div class="cContainer_end"></div>';
    }
    // social panel in the side bar
    if ($context['user']['is_guest'] || (empty($options['use_share_bar']) ? 1 : !$options['use_share_bar'])) {
        $collapser = array('id' => 'social_panel', 'title' => 'Socialize', 'bodyclass' => $widgetstyle, 'framed' => 'smallpadding');
        template_create_collapsible_container($collapser);
        echo '
		<div class="blue_container norounded smallpadding gradient_darken_down">
		<div id="socialshareprivacy"></div>
		<div class="clear"></div>
		</div>
		</div>
		<div class="cContainer_end"></div>';
    }
    // This is the "Recent Posts" bar.
    if (!empty($settings['number_recent_posts']) && (!empty($context['latest_posts']) || !empty($context['latest_post']))) {
        $collapser = array('bodyclass' => $widgetstyle, 'id' => 'recent_panel', 'title' => '<a href="' . URL::parse($scripturl . '?action=recent') . '">' . $txt['recent_posts'] . '</a>', 'framed' => 'smallpadding');
        template_create_collapsible_container($collapser);
        echo '
			<div class="blue_container norounded smallpadding gradient_darken_down">
			<div class="smalltext" id="recent_posts_content" style="line-height:120%;">
				<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
				<div class="entry-content" style="display: none;">
					<a rel="alternate" type="application/rss+xml" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
				</div>';
        // Only show one post.
        if ($settings['number_recent_posts'] == 1) {
            // latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
            echo '
				<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
				<p id="infocenter_onepost" class="smalltext">
					', $txt['recent_view'], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
				</p>';
        } elseif (!empty($context['latest_posts'])) {
            echo '
			   	<ol class="commonlist smalltext" style="padding:0;margin:0;">';
            /* Each post in latest_posts has:
            			board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
            			subject, short_subject (shortened with...), time, link, and href. */
            foreach ($context['latest_posts'] as $post) {
                echo '
				<li class="smallpadding">
					<a href = "', $post['href'], '" title = "', $post['subject'], '">', $post['short_subject'], '</a><br>
					<span class="nowrap floatright tinytext">', $post['time'], '</span><strong class="tinytext">', $post['poster']['link'], '</strong><br>
				</li>';
            }
            echo '
				</ol>';
        }
        echo '
			</div>
			</div>
			</div>
			<div class="cContainer_end"></div>
			';
    }
    // Show information about events, birthdays, and holidays on the calendar.
    if ($context['show_calendar']) {
        $title = $context['calendar_only_today'] ? $txt['calendar_today'] : $txt['calendar'] . ' (Next ' . $modSettings['cal_days_for_index'] . ' days)';
        $collapser = array('bodyclass' => $widgetstyle, 'id' => 'cal_panel', 'title' => '<a href="' . URL::action($scripturl . '?action=calendar') . '">' . $title . '</a>', 'framed' => 'smallpadding');
        template_create_collapsible_container($collapser);
        echo '
			<div class="blue_container norounded smallpadding gradient_darken_down">
			<div class="smalltext">';
        // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
        if (!empty($context['calendar_holidays'])) {
            echo '
				<div class="holiday">', $txt['calendar_prompt'], '</div>', implode(', ', $context['calendar_holidays']), '<br><div class="cContainer_end"></div>';
        }
        // People's birthdays. Like mine. And yours, I guess. Kidding.
        if (!empty($context['calendar_birthdays'])) {
            echo '
				<div class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</div> ';
            /* Each member in calendar_birthdays has:
            			id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
            foreach ($context['calendar_birthdays'] as $member) {
                echo '
				<a href="', URL::user($member['id'], $member['name']), '">', $member['is_today'] ? '<strong>' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
            }
        }
        // Events like community get-togethers.
        if (!empty($context['calendar_events'])) {
            echo '
				<span class="event">', $context['calendar_only_today'] ? $txt['events'] : $txt['events_upcoming'], '</span> ';
            /* Each event in calendar_events should have:
            			title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
            foreach ($context['calendar_events'] as $event) {
                echo '
					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><img src="' . $settings['images_url'] . '/icons/modify_small.gif" alt="*" /></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';
            }
        }
        echo '
			</div>
			</div>
			</div>
			<div class="cContainer_end"></div>
			';
    }
    echo $context['template_hooks']['global']['sidebar_bottom'];
}