/**
 * @name      Dismissible Notices
 * @copyright Dismissible Notices contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * @version 0.0.1
 *
 */
function template_notices_above()
{
    global $context, $txt, $scripturl;
    echo '
	<noscript>
		<div id="notices">';
    foreach ($context['notices'] as $notice) {
        addInlineJavascript('
		setTimeout(function() {
			$' . ($notice['positioning']['element'] !== 'global' && !empty($notice['positioning']['element_name']) ? '(".' . $notice['positioning']['element_name'] . '")' : '') . '.notify({
				title: ' . JavaScriptEscape($notice['body']) . ',
				button: ' . JavaScriptEscape($txt['dismiss_notice_dismis']) . ',
				cancel: ' . JavaScriptEscape($txt['dismiss_notice_cancel']) . ',
				id: ' . JavaScriptEscape($notice['id_notice']) . '
			}, {
				style: \'default\',
				className:  ' . javaScriptEscape($notice['class']) . ',
				autoHide: ' . ($context['user']['is_guest'] ? 'true' : 'false') . ',
				position: ' . javaScriptEscape(dismissnotices_translate_positions($notice['positioning']['position'])) . ',
				clickToHide: false
			});
		}, 500);', true);
        echo '
			<div class="' . $notice['class'] . '">
				' . $notice['body'] . '<br />
				<a href="' . $scripturl . '?action=dismissnotice;url=' . urlencode($_SERVER['REQUEST_URL']) . $txt['dismiss_notice_dismis'] . '">X</a>,
			</div>';
    }
    echo '
		</div>
	</noscript>';
}
    /**
     * Show page listing of all permission groups in the system
     */
    public function action_sportal_admin_permission_profiles_list()
    {
        global $context, $scripturl, $txt, $modSettings;
        // Removing some permission profiles?
        if (!empty($_POST['remove_profiles']) && !empty($_POST['remove']) && is_array($_POST['remove'])) {
            checkSession();
            $remove = array();
            foreach ($_POST['remove'] as $index => $profile_id) {
                $remove[(int) $index] = (int) $profile_id;
            }
            sp_delete_profiles($remove);
        }
        // Build the listoption array to display the permission profiles
        $listOptions = array('id' => 'portal_permisssions', 'title' => $txt['sp_admin_permission_profiles_list'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['error_sp_no_articles'], 'base_href' => $scripturl . '?action=admin;area=portalprofiles;sa=listpermission;', 'default_sort_col' => 'name', 'get_items' => array('function' => array($this, 'list_spLoadProfiles')), 'get_count' => array('function' => array($this, 'list_spCountProfiles')), 'columns' => array('name' => array('header' => array('value' => $txt['sp_admin_profiles_col_name']), 'data' => array('db' => 'label'), 'sort' => array('default' => 'name', 'reverse' => 'name DESC')), 'articles' => array('header' => array('value' => $txt['sp_admin_profiles_col_articles'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return empty($row[\'articles\']) ? \'0\' : $row[\'articles\'];
						'), 'class' => 'centertext')), 'blocks' => array('header' => array('value' => $txt['sp_admin_profiles_col_blocks'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return empty($row[\'blocks\']) ? \'0\' : $row[\'blocks\'];
						'), 'class' => 'centertext')), 'categories' => array('header' => array('value' => $txt['sp_admin_profiles_col_categories'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return empty($row[\'categories\']) ? \'0\' : $row[\'categories\'];
						'), 'class' => 'centertext')), 'pages' => array('header' => array('value' => $txt['sp_admin_profiles_col_pages'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return empty($row[\'pages\']) ? \'0\' : $row[\'pages\'];
						'), 'class' => 'centertext')), 'shoutboxes' => array('header' => array('value' => $txt['sp_admin_profiles_col_shoutboxes'], 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return empty($row[\'shoutboxes\']) ? \'0\' : $row[\'shoutboxes\'];
						'), 'class' => 'centertext')), 'action' => array('header' => array('value' => $txt['sp_admin_articles_col_actions'], 'class' => 'centertext'), 'data' => array('sprintf' => array('format' => '<a href="?action=admin;area=portalprofiles;sa=editpermission;profile_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" accesskey="e">' . sp_embed_image('modify') . '</a>&nbsp;
								<a href="?action=admin;area=portalprofiles;sa=deletepermission;profile_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(' . JavaScriptEscape($txt['sp_admin_articles_delete_confirm']) . ') && submitThisOnce(this);" accesskey="d">' . sp_embed_image('delete') . '</a>', 'params' => array('id' => true)), 'class' => 'centertext', 'style' => "width: 40px")), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return \'<input type="checkbox" name="remove[]" value="\' . $row[\'id\'] . \'" class="input_check" />\';
						'), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=portalprofiles;sa=listpermission', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])));
        // Set the context values
        $context['page_title'] = $txt['sp_admin_permission_profiles_list'];
        $context['sub_template'] = 'show_list';
        $context['default_list'] = 'portal_permisssions';
        // Create the list.
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
    }
    /**
     * Show a listing of articles in the system
     */
    public function action_sportal_admin_article_list()
    {
        global $context, $scripturl, $txt, $modSettings;
        // Build the listoption array to display the categories
        $listOptions = array('id' => 'portal_articles', 'title' => $txt['sp_admin_articles_list'], 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $txt['error_sp_no_articles'], 'base_href' => $scripturl . '?action=admin;area=portalarticles;sa=list;', 'default_sort_col' => 'title', 'get_items' => array('function' => array($this, 'list_spLoadArticles')), 'get_count' => array('function' => array($this, 'list_spCountArticles')), 'columns' => array('title' => array('header' => array('value' => $txt['sp_admin_articles_col_title']), 'data' => array('db' => 'title'), 'sort' => array('default' => 'title', 'reverse' => 'title DESC')), 'namespace' => array('header' => array('value' => $txt['sp_admin_articles_col_namespace']), 'data' => array('db' => 'article_id'), 'sort' => array('default' => 'article_namespace', 'reverse' => 'article_namespace DESC')), 'category' => array('header' => array('value' => $txt['sp_admin_articles_col_category']), 'data' => array('db' => 'category_name'), 'sort' => array('default' => 'name', 'reverse' => 'name DESC')), 'author' => array('header' => array('value' => $txt['sp_admin_articles_col_author']), 'data' => array('db' => 'author_name'), 'sort' => array('default' => 'author_name', 'reverse' => 'author_name DESC')), 'type' => array('header' => array('value' => $txt['sp_admin_articles_col_type']), 'data' => array('db' => 'type'), 'sort' => array('default' => 'type', 'reverse' => 'type DESC')), 'date' => array('header' => array('value' => $txt['sp_admin_articles_col_date']), 'data' => array('db' => 'date'), 'sort' => array('default' => 'date', 'reverse' => 'date DESC')), 'status' => array('header' => array('value' => $txt['sp_admin_articles_col_status'], 'class' => 'centertext'), 'data' => array('db' => 'status_image', 'class' => 'centertext'), 'sort' => array('default' => 'status', 'reverse' => 'status DESC')), 'action' => array('header' => array('value' => $txt['sp_admin_articles_col_actions'], 'class' => 'centertext'), 'data' => array('sprintf' => array('format' => '<a href="?action=admin;area=portalarticles;sa=edit;article_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" accesskey="e">' . sp_embed_image('modify') . '</a>&nbsp;
								<a href="?action=admin;area=portalarticles;sa=delete;article_id=%1$s;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(' . JavaScriptEscape($txt['sp_admin_articles_delete_confirm']) . ') && submitThisOnce(this);" accesskey="d">' . sp_embed_image('delete') . '</a>', 'params' => array('id' => true)), 'class' => 'centertext nowrap')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />', 'class' => 'centertext'), 'data' => array('function' => create_function('$row', '
							return \'<input type="checkbox" name="remove[]" value="\' . $row[\'id\'] . \'" class="input_check" />\';
						'), 'class' => 'centertext'))), 'form' => array('href' => $scripturl . '?action=admin;area=portalarticles;sa=remove', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="remove_articles" value="' . $txt['sp_admin_articles_remove'] . '" class="right_submit" />')));
        // Set the context values
        $context['page_title'] = $txt['sp_admin_articles_title'];
        $context['sub_template'] = 'show_list';
        $context['default_list'] = 'portal_articles';
        // Create the list.
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
    }
function template_latest_news()
{
    global $settings, $options, $context, $txt, $scripturl;
    echo '
		<div class="cat_bar">
			<h3 class="catbg">
				<span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a> ', $txt['mc_latest_news'], '</span>
			</h3>
		</div>
		<div class="windowbg">
			<span class="topslice"><span></span></span>
			<div class="content">
				<div id="smfAnnouncements" class="smalltext">', $txt['mc_cannot_connect_sm'], '</div>
			</div>
			<span class="botslice"><span></span></span>
		</div>';
    // This requires a lot of javascript...
    //!!! Put this in it's own file!!
    echo '
		<script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
		<script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/admin.js?fin20"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oAdminIndex = new smf_AdminIndex({
				sSelf: \'oAdminCenter\',

				bLoadAnnouncements: true,
				sAnnouncementTemplate: ', JavaScriptEscape('
					<dl>
						%content%
					</dl>
				'), ',
				sAnnouncementMessageTemplate: ', JavaScriptEscape('
					<dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
					<dd>
						%message%
					</dd>
				'), ',
				sAnnouncementContainerId: \'smfAnnouncements\'
			});
		// ]]></script>';
}
Esempio n. 5
0
function template_download_language()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Actually finished?
    if (!empty($context['install_complete'])) {
        echo '
	<div id="admincenter">
		<div class="cat_bar">
			<h3 class="catbg">
				', $txt['languages_download_complete'], '
			</h3>
		</div>
		<div class="windowbg">
			<span class="topslice"><span></span></span>
			<div class="content">
				', $context['install_complete'], '
			</div>
			<span class="botslice"><span></span></span>
		</div>
	</div>
	<br class="clear" />';
        return;
    }
    // An error?
    if (!empty($context['error_message'])) {
        echo '
	<div id="errorbox">
		<p>', $context['error_message'], '</p>
	</div>';
    }
    // Provide something of an introduction...
    echo '
	<div id="admincenter">
		<form action="', $scripturl, '?action=admin;area=languages;sa=downloadlang;did=', $context['download_id'], ';', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
			<div class="cat_bar">
				<h3 class="catbg">
					', $txt['languages_download'], '
				</h3>
			</div>
			<div class="windowbg">
				<span class="topslice"><span></span></span>
				<div class="content">
					<p>
						', $txt['languages_download_note'], '
					</p>
					<div class="smalltext">
						', $txt['languages_download_info'], '
					</div>
				</div>
				<span class="botslice"><span></span></span>
			</div>';
    // Show the main files.
    template_show_list('lang_main_files_list');
    // Now, all the images and the likes, hidden via javascript 'cause there are so fecking many.
    echo '
			<br />
			<div class="title_bar">
				<h3 class="titlebg">
					', $txt['languages_download_theme_files'], '
				</h3>
			</div>
			<table class="table_grid" cellspacing="0" width="100%">
				<thead>
					<tr class="catbg">
						<th class="first_th" scope="col">
							', $txt['languages_download_filename'], '
						</th>
						<th scope="col" width="100">
							', $txt['languages_download_writable'], '
						</th>
						<th scope="col" width="100">
							', $txt['languages_download_exists'], '
						</th>
						<th class="last_th" scope="col" width="50">
							', $txt['languages_download_copy'], '
						</th>
					</tr>
				</thead>
				<tbody>';
    foreach ($context['files']['images'] as $theme => $group) {
        $count = 0;
        echo '
				<tr class="titlebg">
					<td colspan="4">
						<img src="', $settings['images_url'], '/sort_down.gif" id="toggle_image_', $theme, '" alt="*" />&nbsp;', isset($context['theme_names'][$theme]) ? $context['theme_names'][$theme] : $theme, '
					</td>
				</tr>';
        $alternate = false;
        foreach ($group as $file) {
            echo '
				<tr class="windowbg', $alternate ? '2' : '', '" id="', $theme, '-', $count++, '">
					<td>
						<strong>', $file['name'], '</strong><br />
						<span class="smalltext">', $txt['languages_download_dest'], ': ', $file['destination'], '</span>
					</td>
					<td>
						<span style="color: ', $file['writable'] ? 'green' : 'red', ';">', $file['writable'] ? $txt['yes'] : $txt['no'], '</span>
					</td>
					<td>
						', $file['exists'] ? $file['exists'] == 'same' ? $txt['languages_download_exists_same'] : $txt['languages_download_exists_different'] : $txt['no'], '
					</td>
					<td>
						<input type="checkbox" name="copy_file[]" value="', $file['generaldest'], '"', $file['default_copy'] ? ' checked="checked"' : '', ' class="input_check" />
					</td>
				</tr>';
            $alternate = !$alternate;
        }
    }
    echo '
			</tbody>
			</table>';
    // Do we want some FTP baby?
    if (!empty($context['still_not_writable'])) {
        if (!empty($context['package_ftp']['error'])) {
            echo '
			<div id="errorbox">
				<tt>', $context['package_ftp']['error'], '</tt>
			</div>';
        }
        echo '
			<div class="cat_bar">
				<h3 class="catbg">
					', $txt['package_ftp_necessary'], '
				</h3>
			</div>
			<div class="windowbg">
				<span class="topslice"><span></span></span>
				<div class="content">
					<p>', $txt['package_ftp_why'], '</p>
					<dl class="settings">
						<dt
							<label for="ftp_server">', $txt['package_ftp_server'], ':</label>
						</dt>
						<dd>
							<div class="floatright" style="margin-right: 1px;"><label for="ftp_port" style="padding-top: 2px; padding-right: 2ex;">', $txt['package_ftp_port'], ':&nbsp;</label> <input type="text" size="3" name="ftp_port" id="ftp_port" value="', isset($context['package_ftp']['port']) ? $context['package_ftp']['port'] : (isset($modSettings['package_port']) ? $modSettings['package_port'] : '21'), '" class="input_text" /></div>
							<input type="text" size="30" name="ftp_server" id="ftp_server" value="', isset($context['package_ftp']['server']) ? $context['package_ftp']['server'] : (isset($modSettings['package_server']) ? $modSettings['package_server'] : 'localhost'), '" style="width: 70%;" class="input_text" />
						</dd>

						<dt>
							<label for="ftp_username">', $txt['package_ftp_username'], ':</label>
						</dt>
						<dd>
							<input type="text" size="50" name="ftp_username" id="ftp_username" value="', isset($context['package_ftp']['username']) ? $context['package_ftp']['username'] : (isset($modSettings['package_username']) ? $modSettings['package_username'] : ''), '" style="width: 99%;" class="input_text" />
						</dd>

						<dt>
							<label for="ftp_password">', $txt['package_ftp_password'], ':</label>
						</dt>
						<dd>
							<input type="password" size="50" name="ftp_password" id="ftp_password" style="width: 99%;" class="input_text" />
						</dd>

						<dt>
							<label for="ftp_path">', $txt['package_ftp_path'], ':</label>
						</dt>
						<dd>
							<input type="text" size="50" name="ftp_path" id="ftp_path" value="', $context['package_ftp']['path'], '" style="width: 99%;" class="input_text" />
						</dd>
					</dl>
				</div>
				<span class="botslice"><span></span></span>
			</div>';
    }
    // Install?
    echo '
			<div class="righttext padding">
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="submit" name="do_install" value="', $txt['add_language_smf_install'], '" class="button_submit" />
			</div>
		</form>
	</div>
	<br class="clear" />';
    // The javascript for expand and collapse of sections.
    echo '
	<script type="text/javascript"><!-- // --><![CDATA[';
    // Each theme gets its own handler.
    foreach ($context['files']['images'] as $theme => $group) {
        $count = 0;
        echo '
			var oTogglePanel_', $theme, ' = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: true,
				aSwappableContainers: [';
        foreach ($group as $file) {
            echo '
					', JavaScriptEscape($theme . '-' . $count++), ',';
        }
        echo '
					null
				],
				aSwapImages: [
					{
						sId: \'toggle_image_', $theme, '\',
						srcExpanded: smf_images_url + \'/sort_down.gif\',
						altExpanded: \'*\',
						srcCollapsed: smf_images_url + \'/selected.gif\',
						altCollapsed: \'*\'
					}
				]
			});';
    }
    echo '
	// ]]></script>';
}
Esempio n. 6
0
/**
 * Creates a box that can be used for richedit stuff like BBC, Smileys etc.
 * @param mixed[] $editorOptions associative array of options => value
 *  must contain:
 *   - id => unique id for the css
 *   - value => text for the editor or blank
 *  Optionaly
 *   - height => height of the intial box
 *   - width => width of the box (100%)
 *   - force_rich => force wysiwyg to be enabled
 *   - disable_smiley_box => boolean to turn off the smiley box
 *   - labels => array(
 *       - 'post_button' => $txt['for post button'],
 *     ),
 *   - preview_type => 2 how to act on preview click, see template_control_richedit_buttons
 */
function create_control_richedit($editorOptions)
{
    global $txt, $modSettings, $options, $context, $settings, $user_info, $scripturl;
    static $bbc_tags;
    $db = database();
    // Load the Post language file... for the moment at least.
    loadLanguage('Post');
    if (!empty($context['drafts_save']) || !empty($context['drafts_pm_save'])) {
        loadLanguage('Drafts');
    }
    // Every control must have a ID!
    assert(isset($editorOptions['id']));
    assert(isset($editorOptions['value']));
    // Is this the first richedit - if so we need to ensure things are initialised and that we load all of the needed files
    if (empty($context['controls']['richedit'])) {
        // Store the name / ID we are creating for template compatibility.
        $context['post_box_name'] = $editorOptions['id'];
        // Some general stuff.
        $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
        if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            $context['drafts_autosave_frequency'] = empty($modSettings['drafts_autosave_frequency']) ? 30000 : $modSettings['drafts_autosave_frequency'] * 1000;
        }
        // This really has some WYSIWYG stuff.
        loadTemplate('GenericControls', 'jquery.sceditor');
        if (!empty($context['theme_variant']) && file_exists($settings['theme_dir'] . '/css/' . $context['theme_variant'] . '/jquery.sceditor.elk' . $context['theme_variant'] . '.css')) {
            loadCSSFile($context['theme_variant'] . '/jquery.sceditor.elk' . $context['theme_variant'] . '.css');
        }
        // JS makes the editor go round
        loadJavascriptFile(array('jquery.sceditor.min.js', 'jquery.sceditor.bbcode.min.js', 'jquery.sceditor.elkarte.js', 'post.js', 'splittag.plugin.js', 'dropAttachments.js'));
        addJavascriptVar(array('post_box_name' => $editorOptions['id'], 'elk_smileys_url' => $settings['smileys_url'], 'bbc_quote_from' => $txt['quote_from'], 'bbc_quote' => $txt['quote'], 'bbc_search_on' => $txt['search_on']), true);
        // Editor language file
        if (!empty($txt['lang_locale'])) {
            loadJavascriptFile($scripturl . '?action=jslocale;sa=sceditor', array('defer' => true), 'sceditor_language');
        }
        // Drafts?
        if ((!empty($context['drafts_save']) || !empty($context['drafts_pm_save'])) && !empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            loadJavascriptFile('drafts.plugin.js');
        }
        // Mentions?
        if (!empty($context['mentions_enabled'])) {
            loadJavascriptFile(array('jquery.atwho.js', 'jquery.caret.min.js', 'mentioning.plugin.js'));
        }
        // Our not so concise shortcut line
        $context['shortcuts_text'] = $txt['shortcuts' . (!empty($context['drafts_save']) || !empty($context['drafts_pm_save']) ? '_drafts' : '') . (isBrowser('is_firefox') ? '_firefox' : '')];
        // Spellcheck?
        $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
        if ($context['show_spellchecking']) {
            // Some hidden information is needed in order to make spell check work.
            if (!isset($_REQUEST['xml'])) {
                $context['insert_after_template'] .= '
		<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="' . $scripturl . '?action=spellcheck">
			<input type="hidden" name="spellstring" value="" />
			<input type="hidden" name="fulleditor" value="" />
		</form>';
            }
            loadJavascriptFile('spellcheck.js', array('defer' => true));
        }
    }
    // Start off the editor...
    $context['controls']['richedit'][$editorOptions['id']] = array('id' => $editorOptions['id'], 'value' => $editorOptions['value'], 'rich_active' => !empty($options['wysiwyg_default']) || !empty($editorOptions['force_rich']) || !empty($_REQUEST[$editorOptions['id'] . '_mode']), 'disable_smiley_box' => !empty($editorOptions['disable_smiley_box']), 'columns' => isset($editorOptions['columns']) ? $editorOptions['columns'] : 60, 'rows' => isset($editorOptions['rows']) ? $editorOptions['rows'] : 18, 'width' => isset($editorOptions['width']) ? $editorOptions['width'] : '100%', 'height' => isset($editorOptions['height']) ? $editorOptions['height'] : '250px', 'form' => isset($editorOptions['form']) ? $editorOptions['form'] : 'postmodify', 'bbc_level' => !empty($editorOptions['bbc_level']) ? $editorOptions['bbc_level'] : 'full', 'preview_type' => isset($editorOptions['preview_type']) ? (int) $editorOptions['preview_type'] : 1, 'labels' => !empty($editorOptions['labels']) ? $editorOptions['labels'] : array(), 'locale' => !empty($txt['lang_locale']) ? $txt['lang_locale'] : 'en_US');
    // Switch between default images and back... mostly in case you don't have an PersonalMessage template, but do have a Post template.
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $temp1 = $settings['theme_url'];
        $settings['theme_url'] = $settings['default_theme_url'];
        $temp2 = $settings['images_url'];
        $settings['images_url'] = $settings['default_images_url'];
        $temp3 = $settings['theme_dir'];
        $settings['theme_dir'] = $settings['default_theme_dir'];
    }
    if (empty($bbc_tags)) {
        // The below array is used to show a command button in the editor, the execution
        // and display details of any added buttons must be defined in the javascript files
        // see  jquery.sceditor.elkarte.js under the $.sceditor.plugins.bbcode.bbcode area
        // for examples of how to use the .set command to add codes.  Include your new
        // JS with addInlineJavascript() or loadJavascriptFile()
        $bbc_tags['row1'] = array(array('bold', 'italic', 'underline', 'strike', 'superscript', 'subscript'), array('left', 'center', 'right', 'pre', 'tt'), array('font', 'size', 'color'));
        $bbc_tags['row2'] = array(array('quote', 'code', 'table'), array('bulletlist', 'orderedlist', 'horizontalrule'), array('spoiler', 'footnote'), array('image', 'link', 'email'));
        // Allow mods to add BBC buttons to the toolbar, actions are defined in the JS
        call_integration_hook('integrate_bbc_buttons', array(&$bbc_tags));
        // Show the wysiwyg format and toggle buttons?
        $bbc_tags['row2'][] = array('removeformat', 'source');
        // Generate a list of buttons that shouldn't be shown
        $disabled_tags = array();
        if (!empty($modSettings['disabledBBC'])) {
            $disabled_tags = explode(',', $modSettings['disabledBBC']);
        }
        // Map codes to tags
        $translate_tags_to_code = array('b' => 'bold', 'i' => 'italic', 'u' => 'underline', 's' => 'strike', 'img' => 'image', 'url' => 'link', 'sup' => 'superscript', 'sub' => 'subscript', 'hr' => 'horizontalrule');
        // Remove the toolbar buttons for any bbc tags that have been turned off in the ACP
        foreach ($disabled_tags as $tag) {
            // list is special, its prevents two tags
            if ($tag === 'list') {
                $context['disabled_tags']['bulletlist'] = true;
                $context['disabled_tags']['orderedlist'] = true;
            } elseif (isset($translate_tags_to_code[$tag])) {
                $context['disabled_tags'][$translate_tags_to_code[$tag]] = true;
            }
            // Tag is the same as the code, like font, color, size etc
            $context['disabled_tags'][trim($tag)] = true;
        }
        // Build our toolbar, taking in to account any bbc codes from integration
        $context['bbc_toolbar'] = array();
        foreach ($bbc_tags as $row => $tagRow) {
            if (!isset($context['bbc_toolbar'][$row])) {
                $context['bbc_toolbar'][$row] = array();
            }
            $tagsRow = array();
            // For each row of buttons defined, lets build our tags
            foreach ($tagRow as $tags) {
                foreach ($tags as $tag) {
                    // Just add this code in the existing grouping
                    if (!isset($context['disabled_tags'][$tag])) {
                        $tagsRow[] = $tag;
                    }
                }
                // If the row is not empty, and the last added tag is not a space, add a space.
                if (!empty($tagsRow) && $tagsRow[count($tagsRow) - 1] != 'space') {
                    $tagsRow[] = 'space';
                }
            }
            // Build that beautiful button row
            if (!empty($tagsRow)) {
                $context['bbc_toolbar'][$row][] = implode(',', $tagsRow);
            }
        }
    }
    // Initialize smiley array... if not loaded before.
    if (empty($context['smileys']) && empty($editorOptions['disable_smiley_box'])) {
        $context['smileys'] = array('postform' => array(), 'popup' => array());
        // Load smileys - don't bother to run a query if we're not using the database's ones anyhow.
        if (empty($modSettings['smiley_enable']) && $user_info['smiley_set'] != 'none') {
            $context['smileys']['postform'][] = array('smileys' => array(array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt['icon_smiley']), array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt['icon_wink']), array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt['icon_cheesy']), array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt['icon_grin']), array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt['icon_angry']), array('code' => ':))', 'filename' => 'laugh.gif', 'description' => $txt['icon_laugh']), array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt['icon_sad']), array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt['icon_shocked']), array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt['icon_cool']), array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt['icon_huh']), array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt['icon_rolleyes']), array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt['icon_tongue']), array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt['icon_embarrassed']), array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt['icon_lips']), array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt['icon_undecided']), array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt['icon_kiss']), array('code' => 'O:)', 'filename' => 'angel.gif', 'description' => $txt['icon_angel']), array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt['icon_cry'], 'isLast' => true)), 'isLast' => true);
        } elseif ($user_info['smiley_set'] != 'none') {
            if (($temp = cache_get_data('posting_smileys', 480)) == null) {
                $request = $db->query('', '
					SELECT code, filename, description, smiley_row, hidden
					FROM {db_prefix}smileys
					WHERE hidden IN (0, 2)
					ORDER BY smiley_row, smiley_order', array());
                while ($row = $db->fetch_assoc($request)) {
                    $row['filename'] = htmlspecialchars($row['filename'], ENT_COMPAT, 'UTF-8');
                    $row['description'] = htmlspecialchars($row['description'], ENT_COMPAT, 'UTF-8');
                    $context['smileys'][empty($row['hidden']) ? 'postform' : 'popup'][$row['smiley_row']]['smileys'][] = $row;
                }
                $db->free_result($request);
                foreach ($context['smileys'] as $section => $smileyRows) {
                    $last_row = null;
                    foreach ($smileyRows as $rowIndex => $smileys) {
                        $context['smileys'][$section][$rowIndex]['smileys'][count($smileys['smileys']) - 1]['isLast'] = true;
                        $last_row = $rowIndex;
                    }
                    if ($last_row !== null) {
                        $context['smileys'][$section][$last_row]['isLast'] = true;
                    }
                }
                cache_put_data('posting_smileys', $context['smileys'], 480);
            } else {
                $context['smileys'] = $temp;
            }
            // The smiley popup may take advantage of Jquery UI ....
            if (!empty($context['smileys']['popup'])) {
                $modSettings['jquery_include_ui'] = true;
            }
        }
    }
    // Set a flag so the sub template knows what to do...
    $context['show_bbc'] = !empty($modSettings['enableBBC']) && !empty($settings['show_bbc']);
    // Switch the URLs back... now we're back to whatever the main sub template is.  (like folder in PersonalMessage.)
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $settings['theme_url'] = $temp1;
        $settings['images_url'] = $temp2;
        $settings['theme_dir'] = $temp3;
    }
    if (!empty($editorOptions['live_errors'])) {
        loadLanguage('Errors');
        addInlineJavascript('
	error_txts[\'no_subject\'] = ' . JavaScriptEscape($txt['error_no_subject']) . ';
	error_txts[\'no_message\'] = ' . JavaScriptEscape($txt['error_no_message']) . ';

	var subject_err = new errorbox_handler({
		self: \'subject_err\',
		error_box_id: \'post_error\',
		error_checks: [{
			code: \'no_subject\',
			efunction: function(box_value) {
				if (box_value.length === 0)
					return true;
				else
					return false;
			}
		}],
		check_id: "post_subject"
	});

	var body_err_' . $editorOptions['id'] . ' = new errorbox_handler({
		self: \'body_err_' . $editorOptions['id'] . '\',
		error_box_id: \'post_error\',
		error_checks: [{
			code: \'no_message\',
			efunction: function(box_value) {
				if (box_value.length === 0)
					return true;
				else
					return false;
			}
		}],
		editor_id: \'' . $editorOptions['id'] . '\',
		editor: ' . JavaScriptEscape('
		(function () {
			return $editor_data[\'' . $editorOptions['id'] . '\'].val();
		});') . '
	});', true);
    }
}
/**
 * View the details of a moderation report
 */
function template_viewmodreport()
{
    global $context, $scripturl, $txt;
    echo '
					<div id="modcenter">
						<form action="', $scripturl, '?action=moderate;area=reports;report=', $context['report']['id'], '" method="post" accept-charset="UTF-8">
							<h3 class="category_header">
								', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
							</h3>
							<div class="windowbg2">
								<p class="warningbox">', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '</p>
								<div class="content">
									', $context['report']['body'], '
								</div>
								<ul class="quickbuttons">
									<li class="listlevel1">
										<a class="linklevel1 close_button" href="', $scripturl, '?action=moderate;area=reports;close=', (int) (!$context['report']['closed']), ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['report']['closed'] ? $txt['mc_reportedp_open'] : $txt['mc_reportedp_close'], '</a>
									</li>
									<li class="listlevel1">
										<a class="linklevel1 ignore_button" href="', $scripturl, '?action=moderate;area=reports;ignore=', (int) (!$context['report']['ignore']), ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], '" ', !$context['report']['ignore'] ? 'onclick="return confirm(' . JavaScriptEscape($txt['mc_reportedp_ignore_confirm']) . ');"' : '', '>', $context['report']['ignore'] ? $txt['mc_reportedp_unignore'] : $txt['mc_reportedp_ignore'], '</a>
									</li>
								</ul>
							</div>
							<h3 class="category_header">', $txt['mc_modreport_whoreported_title'], '</h3>';
    foreach ($context['report']['comments'] as $comment) {
        echo '
							<div class="windowbg">
								<div class="content">
									<p class="smalltext">', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '</p>
									<p>', $comment['message'], '</p>
								</div>
							</div>';
    }
    echo '
							<h3 class="category_header">', $txt['mc_modreport_mod_comments'], '</h3>
							<div class="windowbg2">
								<div class="content">';
    if (empty($context['report']['mod_comments'])) {
        echo '
									<p class="successbox">', $txt['mc_modreport_no_mod_comment'], '</p>';
    }
    foreach ($context['report']['mod_comments'] as $comment) {
        echo '<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
    }
    echo '
									<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 100%') . ';" name="mod_comment"></textarea>
									<div class="submitbutton">
										<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button_submit" />
									</div>
								</div>
							</div>';
    template_show_list('moderation_actions_list');
    echo '
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
						</form>
					</div>';
}
/**
 * The infocenter ... stats, recent topics, other important information that never gets seen :P
 */
function template_info_center()
{
    global $context, $txt;
    // Here's where the "Info Center" starts...
    echo '
	<div id="info_center" class="forum_category">
		<h2 class="category_header">
			<span id="category_toggle">&nbsp;
				<span id="upshrink_ic" class="', empty($context['minmax_preferences']['info']) ? 'collapse' : 'expand', '" style="display: none;" title="', $txt['hide'], '"></span>
			</span>
			<a href="#" id="upshrink_link">', sprintf($txt['info_center_title'], $context['forum_name_html_safe']), '</a>
		</h2>
		<ul id="upshrinkHeaderIC" class="category_boards"', empty($context['minmax_preferences']['info']) ? '' : ' style="display: none;"', '>';
    call_template_callbacks('ic', $context['info_center_callbacks']);
    echo '
		</ul>
	</div>';
    // Info center collapse object.
    echo '
	<script><!-- // --><![CDATA[
		var oInfoCenterToggle = new elk_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($context['minmax_preferences']['info']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'upshrinkHeaderIC\'
			],
			aSwapClasses: [
				{
					sId: \'upshrink_ic\',
					classExpanded: \'collapse\',
					titleExpanded: ', JavaScriptEscape($txt['hide']), ',
					classCollapsed: \'expand\',
					titleCollapsed: ', JavaScriptEscape($txt['show']), '
				}
			],
			aSwapLinks: [
				{
					sId: \'upshrink_link\',
					msgExpanded: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), ',
					msgCollapsed: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'minmax_preferences\',
				sSessionId: elk_session_id,
				sSessionVar: elk_session_var,
				sAdditionalVars: \';minmax_key=info\'
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'upshrinkIC\'
			}
		});
	// ]]></script>';
}
    /**
     * Configuration settings for the admin template
     *
     * @return string
     */
    public function settings()
    {
        global $txt, $scripturl, $modSettings;
        // Generate a sample registration image.
        $verification_image = $scripturl . '?action=verificationcode;rand=' . md5(mt_rand());
        // Visual verification.
        $config_vars = array(array('title', 'configure_verification_means'), array('desc', 'configure_verification_means_desc'), array('int', 'visual_verification_num_chars'), 'vv' => array('select', 'visual_verification_type', array($txt['setting_image_verification_off'], $txt['setting_image_verification_vsimple'], $txt['setting_image_verification_simple'], $txt['setting_image_verification_medium'], $txt['setting_image_verification_high'], $txt['setting_image_verification_extreme']), 'subtext' => $txt['setting_visual_verification_type_desc']));
        // Save it
        if (isset($_GET['save'])) {
            if (isset($_POST['visual_verification_num_chars']) && $_POST['visual_verification_num_chars'] < 6) {
                $_POST['visual_verification_num_chars'] = 5;
            }
        }
        $_SESSION['visual_verification_code'] = '';
        for ($i = 0; $i < $this->_num_chars; $i++) {
            $_SESSION['visual_verification_code'] .= $this->_standard_captcha_range[array_rand($this->_standard_captcha_range)];
        }
        // Some javascript for CAPTCHA.
        if ($this->_use_graphic_library) {
            loadJavascriptFile('jquery.captcha.js');
            addInlineJavascript('
		$(\'#visual_verification_type\').Elk_Captcha({
			\'imageURL\': ' . JavaScriptEscape($verification_image) . ',
			\'useLibrary\': true,
			\'letterCount\': ' . $this->_num_chars . ',
			\'refreshevent\': \'change\',
			\'admin\': true
		});', true);
        }
        // Show the image itself, or text saying we can't.
        if ($this->_use_graphic_library) {
            $config_vars['vv']['postinput'] = '<br /><img src="' . $verification_image . ';type=' . (empty($modSettings['visual_verification_type']) ? 0 : $modSettings['visual_verification_type']) . '" alt="' . $txt['setting_image_verification_sample'] . '" id="verification_image" /><br />';
        } else {
            $config_vars['vv']['postinput'] = '<br /><span class="smalltext">' . $txt['setting_image_verification_nogd'] . '</span>';
        }
        return $config_vars;
    }
Esempio n. 10
0
/**
 * SMF Arcade
 *
 * @package SMF Arcade
 * @version 2.6 Alpha
 * @license http://download.smfarcade.info/license.php New-BSD
 */
function template_arcade_game_above()
{
    global $scripturl, $txt, $context, $settings;
    // Play link
    $context['arcade']['buttons']['play'] = array('text' => 'arcade_play', 'image' => 'arcade_play.gif', 'url' => !empty($context['arcade']['play']) ? $scripturl . '?action=arcade;sa=play;game=' . $context['game']['id'] . '" onclick="arcadeRestart(); return false;' : $scripturl . '?action=arcade;sa=play;game=' . $context['game']['id'], 'lang' => true);
    // Highscores link if it is supported
    if ($context['game']['highscore_support']) {
        $context['arcade']['buttons']['score'] = array('text' => 'arcade_viewscore', 'image' => 'arcade_viewscore.gif', 'url' => $scripturl . '?action=arcade;sa=highscore;game=' . $context['game']['id'], 'lang' => true);
    }
    // Random game
    $context['arcade']['buttons']['random'] = array('text' => 'arcade_random_game', 'image' => 'arcade_random.gif', 'url' => $scripturl . '?action=arcade;sa=play;random', 'lang' => true);
    if ($context['arcade']['can_admin_arcade']) {
        $context['arcade']['buttons']['edit'] = array('text' => 'arcade_edit_game', 'image' => 'arcade_edit_game.gif', 'url' => $scripturl . '?action=admin;area=managegames;sa=edit;game=' . $context['game']['id'], 'lang' => true);
    }
    $ratecode = '';
    $rating = $context['game']['rating'];
    if ($context['arcade']['can_rate']) {
        // Can rate
        for ($i = 1; $i <= 5; $i++) {
            if ($i <= $rating) {
                $ratecode .= '<a href="' . $scripturl . '?action=arcade;sa=rate;game=' . $context['game']['id'] . ';rate=' . $i . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="arcade_rate(' . $i . ', ' . $context['game']['id'] . '); return false;"><img id="imgrate' . $i . '" src="' . $settings['images_url'] . '/arcade_star.gif" alt="*" /></a>';
            } else {
                $ratecode .= '<a href="' . $scripturl . '?action=arcade;sa=rate;game=' . $context['game']['id'] . ';rate=' . $i . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="arcade_rate(' . $i . ', ' . $context['game']['id'] . '); return false;"><img id="imgrate' . $i . '" src="' . $settings['images_url'] . '/arcade_star2.gif" alt="*" /></a>';
            }
        }
    } else {
        // Can't rate
        $ratecode = str_repeat('<img src="' . $settings['images_url'] . '/arcade_star.gif" alt="*" />', $rating);
        $ratecode .= str_repeat('<img src="' . $settings['images_url'] . '/arcade_star2.gif" alt="" />', 5 - $rating);
    }
    echo '
	<div class="cat_bar">
		<h3 class="catbg">
			<span class="floatleft">', $context['game']['name'], '</span>
			<img id="game_toggle" class="floatright" src="', $settings['images_url'], '/collapse.gif', '" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="margin: 10px 5px 0 1em; display: none;" />
		</h3>
	</div>
	<div id="game_panel" class="windowbg2" style="', empty($options['game_panel_collapse']) ? '' : ' display: none;', '">
		<span class="topslice"><span></span></span>
		', !empty($context['game']['thumbnail']) ? '<img class="floatleft thumb" src="' . $context['game']['thumbnail'] . '" alt="" />' : '', '
		<div class="floatleft scores">';
    if ($context['game']['is_champion']) {
        echo '
				<strong>', $txt['arcade_champion'], ':</strong> ', $context['game']['champion']['link'], ' - ', $context['game']['champion']['score'], '<br />';
    }
    if ($context['game']['is_personal_best']) {
        echo '
				<strong>', $txt['arcade_personal_best'], ':</strong> ', $context['game']['personal_best'], '<br />';
    }
    echo '
		</div>
		<div class="floatright rating" style="text-align: right">';
    if ($context['arcade']['can_favorite']) {
        echo '
			<a href="', $context['game']['url']['favorite'], '" onclick="arcade_favorite(', $context['game']['id'], '); return false;">', !$context['game']['is_favorite'] ? '<img id="favgame' . $context['game']['id'] . '" src="' . $settings['images_url'] . '/favorite.gif" alt="' . $txt['arcade_add_favorites'] . '" />' : '<img id="favgame' . $context['game']['id'] . '" src="' . $settings['images_url'] . '/favorite2.gif" alt="' . $txt['arcade_remove_favorite'] . '" />', '</a><br />';
    }
    if ($context['arcade']['can_rate']) {
        echo '
			', $ratecode, '<br />';
    }
    echo '
		</div>
		<br class="clear" />
		<span class="botslice"><span></span></span>
	</div>
	<script type="text/javascript"><!-- // --><![CDATA[
		var oGameHeaderToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['game_panel_collapse']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'game_panel\'
			],
			aSwapImages: [
				{
					sId: \'game_toggle\',
					srcExpanded: smf_images_url + \'/collapse.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'game_panel_collapse\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'arcadegameupshrink\'
			}
		});
	// ]]></script>';
}
Esempio n. 11
0
/**
 * This is quick reply area below all the message body's
 */
function template_quickreply_below()
{
    global $context, $options, $settings, $txt, $modSettings, $scripturl;
    // Yeah, I know, though at the moment is the only way...
    global $removableMessageIDs, $ignoredMsgs;
    // Using the quick reply box below the messages and you can reply?
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
			<a id="quickreply"></a>
			<div class="forumposts" id="quickreplybox">
				<h2 class="category_header">
					<span id="category_toggle">&nbsp;
						<a href="javascript:oQuickReply.swap();">
							<span id="quickReplyExpand" class="', empty($context['minmax_preferences']['qreply']) ? 'collapse' : 'expand', '" title="', $txt['hide'], '"></span>
						</a>
					</span>
					<a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a>
				</h2>
				<div id="quickReplyOptions" class="windowbg"', empty($context['minmax_preferences']['qreply']) ? '' : ' style="display: none"', '>
					<div class="editor_wrapper">
						', $context['is_locked'] ? '<p class="alert smalltext">' . $txt['quick_reply_warning'] . '</p>' : '', $context['oldTopicError'] ? '<p class="alert smalltext">' . sprintf($txt['error_old_topic'], $modSettings['oldTopicDays']) . '</p>' : '', '
						', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
						', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
						<form action="', $scripturl, '?board=', $context['current_board'], ';action=post2" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" onsubmit="submitonce(this);', !empty($modSettings['mentions_enabled']) ? 'revalidateMentions(\'postmodify\', \'' . (empty($options['use_editor_quick_reply']) ? 'message' : $context['post_box_name']) . '\');' : '', '">
							<input type="hidden" name="topic" value="', $context['current_topic'], '" />
							<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
							<input type="hidden" name="icon" value="xx" />
							<input type="hidden" name="from_qr" value="1" />
							<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
							<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
							<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
							<input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />
							<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
							<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />';
        // Guests just need more.
        if ($context['user']['is_guest']) {
            echo '
							<dl>
								<dt>
									<strong><label for="guestname">', $txt['name'], '</label>:</strong> <input type="text" name="guestname" id="guestname" value="', $context['name'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
								</dd>
								<dt>
									<strong><label for="email">', $txt['email'], '</label>:</strong> <input type="text" name="email" id="email" value="', $context['email'], '" size="25" class="input_text" tabindex="', $context['tabindex']++, '" />
								</dd>
							</dl>';
        }
        // Is visual verification enabled?
        if ($context['require_verification']) {
            template_verification_controls($context['visual_verification_id'], '
							<strong>' . $txt['verification'] . ':</strong>', '<br />');
        }
        // Using the full editor or a plain text box?
        if (empty($options['use_editor_quick_reply'])) {
            echo '
							<div class="quickReplyContent">
								<textarea cols="600" rows="7" class="quickreply" name="message" id="message" tabindex="', $context['tabindex']++, '"></textarea>
							</div>';
        } else {
            echo '
							', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
        }
        echo '
							<div id="post_confirm_buttons" class="submitbutton">
								<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        // Spellcheck button?
        if ($context['show_spellchecking']) {
            echo '
								<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\', ', empty($options['use_editor_quick_reply']) ? 'false' : 'true', ')" tabindex="', $context['tabindex']++, '" class="button_submit" />';
        }
        // Draft save button?
        if (!empty($context['drafts_save'])) {
            echo '
								<input type="submit" name="save_draft" value="', $txt['draft_save'], '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" tabindex="', $context['tabindex']++, '" class="button_submit" />
								<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';
        }
        echo '
							</div>';
        // Show the draft last saved on area
        if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            echo '
							<div class="draftautosave">
								<span id="throbber" style="display:none"><i class="fa fa-spinner fa-spin"></i>&nbsp;</span>
								<span id="draft_lastautosave"></span>
							</div>';
        }
        echo '
						</form>
					</div>
				</div>
			</div>';
        // Using the plain text box we need to load in some additonal javascript
        if (empty($options['use_editor_quick_reply'])) {
            echo '
			<script><!-- // --><![CDATA[';
            // Draft autosave available and the user has it enabled?
            if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
                echo '
				var oDraftAutoSave = new elk_DraftAutoSave({
					sSelf: \'oDraftAutoSave\',
					sLastNote: \'draft_lastautosave\',
					sLastID: \'id_draft\',
					iBoard: ', empty($context['current_board']) ? 0 : $context['current_board'], ',
					iFreq: ', isset($context['drafts_autosave_frequency']) ? $context['drafts_autosave_frequency'] : 30000, '
				});';
            }
            // Mentions enabled
            if (!empty($modSettings['mentions_enabled'])) {
                echo '
				add_elk_mention(\'#message\');';
            }
            echo '
			// ]]></script>';
        }
    }
    // Finally enable the quick reply quote function
    echo '
		<script><!-- // --><![CDATA[
			var oQuickReply = new QuickReply({
				bDefaultCollapsed: ', empty($context['minmax_preferences']['qreply']) ? 'false' : 'true', ',
				iTopicId: ', $context['current_topic'], ',
				iStart: ', $context['start'], ',
				sScriptUrl: elk_scripturl,
				sImagesUrl: elk_images_url,
				sContainerId: "quickReplyOptions",
				sClassId: "quickReplyExpand",
				sClassCollapsed: "collapse",
				sTitleCollapsed: ', JavaScriptEscape($txt['show']), ',
				sClassExpanded: "expand",
				sTitleExpanded: ', JavaScriptEscape($txt['hide']), ',
				sJumpAnchor: "quickreply",
				bIsFull: ', !empty($options['use_editor_quick_reply']) ? 'true,
				sEditorId: ' . $options['use_editor_quick_reply'] : 'false', ',
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'minmax_preferences\',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAdditionalVars: \';minmax_key=qreply\'
				},
				oCookieOptions: {
					bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
					sCookieName: \'elk_qreply\'
				}
			});
		// ]]></script>';
    // Spell check for quick modify and quick reply (w/o the editor)
    if ($context['show_spellchecking']) {
        echo '
			<form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
				<input type="hidden" id="spellstring" name="spellstring" value="" />
				<input type="hidden" id="fulleditor" name="fulleditor" value="" />
			</form>';
    }
    // Quick moderation options
    echo '
			<script><!-- // --><![CDATA[';
    if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) {
        echo '
				var oInTopicModeration = new InTopicModeration({
					sSelf: \'oInTopicModeration\',
					sCheckboxContainerMask: \'in_topic_mod_check_\',
					aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sButtonStrip: \'moderationbuttons\',
					sButtonStripDisplay: \'moderationbuttons_strip\',
					sButtonStripClass: \'menuitem\',
					bUseImageButton: false,
					bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
					sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
					sRemoveButtonImage: \'delete_selected.png\',
					sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
					sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
					sRestoreButtonImage: \'restore_selected.png\',
					sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					bCanSplit: ', $context['can_split'] ? 'true' : 'false', ',
					sSplitButtonLabel: \'', $txt['quickmod_split_selected'], '\',
					sSplitButtonImage: \'split_selected.png\',
					sSplitButtonConfirm: \'', $txt['quickmod_confirm'], '\',
					sFormId: \'quickModForm\'
				});';
    }
    // Quick modify can be used
    echo '
				var oQuickModify = new QuickModify({
					sIconHide: \'xx.png\',
					sScriptUrl: elk_scripturl,
					sClassName: \'quick_edit\',
					sIDSubject: \'post_subject_\',
					sIDInfo: \'info_\',
					bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
					iTopicId: ', $context['current_topic'], ',
					sTemplateBodyEdit: ', JavaScriptEscape('
						<div id="quick_edit_body_container" style="width: 90%;">
							<div id="error_box" class="errorbox" style="display:none;"></div>
							<textarea class="editor" name="message" rows="12" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
							<input type="hidden" name="\' + elk_session_var + \'" value="\' + elk_session_id + \'" />
							<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
							<input type="hidden" name="msg" value="%msg_id%" />
							<div class="righttext">
								<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" />&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="' . $context['tabindex']++ . '" onclick="spellCheck(\'quickModForm\', \'message\', false);" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="' . $context['tabindex']++ . '" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
							</div>
						</div>'), ',
					sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
					sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 85%;" name="subject" value="%subject%" size="80" maxlength="80" tabindex="' . $context['tabindex']++ . '" class="input_text" />'), ',
					sTemplateSubjectNormal: ', JavaScriptEscape('%subject%'), ',
					sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $context['num_views_text'] . ')'), ',
					sTemplateInfoNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a><span class="smalltext modified" id="modified_%msg_id%"></span>'), $context['can_reply'] && !empty($options['display_quick_reply']) ? ',
					sFormRemoveAccessKeys: \'postmodify\'' : '', ',
					funcOnAfterCreate: function () {
						// Attach AtWho to the quick edit box
						add_elk_mention(\'#quick_edit_body_container textarea\');
						var i = all_elk_mentions.length - 1;
						all_elk_mentions[i].oMention = new elk_mentions(all_elk_mentions[i].oOptions);
					}
				});

				aIconLists[aIconLists.length] = new IconList({
					sBackReference: "aIconLists[" + aIconLists.length + "]",
					sIconIdPrefix: "msg_icon_",
					sScriptUrl: elk_scripturl,
					bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
					iBoardId: ', $context['current_board'], ',
					iTopicId: ', $context['current_topic'], ',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAction: "messageicons;board=', $context['current_board'], '" ,
					sLabelIconList: "', $txt['message_icon'], '",
					sBoxBackground: "transparent",
					sBoxBackgroundHover: "#ffffff",
					iBoxBorderWidthHover: 1,
					sBoxBorderColorHover: "#adadad" ,
					sContainerBackground: "#ffffff",
					sContainerBorder: "1px solid #adadad",
					sItemBorder: "1px solid #ffffff",
					sItemBorderHover: "1px dotted gray",
					sItemBackground: "transparent",
					sItemBackgroundHover: "#e0e0f0"
				});';
    if (!empty($ignoredMsgs)) {
        echo '
				ignore_toggles([', implode(', ', $ignoredMsgs), '], ', JavaScriptEscape($txt['show_ignore_user_post']), ');';
    }
    echo '
			// ]]></script>';
}
Esempio n. 12
0
function constructPageIndex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
{
    global $modSettings;
    // Save whether $start was less than 0 or not.
    $start = (int) $start;
    $start_invalid = $start < 0;
    // Make sure $start is a proper variable - not less than 0.
    if ($start_invalid) {
        $start = 0;
    } elseif ($start >= $max_value) {
        $start = max(0, (int) $max_value - ((int) $max_value % (int) $num_per_page == 0 ? $num_per_page : (int) $max_value % (int) $num_per_page));
    } else {
        $start = max(0, (int) $start - (int) $start % (int) $num_per_page);
    }
    // Wireless will need the protocol on the URL somewhere.
    if (WIRELESS) {
        $base_url .= ';' . WIRELESS_PROTOCOL;
    }
    $base_link = '<a class="navPages" href="' . ($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d') . '">%2$s</a> ';
    // Compact pages is off or on?
    if (empty($modSettings['compactTopicPagesEnable'])) {
        // Show the left arrow.
        $pageindex = $start == 0 ? ' ' : sprintf($base_link, $start - $num_per_page, '&#171;');
        // Show all the pages.
        $display_page = 1;
        for ($counter = 0; $counter < $max_value; $counter += $num_per_page) {
            $pageindex .= $start == $counter && !$start_invalid ? '<strong>' . $display_page++ . '</strong> ' : sprintf($base_link, $counter, $display_page++);
        }
        // Show the right arrow.
        $display_page = $start + $num_per_page > $max_value ? $max_value : $start + $num_per_page;
        if ($start != $counter - $max_value && !$start_invalid) {
            $pageindex .= $display_page > $counter - $num_per_page ? ' ' : sprintf($base_link, $display_page, '&#187;');
        }
    } else {
        // If they didn't enter an odd value, pretend they did.
        $PageContiguous = (int) ($modSettings['compactTopicPagesContiguous'] - $modSettings['compactTopicPagesContiguous'] % 2) / 2;
        // Show the first page. (>1< ... 6 7 [8] 9 10 ... 15)
        if ($start > $num_per_page * $PageContiguous) {
            $pageindex = sprintf($base_link, 0, '1');
        } else {
            $pageindex = '';
        }
        // Show the ... after the first page.  (1 >...< 6 7 [8] 9 10 ... 15)
        if ($start > $num_per_page * ($PageContiguous + 1)) {
            $pageindex .= '<span style="font-weight: bold;" onclick="' . htmlspecialchars('expandPages(this, ' . JavaScriptEscape($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d') . ', ' . $num_per_page . ', ' . ($start - $num_per_page * $PageContiguous) . ', ' . $num_per_page . ');') . '" onmouseover="this.style.cursor = \'pointer\';"> ... </span>';
        }
        // Show the pages before the current one. (1 ... >6 7< [8] 9 10 ... 15)
        for ($nCont = $PageContiguous; $nCont >= 1; $nCont--) {
            if ($start >= $num_per_page * $nCont) {
                $tmpStart = $start - $num_per_page * $nCont;
                $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
            }
        }
        // Show the current page. (1 ... 6 7 >[8]< 9 10 ... 15)
        if (!$start_invalid) {
            $pageindex .= '[<strong>' . ($start / $num_per_page + 1) . '</strong>] ';
        } else {
            $pageindex .= sprintf($base_link, $start, $start / $num_per_page + 1);
        }
        // Show the pages after the current one... (1 ... 6 7 [8] >9 10< ... 15)
        $tmpMaxPages = (int) (($max_value - 1) / $num_per_page) * $num_per_page;
        for ($nCont = 1; $nCont <= $PageContiguous; $nCont++) {
            if ($start + $num_per_page * $nCont <= $tmpMaxPages) {
                $tmpStart = $start + $num_per_page * $nCont;
                $pageindex .= sprintf($base_link, $tmpStart, $tmpStart / $num_per_page + 1);
            }
        }
        // Show the '...' part near the end. (1 ... 6 7 [8] 9 10 >...< 15)
        if ($start + $num_per_page * ($PageContiguous + 1) < $tmpMaxPages) {
            $pageindex .= '<span style="font-weight: bold;" onclick="expandPages(this, \'' . ($flexible_start ? strtr($base_url, array('\'' => '\\\'')) : strtr($base_url, array('%' => '%%', '\'' => '\\\'')) . ';start=%1$d') . '\', ' . ($start + $num_per_page * ($PageContiguous + 1)) . ', ' . $tmpMaxPages . ', ' . $num_per_page . ');" onmouseover="this.style.cursor=\'pointer\';"> ... </span>';
        }
        // Show the last number in the list. (1 ... 6 7 [8] 9 10 ... >15<)
        if ($start + $num_per_page * $PageContiguous < $tmpMaxPages) {
            $pageindex .= sprintf($base_link, $tmpMaxPages, $tmpMaxPages / $num_per_page + 1);
        }
    }
    return $pageindex;
}
Esempio n. 13
0
function template_maintain_topics()
{
    global $scripturl, $txt, $context, $settings, $modSettings;
    // If maintenance has finished tell the user.
    if (!empty($context['maintenance_finished'])) {
        echo '
			<div class="maintenance_finished">
				', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
			</div>';
    }
    // Bit of javascript for showing which boards to prune in an otherwise hidden list.
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			var rotSwap = false;
			function swapRot()
			{
				rotSwap = !rotSwap;

				// Toggle icon
				document.getElementById("rotIcon").src = smf_images_url + (rotSwap ? "/collapse.gif" : "/expand.gif");
				setInnerHTML(document.getElementById("rotText"), rotSwap ? ', JavaScriptEscape($txt['maintain_old_choose']), ' : ', JavaScriptEscape($txt['maintain_old_all']), ');

				// Toggle panel
				document.getElementById("rotPanel").style.display = !rotSwap ? "none" : "";

				// Toggle checkboxes
				var rotPanel = document.getElementById(\'rotPanel\');
				var oBoardCheckBoxes = rotPanel.getElementsByTagName(\'input\');
				for (var i = 0; i < oBoardCheckBoxes.length; i++)
				{
					if (oBoardCheckBoxes[i].type.toLowerCase() == "checkbox")
						oBoardCheckBoxes[i].checked = !rotSwap;
				}
			}
		// ]]></script>';
    echo '
	<div id="manage_maintenance">
		<div class="cat_bar">
			<h3>', $txt['maintain_old'], '</h3>
		</div>
		<div class="blue_container cleantop">
			<div class="content flow_auto">
				<form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=pruneold" method="post" accept-charset="UTF-8">';
    // The otherwise hidden "choose which boards to prune".
    echo '
					<p>
						<a id="rotLink"></a>', $txt['maintain_old_since_days1'], '<input type="text" name="maxdays" value="30" size="3" />', $txt['maintain_old_since_days2'], '
					</p>
					<p>
						<label for="delete_type_nothing"><input type="radio" name="delete_type" id="delete_type_nothing" value="nothing" class="input_radio" /> ', $txt['maintain_old_nothing_else'], '</label><br />
						<label for="delete_type_moved"><input type="radio" name="delete_type" id="delete_type_moved" value="moved" class="input_radio" checked="checked" /> ', $txt['maintain_old_are_moved'], '</label><br />
						<label for="delete_type_locked"><input type="radio" name="delete_type" id="delete_type_locked" value="locked" class="input_radio" /> ', $txt['maintain_old_are_locked'], '</label><br />
					</p>';
    if (!empty($modSettings['enableStickyTopics'])) {
        echo '
					<p>
						<label for="delete_old_not_sticky"><input type="checkbox" name="delete_old_not_sticky" id="delete_old_not_sticky" class="input_check" checked="checked" /> ', $txt['maintain_old_are_not_stickied'], '</label><br />
					</p>';
    }
    echo '
					<p>
						<a href="#rotLink" onclick="swapRot();"><img src="', $settings['images_url'], '/expand.gif" alt="+" id="rotIcon" /></a> <a href="#rotLink" onclick="swapRot();" id="rotText" style="font-weight: bold;">', $txt['maintain_old_all'], '</a>
					</p>
					<div style="display: none;" id="rotPanel" class="flow_hidden">
						<div class="floatleft" style="width: 49%">';
    // This is the "middle" of the list.
    $middle = ceil(count($context['categories']) / 2);
    $i = 0;
    foreach ($context['categories'] as $category) {
        echo '
							<fieldset>
								<legend>', $category['name'], '</legend>
								<ul class="reset">';
        // Display a checkbox with every board.
        foreach ($category['boards'] as $board) {
            echo '
									<li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"><label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked="checked" class="input_check" />', $board['name'], '</label></li>';
        }
        echo '
								</ul>
							</fieldset>';
        // Increase $i, and check if we're at the middle yet.
        if (++$i == $middle) {
            echo '
						</div>
						<div class="floatright" style="width: 49%;">';
        }
    }
    echo '
						</div>
					</div>
					<span><input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_confirm'], '\');" class="button_submit" /></span>
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				</form>
			</div>
		</div>
		<br>
		<div class="cat_bar">
			<h3>', $txt['move_topics_maintenance'], '</h3>
		</div>
		<div class="blue_container cleantop">
			<div class="content">
				<form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=massmove" method="post" accept-charset="UTF-8">
					<p><label for="id_board_from">', $txt['move_topics_from'], ' </label>
					<select name="id_board_from" id="id_board_from">
						<option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
    // From board
    foreach ($context['categories'] as $category) {
        echo '
						<option disabled="disabled">--------------------------------------</option>
						<option disabled="disabled">', $category['name'], '</option>
						<option disabled="disabled">--------------------------------------</option>';
        foreach ($category['boards'] as $board) {
            echo '
						<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
        }
    }
    echo '
					</select>
					<label for="id_board_to">', $txt['move_topics_to'], '</label>
					<select name="id_board_to" id="id_board_to">
						<option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
    // To board
    foreach ($context['categories'] as $category) {
        echo '
						<option disabled="disabled">--------------------------------------</option>
						<option disabled="disabled">', $category['name'], '</option>
						<option disabled="disabled">--------------------------------------</option>';
        foreach ($category['boards'] as $board) {
            echo '
						<option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
        }
    }
    echo '
					</select></p>
					<span><input type="submit" value="', $txt['move_topics_now'], '" onclick="if (document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_from\').selectedIndex].disabled || document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_to\').selectedIndex].disabled) return false; var confirmText = \'', $txt['move_topics_confirm'] . '\'; return confirm(confirmText.replace(/%board_from%/, document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_from\').selectedIndex].text.replace(/^=+&gt;&nbsp;/, \'\')).replace(/%board_to%/, document.getElementById(\'id_board_to\').options[document.getElementById(\'id_board_to\').selectedIndex].text.replace(/^=+&gt;&nbsp;/, \'\')));" class="button_submit" /></span>
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				</form>
			</div>
		</div>
	</div>
	<br class="clear" />';
}
Esempio n. 14
0
function template_find_members()
{
    global $context, $settings, $options, $scripturl, $modSettings, $txt;
    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
	<head>
		<title>', $txt['find_members'], '</title>
		<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
		<meta name="robots" content="noindex" />
		<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index.css" />
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var membersAdded = [];
			function addMember(name)
			{
				var theTextBox = window.opener.document.getElementById("', $context['input_box_name'], '");

				if (name in membersAdded)
					return;

				// If we only accept one name don\'t remember what is there.
				if (', JavaScriptEscape($context['delimiter']), ' != \'null\')
					membersAdded[name] = true;

				if (theTextBox.value.length < 1 || ', JavaScriptEscape($context['delimiter']), ' == \'null\')
					theTextBox.value = ', $context['quote_results'] ? '"\\"" + name + "\\""' : 'name', ';
				else
					theTextBox.value += ', JavaScriptEscape($context['delimiter']), ' + ', $context['quote_results'] ? '"\\"" + name + "\\""' : 'name', ';

				window.focus();
			}
		// ]]></script>
	</head>
	<body id="help_popup">
		<form action="', $scripturl, '?action=findmember;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '" class="padding description">
			<span class="upperframe"><span></span></span>
			<div class="roundframe">
				<div class="innerframe">
					<div class="cat_bar">
						<h3 class="catbg">', $txt['find_members'], '</h3>
					</div>
					<div class="padding">
						<strong>', $txt['find_username'], ':</strong><br />
						<input type="text" name="search" id="search" value="', isset($context['last_search']) ? $context['last_search'] : '', '" style="margin-top: 4px; width: 96%;" class="input_text" /><br />
						<span class="smalltext"><em>', $txt['find_wildcards'], '</em></span><br />';
    // Only offer to search for buddies if we have some!
    if (!empty($context['show_buddies'])) {
        echo '
						<span class="smalltext"><label for="buddies"><input type="checkbox" class="input_check" name="buddies" id="buddies"', !empty($context['buddy_search']) ? ' checked="checked"' : '', ' /> ', $txt['find_buddies'], '</label></span><br />';
    }
    echo '
						<div class="padding righttext">
							<input type="submit" value="', $txt['search'], '" class="button_submit" />
							<input type="button" value="', $txt['find_close'], '" onclick="window.close();" class="button_submit" />
						</div>
					</div>
				</div>
			</div>
			<span class="lowerframe"><span></span></span>
			<br />
			<span class="upperframe"><span></span></span>
			<div class="roundframe">
				<div class="innerframe">
					<div class="cat_bar">
						<h3 class="catbg">', $txt['find_results'], '</h3>
					</div>';
    if (empty($context['results'])) {
        echo '
					<p class="error">', $txt['find_no_results'], '</p>';
    } else {
        echo '
					<ul class="reset padding">';
        $alternate = true;
        foreach ($context['results'] as $result) {
            echo '
						<li class="', $alternate ? 'windowbg2' : 'windowbg', '">
							<a href="', $result['href'], '" target="_blank" class="new_win"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="', $txt['view_profile'], '" title="', $txt['view_profile'], '" /></a>
							<a href="javascript:void(0);" onclick="addMember(this.innerHTML); return false;">', $result['name'], '</a>
						</li>';
            $alternate = !$alternate;
        }
        echo '
					</ul>
					<div class="pagesection">
						', $txt['pages'], ': ', $context['page_index'], '
					</div>';
    }
    echo '
				</div>
			</div>
			<span class="lowerframe"><span></span></span>
			<input type="hidden" name="input" value="', $context['input_box_name'], '" />
			<input type="hidden" name="delim" value="', $context['delimiter'], '" />
			<input type="hidden" name="quote" value="', $context['quote_results'] ? '1' : '0', '" />
		</form>';
    if (empty($context['results'])) {
        echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			document.getElementById("search").focus();
		// ]]></script>';
    }
    echo '
	</body>
</html>';
}
Esempio n. 15
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Show the anchor for the top and for the first message.  If the first message is new, say so.
    echo '
<a id="top"></a>
<a id="msg', $context['first_message'], '"></a>', $context['first_new_message'] ? '<a id="new"></a>' : '';
    // Show the linktree as well as the "Who's Viewing" information.
    echo '
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>';
    if (!empty($settings['display_who_viewing'])) {
        echo '
		<td align="center" class="smalltext">';
        // Show just numbers...?
        if ($settings['display_who_viewing'] == 1) {
            echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt['members'];
        } else {
            echo empty($context['view_members_list']) ? '0 ' . $txt['members'] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
        }
        // Now show how many guests are here too.
        echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['guest'] : $txt['guests'], $txt['who_viewing_topic'], '</td>';
    }
    // Show the previous/next links.
    echo '
		<td valign="bottom" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext">
			<span class="nav">', $context['previous_next'], '</span>
		</td>
	</tr>
</table>';
    // Is this topic also a poll?
    if ($context['is_poll']) {
        echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
	<tr class="titlebg">
		<td colspan="2" valign="middle" style="padding-left: 6px;">
			<img src="', $settings['images_url'], '/topic/', $context['poll']['is_locked'] ? 'normal_poll_locked' : 'normal_poll', '.gif" alt="" align="top" /> ', $txt['poll'], '
		</td>
	</tr>
	<tr class="windowbg">
		<td width="5%" valign="top"><strong>', $txt['poll_question'], ':</strong></td>
		<td>
			', $context['poll']['question'];
        if (!empty($context['poll']['expire_time'])) {
            echo '
			&nbsp;(', $context['poll']['is_expired'] ? $txt['poll_expired_on'] : $txt['poll_expires_on'], ': ', $context['poll']['expire_time'], ')';
        }
        // Are they not allowed to vote but allowed to view the options?
        if ($context['poll']['show_results'] || !$context['allow_vote']) {
            echo '
			<table>
				<tr>
					<td style="padding-top: 2ex;">
						<table border="0" cellpadding="0" cellspacing="0">';
            // Show each option with its corresponding percentage bar.
            foreach ($context['poll']['options'] as $option) {
                echo '
							<tr>
								<td style="padding-right: 2ex;', $option['voted_this'] ? 'font-weight: bold;' : '', '">', $option['option'], '</td>', $context['allow_poll_view'] ? '
								<td nowrap="nowrap">' . $option['bar'] . ' ' . $option['votes'] . ' (' . $option['percent'] . '%)</td>' : '', '
							</tr>';
            }
            echo '
						</table>
					</td>
					<td valign="bottom" style="padding-left: 15px;">';
            // If they are allowed to revote - show them a link!
            if ($context['allow_change_vote']) {
                echo '
						<a href="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['poll_change_vote'], '</a><br />';
            }
            // If we're viewing the results... maybe we want to go back and vote?
            if ($context['allow_return_vote']) {
                echo '
						<a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_return_vote'], '</a><br />';
            }
            // If they're allowed to lock the poll, show a link!
            if ($context['poll']['lock']) {
                echo '
						<a href="', $scripturl, '?action=lockvoting;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', !$context['poll']['is_locked'] ? $txt['poll_lock'] : $txt['poll_unlock'], '</a><br />';
            }
            // If they're allowed to edit the poll... guess what... show a link!
            if ($context['poll']['edit']) {
                echo '
						<a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_edit'], '</a><br />';
            }
            if ($context['can_remove_poll']) {
                echo '
						<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">', $txt['poll_remove'], '</a>';
            }
            echo '
					</td>
				</tr>', $context['allow_poll_view'] ? '
				<tr>
					<td colspan="2"><strong>' . $txt['poll_total_voters'] . ': ' . $context['poll']['total_votes'] . '</strong></td>
				</tr>' : '', '
			</table><br />';
        } else {
            echo '
			<form action="', $scripturl, '?action=vote;topic=', $context['current_topic'], '.', $context['start'], ';poll=', $context['poll']['id'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0px;">
				<table>
					<tr>
						<td colspan="2">';
            // Show a warning if they are allowed more than one option.
            if ($context['poll']['allowed_warning']) {
                echo '
							', $context['poll']['allowed_warning'], '
						</td>
					</tr><tr>
						<td>';
            }
            // Show each option with its button - a radio likely.
            foreach ($context['poll']['options'] as $option) {
                echo '
							<label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label><br />';
            }
            echo '
						</td>
						<td valign="bottom" style="padding-left: 15px;">';
            // Allowed to view the results? (without voting!)
            if ($context['show_view_results_button']) {
                echo '
							<a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';viewresults">', $txt['poll_results'], '</a><br />';
            }
            // Show a link for locking the poll as well...
            if ($context['poll']['lock']) {
                echo '
							<a href="', $scripturl, '?action=lockvoting;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '">', !$context['poll']['is_locked'] ? $txt['poll_lock'] : $txt['poll_unlock'], '</a><br />';
            }
            // Want to edit it?  Click right here......
            if ($context['poll']['edit']) {
                echo '
							<a href="', $scripturl, '?action=editpoll;topic=', $context['current_topic'], '.', $context['start'], '">', $txt['poll_edit'], '</a><br />';
            }
            if ($context['can_remove_poll']) {
                echo '
						<a href="' . $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . '" onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');">', $txt['poll_remove'], '</a>';
            }
            echo '
						</td>
					</tr><tr>
						<td colspan="2"><input type="submit" value="', $txt['poll_vote'], '" class="button_submit" /></td>
					</tr>
				</table>
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
			</form>';
        }
        echo '
		</td>
	</tr>
</table>';
    }
    // Does this topic have some events linked to it?
    if (!empty($context['linked_calendar_events'])) {
        echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder" style="margin-bottom: 2ex;">
	<tr class="titlebg">
		<td colspan="2" valign="middle" align="left" style="padding-left: 6px;">
			', $txt['calendar_linked_events'], '
		</td>
	</tr>
	<tr class="windowbg">
		<td width="5%" valign="top">
			<ul>';
        foreach ($context['linked_calendar_events'] as $event) {
            echo '
				<li>
					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: red;">*</a> ' : '', '<strong>', $event['title'], '</strong>: ', $event['start_date'], $event['start_date'] != $event['end_date'] ? ' - ' . $event['end_date'] : '', '
				</li>';
        }
        echo '
			</ul>
		</td>
	</tr>
</table>';
    }
    // Show the page index... "Pages: [1]".
    echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="margin-bottom: 1ex;">
	<tr>
		<td class="catbg" width="100%" height="35">
			<table cellpadding="3" cellspacing="0" width="100%">
				<tr>
					<td>
						<strong>', $txt['pages'], ':</strong> ', $context['page_index'];
    // Show a "go down" link?
    if (!empty($modSettings['topbottomEnable'])) {
        echo $context['menu_separator'], '<a href="#bot">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/go_down.gif" alt="' . $txt['go_down'] . '" border="0" align="top" />' : $txt['go_down'], '</a>';
    }
    echo '
					</td>
					<td align="', !$context['right_to_left'] ? 'right' : 'left', '" style="font-size: smaller;">';
    $buttonArray = array();
    if ($context['can_reply']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';num_replies=' . $context['num_replies'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/reply.gif" alt="' . $txt['reply'] . '" border="0" />' : $txt['reply']) . '</a>';
    }
    if ($context['can_mark_notify']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . ($context['is_marked_notify'] ? 'un' : '') . 'notify.gif" alt="' . $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify'] . '" border="0" />' : $txt[$context['is_marked_notify'] ? 'unnotify' : 'notify']) . '</a>';
    }
    // This is a special case; if they can see mark unread, put it at the top... otherwise show add poll.
    if ($context['user']['is_logged'] && $settings['show_mark_read']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/markunread.gif" alt="' . $txt['mark_unread'] . '" border="0" />' : $txt['mark_unread']) . '</a>';
    } elseif ($context['can_add_poll']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start'] . '">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/addpoll.gif" alt="' . $txt['add_poll'] . '" border="0" />' : $txt['add_poll']) . '</a>';
    }
    if ($context['can_send_topic']) {
        $buttonArray[] = '<a href="' . $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/sendtopic.gif" alt="' . $txt['send_topic'] . '" border="0" />' : $txt['send_topic']) . '</a>';
    }
    $buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" rel="new_win nofollow">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/print.gif" alt="' . $txt['print'] . '" border="0" />' : $txt['print']) . '</a>';
    echo implode($context['menu_separator'], $buttonArray);
    echo '</td>
				</tr>
			</table>
		</td>
	</tr>
</table>';
    // Show the topic information - icon, subject, etc.
    echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
	<tr class="titlebg">
		<td valign="middle" width="15%" style="padding-left: 6px;">
			<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" alt="" align="middle" /> ', $txt['author'], '
		</td>
		<td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject">
			', $txt['topic'], ': ', $context['subject'], ' &nbsp;(', $txt['read'], ' ', $context['num_views'], ' ', $txt['times'], ')
		</td>
	</tr>
</table>

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

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

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

<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr>';
    if ($settings['linktree_inline']) {
        echo '
		<td valign="top">', theme_linktree(), '</td> ';
    }
    echo '
		<td valign="top" align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext"> <span class="nav"> ', $context['previous_next'], '</span></td>
	</tr>
</table>
<div style="padding-top: 4px; padding-bottom: 4px;" id="moderationbuttons">', theme_show_mod_buttons(), '</div>';
    echo '
</form>';
    echo '
<div class="righttext" style="margin-bottom: 1ex;" id="display_jump_to">&nbsp;</div><br />';
    if ($context['can_reply'] && !empty($options['display_quick_reply'])) {
        echo '
<a id="quickreply"></a>
<table border="0" cellspacing="1" cellpadding="3" class="clear bordercolor" width="100%">
	<tr>
		<td colspan="2" class="catbg"><a href="javascript:oQuickReply.swap();"><img src="', $settings['images_url'], '/', $options['display_quick_reply'] == 2 ? 'collapse' : 'expand', '.gif" alt="+" border="0" id="quickReplyExpand" /></a> <a href="javascript:oQuickReply.swap();">', $txt['quick_reply'], '</a></td>
	</tr>
	<tr id="quickReplyOptions"', $options['display_quick_reply'] == 2 ? '' : ' style="display: none"', '>
		<td class="windowbg" width="25%" valign="top">', $txt['quick_reply_desc'], $context['is_locked'] ? '<br /><br /><strong>' . $txt['quick_reply_warning'] . '</strong>' : '', '</td>
		<td class="windowbg" width="75%" align="center">
			', $context['can_reply_approved'] ? '' : '<em>' . $txt['wait_for_approval'] . '</em>', '
			', !$context['can_reply_approved'] && $context['require_verification'] ? '<br />' : '', '
			<form action="', $scripturl, '?action=post2', empty($context['current_board']) ? '' : ';board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);" style="margin: 0;">
				<input type="hidden" name="topic" value="', $context['current_topic'], '" />
				<input type="hidden" name="subject" value="', $context['response_prefix'], $context['subject'], '" />
				<input type="hidden" name="icon" value="xx" />
				<input type="hidden" name="from_qr" value="1" />
				<input type="hidden" name="notify" value="', $context['is_marked_notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
				<input type="hidden" name="not_approved" value="', !$context['can_reply_approved'], '" />
				<input type="hidden" name="goback" value="', empty($options['return_to_post']) ? '0' : '1', '" />
				<input type="hidden" name="num_replies" value="', $context['num_replies'], '" />';
        // Guests just need more.
        if ($context['user']['is_guest']) {
            echo '
				<strong>', $txt['name'], ':</strong> <input type="text" name="guestname" value="', $context['name'], '" size="25" class="input_text" />
				<strong>', $txt['email'], ':</strong> <input type="text" name="email" value="', $context['email'], '" size="25" class="input_text" /><br />';
        }
        // Is visual verification enabled?
        if ($context['require_verification']) {
            echo '
				<strong>', $txt['verification'], ':</strong>', template_control_verification($context['visual_verification_id'], 'quick_reply'), '<br />';
        }
        echo '
				<textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="', $context['tabindex']++, '"></textarea><br />
				<input type="submit" name="post" value="', $txt['post'], '" onclick="return submitThisOnce(this);" accesskey="s" tabindex="2" class="button_submit" tabindex="', $context['tabindex']++, '" />
				<input type="submit" name="preview" value="', $txt['preview'], '" onclick="return submitThisOnce(this);" accesskey="p" tabindex="4" class="button_submit" tabindex="', $context['tabindex']++, '" />';
        if ($context['show_spellchecking']) {
            echo '
				<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'postmodify\', \'message\');" class="button_submit" />';
        }
        echo '
				<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
				<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
			</form>
		</td>
	</tr>
</table>';
    }
    if ($context['show_spellchecking']) {
        echo '
<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
    }
    echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/topic.js"></script>
<script type="text/javascript"><!-- // --><![CDATA[';
    if (!empty($options['display_quick_reply'])) {
        echo '
	var oQuickReply = new QuickReply({
		bDefaultCollapsed: ', !empty($options['display_quick_reply']) && $options['display_quick_reply'] == 2 ? 'false' : 'true', ',
		iTopicId: ', $context['current_topic'], ',
		iStart: ', $context['start'], ',
		sScriptUrl: smf_scripturl,
		sImagesUrl: "', $settings['images_url'], '",
		sContainerId: "quickReplyOptions",
		sImageId: "quickReplyExpand",
		sImageCollapsed: "collapse.gif",
		sImageExpanded: "expand.gif",
		sJumpAnchor: "quickreply"
	});';
    }
    if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $context['can_remove_post']) {
        echo '
	var oInTopicModeration = new InTopicModeration({
		sSelf: \'oInTopicModeration\',
		sCheckboxContainerMask: \'in_topic_mod_check_\',
		aMessageIds: [\'', implode('\', \'', $removableMessageIDs), '\'],
		sSessionId: \'', $context['session_id'], '\',
		sSessionVar: \'', $context['session_var'], '\',
		sButtonStrip: \'moderationbuttons\',
		bUseImageButton: true,
		bCanRemove: ', $context['can_remove_post'] ? 'true' : 'false', ',
		sRemoveButtonLabel: \'', $txt['quickmod_delete_selected'], '\',
		sRemoveButtonImage: \'', $settings['lang_images_url'], '/delete_selected.gif\',
		sRemoveButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		bCanRestore: ', $context['can_restore_msg'] ? 'true' : 'false', ',
		sRestoreButtonLabel: \'', $txt['quick_mod_restore'], '\',
		sRestoreButtonImage: \'', $settings['lang_images_url'], '/restore_selected.gif\',
		sRestoreButtonConfirm: \'', $txt['quickmod_confirm'], '\',
		sFormId: \'quickModForm\'
	});';
    }
    echo '
	if (\'XMLHttpRequest\' in window)
	{
		var oQuickModify = new QuickModify({
			sScriptUrl: smf_scripturl,
			bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
			iTopicId: ', $context['current_topic'], ',
			sTemplateBodyEdit: ', JavaScriptEscape('
				<div id="quick_edit_body_container" style="width: 90%">
					<div id="error_box" style="padding: 4px;" class="error"></div>
					<textarea class="editor" name="message" rows="12" style="' . ($context['browser']['is_ie8'] ? 'max-width: 100%; min-width: 100%' : 'width: 100%') . '; margin-bottom: 10px;" tabindex="' . $context['tabindex']++ . '">%body%</textarea><br />
					<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
					<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />
					<input type="hidden" name="msg" value="%msg_id%" />
					<div class="righttext">
						<input type="submit" name="post" value="' . $txt['save'] . '" tabindex="8" onclick="return oQuickModify.modifySave(\'' . $context['session_id'] . '\', \'' . $context['session_var'] . '\');" accesskey="s" class="button_submit" />&nbsp;&nbsp;' . ($context['show_spellchecking'] ? '<input type="button" value="' . $txt['spell_check'] . '" tabindex="9" onclick="spellCheck(\'quickModForm\', \'message\');" class="button_submit" />&nbsp;&nbsp;' : '') . '<input type="submit" name="cancel" value="' . $txt['modify_cancel'] . '" tabindex="9" onclick="return oQuickModify.modifyCancel();" class="button_submit" />
					</div>
				</div>'), ',
			sTemplateSubjectEdit: ', JavaScriptEscape('<input type="text" style="width: 90%" name="subject" value="%subject%" size="80" maxlength="80" tabindex="6" class="input_text" />'), ',
			sTemplateBodyNormal: ', JavaScriptEscape('%body%'), ',
			sTemplateSubjectNormal: ', JavaScriptEscape('<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.msg%msg_id%#msg%msg_id%" rel="nofollow">%subject%</a>'), ',
			sTemplateTopSubject: ', JavaScriptEscape($txt['topic'] . ': %subject% &nbsp;(' . $txt['read'] . ' ' . $context['num_views'] . ' ' . $txt['times'] . ')'), ',
			sErrorBorderStyle: ', JavaScriptEscape('1px solid red'), '
		});
		aJumpTo[aJumpTo.length] = new JumpTo({
			sContainerId: "display_jump_to",
			sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%",
			iCurBoardId: ', $context['current_board'], ',
			iCurBoardChildLevel: ', $context['jump_to']['child_level'], ',
			sCurBoardName: "', $context['jump_to']['board_name'], '",
			sBoardChildLevelIndicator: "==",
			sBoardPrefix: "=> ",
			sCatSeparator: "-----------------------------",
			sCatPrefix: "",
			sGoButtonLabel: "', $txt['go'], '"
		});

		aIconLists[aIconLists.length] = new IconList({
			sBackReference: "aIconLists[" + aIconLists.length + "]",
			sIconIdPrefix: "msg_icon_",
			sScriptUrl: smf_scripturl,
			bShowModify: ', $settings['show_modify'] ? 'true' : 'false', ',
			iBoardId: ', $context['current_board'], ',
			iTopicId: ', $context['current_topic'], ',
			sSessionId: "', $context['session_id'], '",
			sSessionVar: "', $context['session_var'], '",
			sLabelIconList: "', $txt['message_icon'], '",
			sBoxBackground: "transparent",
			sBoxBackgroundHover: "#ffffff",
			iBoxBorderWidthHover: 1,
			sBoxBorderColorHover: "#adadad" ,
			sContainerBackground: "#ffffff",
			sContainerBorder: "1px solid #adadad",
			sItemBorder: "1px solid #ffffff",
			sItemBorderHover: "1px dotted gray",
			sItemBackground: "transparent",
			sItemBackgroundHover: "#e0e0f0"
		});
	}
// ]]></script>';
}
Esempio n. 16
0
function template_body_above()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;
    echo '
<div id="mainframe"', !empty($settings['forum_width']) ? ' style="width: ' . $settings['forum_width'] . '"' : '', '>
	<div class="tborder">
		<div class="catbg">
			<img class="floatright" id="smflogo" src="', $settings['images_url'], '/smflogo.gif" alt="Simple Machines Forum" />
			<h1 id="forum_name">';
    if (empty($context['header_logo_url_html_safe'])) {
        echo $context['forum_name_html_safe'];
    } else {
        echo '
				<img src="', $context['header_logo_url_html_safe'], '" alt="', $context['forum_name_html_safe'], '" />';
    }
    echo '
			</h1>
		</div>';
    // Display user name and time.
    echo '
		<ul id="greeting_section" class="reset titlebg2">
			<li id="time" class="smalltext floatright">
				', $context['current_time'], '
				<img id="upshrink" src="', $settings['images_url'], '/upshrink.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="display: none;" />
			</li>';
    if ($context['user']['is_logged']) {
        echo '
			<li id="name">', $txt['hello_member_ndt'], ' <em>', $context['user']['name'], '</em></li>';
    } else {
        echo '
			<li id="name">', $txt['hello_guest'], ' <em>', $txt['guest'], '</em></li>';
    }
    echo '
		</ul>';
    if ($context['user']['is_logged'] || !empty($context['show_login_bar'])) {
        echo '
		<div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
			<div class="windowbg2 clearfix">';
    }
    if (!empty($context['user']['avatar'])) {
        echo '
				<div id="myavatar">', $context['user']['avatar']['image'], '</div>';
    }
    // If the user is logged in, display stuff like their name, new messages, etc.
    if ($context['user']['is_logged']) {
        echo '
				<ul class="reset">
					<li><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a></li>
					<li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';
        // Is the forum in maintenance mode?
        if ($context['in_maintenance'] && $context['user']['is_admin']) {
            echo '
					<li class="notice">', $txt['maintain_mode_on'], '</li>';
        }
        // Are there any members waiting for approval?
        if (!empty($context['unapproved_members'])) {
            echo '
					<li>', $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'], '</li>';
        }
        // Show the total time logged in?
        if (!empty($context['user']['total_time_logged_in'])) {
            echo '
					<li>', $txt['totalTimeLogged1'];
            // If days is just zero, don't bother to show it.
            if ($context['user']['total_time_logged_in']['days'] > 0) {
                echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];
            }
            // Same with hours - only show it if it's above zero.
            if ($context['user']['total_time_logged_in']['hours'] > 0) {
                echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];
            }
            // But, let's always show minutes - Time wasted here: 0 minutes ;).
            echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
					</li>';
        }
        if (!empty($context['open_mod_reports']) && $context['show_open_reports']) {
            echo '
					<li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
        }
        echo '
				</ul>';
    } elseif (!empty($context['show_login_bar'])) {
        echo '
				<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
				<form class="windowbg" id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
					', $txt['login_or_register'], '<br />
					<input type="text" name="user" size="10" class="input_text" />
					<input type="password" name="passwrd" size="10" class="input_password" />
					<select name="cookielength">
						<option value="60">', $txt['one_hour'], '</option>
						<option value="1440">', $txt['one_day'], '</option>
						<option value="10080">', $txt['one_week'], '</option>
						<option value="43200">', $txt['one_month'], '</option>
						<option value="-1" selected="selected">', $txt['forever'], '</option>
					</select>
					<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
					', $txt['quick_login_dec'];
        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>';
    }
    if ($context['user']['is_logged'] || !empty($context['show_login_bar'])) {
        echo '
			</div>
		</div>';
    }
    echo '
		<div id="news_section" class="titlebg2 clearfix"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
			<form class="floatright" id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
				<a href="', $scripturl, '?action=search;advanced" title="', $txt['search_advanced'], '"><img id="advsearch" src="' . $settings['images_url'] . '/filter.gif" align="middle" alt="', $txt['search_advanced'], '" /></a>
				<input type="text" name="search" value="" style="width: 190px;" class="input_text" />&nbsp;
				<input type="submit" name="submit" value="', $txt['search'], '" style="width: 11ex;" class="button_submit" />
				<input type="hidden" name="advanced" value="0" />';
    // Search within current topic?
    if (!empty($context['current_topic'])) {
        echo '
				<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
    } elseif (!empty($context['current_board'])) {
        echo '
				<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
    }
    echo '
			</form>';
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news'])) {
        echo '
			<div id="random_news"><h3>', $txt['news'], ':</h3><p>', $context['random_news_line'], '</p></div>';
    }
    echo '
		</div>
	</div>';
    // Define the upper_section toggle in JavaScript.
    echo '
	<script type="text/javascript"><!-- // --><![CDATA[
		var oMainHeaderToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'user_section\',
				\'news_section\'
			],
			aSwapImages: [
				{
					sId: \'upshrink\',
					srcExpanded: smf_images_url + \'/upshrink.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/upshrink2.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_header\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'upshrink\'
			}
		});
	// ]]></script>';
    // Show the menu here, according to the menu sub template.
    template_menu();
    // Show the navigation tree.
    theme_linktree();
    // The main content should go here.
    echo '
	<div id="bodyarea">';
}
Esempio n. 17
0
    /**
     * All the post by email settings, used to control how the feature works
     *
     * @uses Admin language
     */
    public function action_settings()
    {
        global $scripturl, $context, $txt, $modSettings;
        // Be nice, show them we did something
        if (isset($_GET['saved'])) {
            $context['settings_message'] = $txt['saved'];
        }
        // Templates and language
        loadLanguage('Admin');
        loadTemplate('Admin', 'admin');
        // Load any existing email => board values used for new topic creation
        $context['maillist_from_to_board'] = array();
        $data = !empty($modSettings['maillist_receiving_address']) ? unserialize($modSettings['maillist_receiving_address']) : array();
        foreach ($data as $key => $addr) {
            $context['maillist_from_to_board'][$key] = array('id' => $key, 'emailfrom' => $addr[0], 'boardto' => $addr[1]);
        }
        // Initialize the maillist settings form
        $this->_initMaillistSettingsForm();
        // Retrieve the config settings
        $config_vars = $this->_maillistSettings->settings();
        // Saving settings?
        if (isset($_GET['save'])) {
            checkSession();
            call_integration_hook('integrate_save_maillist_settings');
            $email_error = false;
            $board_error = false;
            $maillist_receiving_address = array();
            // Basic checking of the email addresses
            require_once SUBSDIR . '/DataValidator.class.php';
            if (!Data_Validator::is_valid($_POST, array('maillist_sitename_address' => 'valid_email'), array('maillist_sitename_address' => 'trim'))) {
                $email_error = $_POST['maillist_sitename_address'];
            }
            if (!Data_Validator::is_valid($_POST, array('maillist_sitename_help' => 'valid_email'), array('maillist_sitename_help' => 'trim'))) {
                $email_error = $_POST['maillist_sitename_help'];
            }
            if (!Data_Validator::is_valid($_POST, array('maillist_mail_from' => 'valid_email'), array('maillist_mail_from' => 'trim'))) {
                $email_error = $_POST['maillist_mail_from'];
            }
            // Inbound email set up then we need to check for both valid email and valid board
            if (!$email_error && !empty($_POST['emailfrom'])) {
                // Get the board ids for a quick check
                $boards = maillist_board_list();
                // Check the receiving emails and the board id as well
                $boardtocheck = !empty($_POST['boardto']) ? $_POST['boardto'] : array();
                $addresstocheck = !empty($_POST['emailfrom']) ? $_POST['emailfrom'] : array();
                foreach ($addresstocheck as $key => $checkme) {
                    // Valid email syntax
                    if (!Data_Validator::is_valid($addresstocheck, array($key => 'valid_email'), array($key => 'trim'))) {
                        $email_error = $checkme;
                        $context['error_type'] = 'notice';
                        continue;
                    }
                    // Valid board id?
                    if (!isset($boardtocheck[$key]) || !isset($boards[$key])) {
                        $board_error = $checkme;
                        $context['error_type'] = 'notice';
                        continue;
                    }
                    // Decipher as [0]emailaddress and [1]board id
                    $maillist_receiving_address[] = array($checkme, $boardtocheck[$key]);
                }
            }
            // Enable or disable the fake cron
            enable_maillist_imap_cron(!empty($_POST['maillist_imap_cron']));
            // Check and set any errors or give the go ahead to save
            if ($email_error) {
                $context['settings_message'] = sprintf($txt['email_not_valid'], $email_error);
            } elseif ($board_error) {
                $context['settings_message'] = sprintf($txt['board_not_valid'], $board_error);
            } else {
                // Clear the moderation count cache
                cache_put_data('num_menu_errors', null, 900);
                // Should be off if mail posting is on, we ignore it anyway but this at least updates the ACP
                if (!empty($_POST['maillist_enabled'])) {
                    updateSettings(array('disallow_sendBody' => ''));
                }
                updateSettings(array('maillist_receiving_address' => serialize($maillist_receiving_address)));
                Settings_Form::save_db($config_vars);
                writeLog();
                redirectexit('action=admin;area=maillist;sa=emailsettings;saved');
            }
        }
        // Javascript vars for the "add more" buttons in the receive_email callback
        $board_list = maillist_board_list();
        $script = '';
        $i = 0;
        // Create the board selection list
        foreach ($board_list as $board_id => $board_name) {
            $script .= $i++ . ': {id:' . $board_id . ', name:' . JavaScriptEscape($board_name) . '},';
        }
        addInlineJavascript('
		var sEmailParent = \'add_more_email_placeholder\',
			oEmailOptionsdt = {size: \'50\', name: \'emailfrom[]\', class: \'input_text\'},
			oEmailOptionsdd = {size: \'1\', type: \'select\', name: \'boardto[]\', class: \'input_select\'},
			oEmailSelectData = {' . $script . '};

			document.getElementById(\'add_more_board_div\').style.display = \'\';', true);
        $context['boards'] = $board_list;
        $context['settings_title'] = $txt['ml_emailsettings'];
        $context['page_title'] = $txt['ml_emailsettings'];
        $context['post_url'] = $scripturl . '?action=admin;area=maillist;sa=emailsettings;save';
        $context['sub_template'] = 'show_settings';
        Settings_Form::prepare_db($config_vars);
    }
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
function template_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="', $context['character_set'], '" name="permissionForm" id="permissionForm">';
    if (!empty($context['profile'])) {
        echo '
			<div class="title_bar">
				<h3 class="titlebg">', $txt['permissions_for_profile'], ': &quot;', $context['profile']['name'], '&quot;</h3>
			</div>';
    }
    echo '
			<table width="100%" class="table_grid">
				<thead>
					<tr class="catbg">
						<th class="first_th">', $txt['membergroups_name'], '</th>
						<th width="10%" align="center" valign="middle">', $txt['membergroups_members_top'], '</th>';
    if (empty($modSettings['permission_enable_deny'])) {
        echo '
						<th width="16%" align="center">', $txt['membergroups_permissions'], '</th>';
    } else {
        echo '
						<th width="8%" align="center">', $txt['permissions_allowed'], '</th>
						<th width="8%" align="center">', $txt['permissions_denied'], '</th>';
    }
    echo '
						<th width="10%" align="center" valign="middle">', $context['can_modify'] ? $txt['permissions_modify'] : $txt['permissions_view'], '</th>
						<th class="last_th" width="4%" align="center" valign="middle">
							', $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>
							', $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']) {
        echo '
			<div class="cat_bar">
				<h3 class="catbg">
					<span class="ie6_header floatleft">
						<img src="', $settings['images_url'], '/', empty($context['show_advanced_options']) ? 'selected' : 'sort_down', '.gif" id="permissions_panel_toggle" alt="*" /> ', $txt['permissions_advanced_options'], '
					</span>
				</h3>
			</div>
			<div id="permissions_panel_advanced" class="windowbg">
				<span class="topslice"><span></span></span>
				<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>
				<span class="botslice"><span></span></span>
			</div>';
        // Javascript for the advanced stuff.
        echo '
	<script type="text/javascript"><!-- // --><![CDATA[
		var oPermissionsPanelToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($context['show_advanced_options']) ? 'true' : 'false', ',
			aSwappableContainers: [
				\'permissions_panel_advanced\'
			],
			aSwapImages: [
				{
					sId: \'permissions_panel_toggle\',
					srcExpanded: smf_images_url + \'/sort_down.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/selected.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'admin_preferences\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), ',
				sThemeId: \'1\',
				sAdditionalVars: \';admin_key=app\'
			}
		});';
        echo '

		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" />';
}
Esempio n. 19
0
function template_control_richedit_buttons($editor_id)
{
    global $context, $settings, $options, $txt, $modSettings, $scripturl;
    $editor_context =& $context['controls']['richedit'][$editor_id];
    echo '
		<input type="submit" value="', isset($editor_context['labels']['post_button']) ? $editor_context['labels']['post_button'] : $txt['post'], '" tabindex="', $context['tabindex']++, '" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" />';
    if ($editor_context['preview_type']) {
        echo '
		<input type="submit" name="preview" value="', isset($editor_context['labels']['preview_button']) ? $editor_context['labels']['preview_button'] : $txt['preview'], '" tabindex="', $context['tabindex']++, '" onclick="', $editor_context['preview_type'] == 2 ? 'return event.ctrlKey || previewPost();' : 'return submitThisOnce(this);', '" accesskey="p" class="button_submit" />';
    }
    if ($context['show_spellchecking']) {
        echo '
		<input type="button" value="', $txt['spell_check'], '" tabindex="', $context['tabindex']++, '" onclick="oEditorHandle_', $editor_id, '.spellCheckStart();" class="button_submit" />';
    }
    if (!empty($context['drafts_save'])) {
        // Show the save draft button
        echo '
		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', $context['tabindex']++, '" onclick="return confirm(' . JavaScriptEscape($txt['draft_save_note']) . ') && submitThisOnce(this);" accesskey="d" class="button_submit" />
		<input type="hidden" id="id_draft" name="id_draft" value="', empty($context['id_draft']) ? 0 : $context['id_draft'], '" />';
        // Start an instance of the auto saver if its enabled
        if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            echo '
		<br />
		<span class="righttext padding" style="display: block">
			<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span>
			<span id="draft_lastautosave" ></span>
		</span>
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/drafts.js?alp21"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oDraftAutoSave = new smf_DraftAutoSave({
				sSelf: \'oDraftAutoSave\',
				sLastNote: \'draft_lastautosave\',
				sLastID: \'id_draft\',
				sSceditorID: \'', $editor_id, '\',
				sType: \'post\',
				iBoard: ', empty($context['current_board']) ? 0 : $context['current_board'], ',
				iFreq: ', empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000, '
			});
		// ]]></script>';
        }
    }
    if (!empty($context['drafts_pm_save'])) {
        // The PM draft save button
        echo '
		<input type="submit" name="save_draft" value="', $txt['draft_save'], '" tabindex="', $context['tabindex']++, '" onclick="submitThisOnce(this);" accesskey="d" class="button_submit" />
		<input type="hidden" id="id_pm_draft" name="id_pm_draft" value="', empty($context['id_pm_draft']) ? 0 : $context['id_pm_draft'], '" />';
        // Load in the PM autosaver if its enabled and the user wants to use it
        if (!empty($context['drafts_autosave']) && !empty($options['drafts_autosave_enabled'])) {
            echo '
		<span class="righttext padding" style="display: block">
			<span id="throbber" style="display:none"><img src="' . $settings['images_url'] . '/loading_sm.gif" alt="" class="centericon" />&nbsp;</span>
			<span id="draft_lastautosave" ></span>
		</span>
		<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/drafts.js?alp21"></script>
		<script type="text/javascript"><!-- // --><![CDATA[
			var oDraftAutoSave = new smf_DraftAutoSave({
				sSelf: \'oDraftAutoSave\',
				sLastNote: \'draft_lastautosave\',
				sLastID: \'id_pm_draft\',
				sSceditorID: \'', $editor_id, '\',
				sType: \'post\',
				bPM: true,
				iBoard: 0,
				iFreq: ', empty($modSettings['drafts_autosave_frequency']) ? 60000 : $modSettings['drafts_autosave_frequency'] * 1000, '
			});
		// ]]></script>';
        }
    }
}
Esempio n. 20
0
/**
 * The area below the postbox
 * Typically holds our action buttons, save, preivew, drafts, etc
 * Oh and lots of JS ;)
 */
function template_postarea_below()
{
    global $context, $txt, $counter, $settings;
    // Is visual verification enabled?
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
						<div class="post_verification">
							<span' . (!empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '') . '>
								<strong>' . $txt['verification'] . ':</strong>
							</span>
							', '
						</div>');
    }
    echo '
					</div>
				</div>
			</div>';
    // 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'], '" />';
    }
    // If we are starting a new topic starting from another one, here is the place to remember some details
    if (!empty($context['original_post'])) {
        echo '
			<input type="hidden" name="followup" value="' . $context['original_post'] . '" />';
    }
    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>';
    // The variables used to preview a post without loading a new page.
    echo '
		<script><!-- // --><![CDATA[
			var form_name = "postmodify",
				preview_area = "post",
				current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ',
				txt_preview_title = "', $txt['preview_title'], '",
				txt_preview_fetch = "', $txt['preview_fetch'], '",
				make_poll = ', $context['make_poll'] ? 'true' : 'false', ',
				new_replies = new Array(),
				reply_counter = ', empty($counter) ? 0 : $counter, ',
				can_quote = ', $context['can_quote'] ? 'true' : 'false', ',
				show_ignore_user_post = "', $txt['show_ignore_user_post'], '",
				txt_bbc_quote = "', $txt['bbc_quote'], '",
				txt_ignoring_user = "******",
				txt_new = "', $txt['new'], '",
				txt_posted_by = "', $txt['posted_by'], '",
				txt_on = "', $txt['on'], '";';
    // Code for showing and hiding additional options.
    if (!empty($settings['additional_options_collapsible'])) {
        echo '
			var oSwapAdditionalOptions = new elk_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: ', empty($context['minmax_preferences']['post']) ? 'false' : 'true', ',
				funcOnBeforeCollapse: function () {
					document.getElementById(\'additional_options\').value = \'0\';
				},
				funcOnBeforeExpand: function () {
					document.getElementById(\'additional_options\').value = \'1\';
				},
				aSwappableContainers: [
					\'postAdditionalOptions\',
				],
				aSwapClasses: [
					{
						sId: \'postMoreExpand\',
						classExpanded: \'collapse\',
						titleExpanded: ', JavaScriptEscape($txt['hide']), ',
						classCollapsed: \'expand\',
						titleCollapsed: ', JavaScriptEscape($txt['show']), '
					}
				],
				aSwapLinks: [
					{
						sId: \'postMoreExpandLink\',
						msgExpanded: ', JavaScriptEscape($context['attachments']['can']['post'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ',
						msgCollapsed: ', JavaScriptEscape($context['attachments']['can']['post'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), '
					}
				],
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'minmax_preferences\',
					sSessionId: elk_session_id,
					sSessionVar: elk_session_var,
					sAdditionalVars: \';minmax_key=post\'
				},
			});';
    }
    echo '
		// ]]></script>';
    template_topic_replies_below();
}
Esempio n. 21
0
/**
 * Below is the template for adding/editing an board on the forum.
 */
function template_modify_board()
{
    global $context, $scripturl, $txt, $modSettings;
    // The main table header.
    echo '
	<div id="manage_boards">
		<form action="', $scripturl, '?action=admin;area=manageboards;sa=board2" method="post" accept-charset="UTF-8">
			<input type="hidden" name="boardid" value="', $context['board']['id'], '" />
			<h2 class="category_header">
				', isset($context['board']['is_new']) ? $txt['mboards_new_board_name'] : $txt['boardsEdit'], '
			</h2>
			<div class="windowbg">
				<div class="content">
					<dl class="settings">';
    // Option for choosing the category the board lives in.
    echo '

						<dt>
							<strong><label for="new_cat">', $txt['mboards_category'], '</label>:</strong>
						</dt>
						<dd>
							<select id="new_cat" name="new_cat" onchange="if (this.form.order) {this.form.order.disabled = this.options[this.selectedIndex].value != 0; this.form.board_order.disabled = this.options[this.selectedIndex].value != 0 || this.form.order.options[this.form.order.selectedIndex].value == \'\';}">';
    foreach ($context['categories'] as $category) {
        echo '
								<option', $category['selected'] ? ' selected="selected"' : '', ' value="', $category['id'], '">', $category['name'], '</option>';
    }
    echo '
							</select>
						</dd>';
    // If this isn't the only board in this category let the user choose where the board is to live.
    if (isset($context['board']['is_new']) && count($context['board_order']) > 0 || count($context['board_order']) > 1) {
        echo '
						<dt>
							<strong><label for="order">', $txt['order'], '</label>:</strong>
						</dt>
						<dd>';
        // The first select box gives the user the option to position it before, after or as a child of another board.
        echo '
							<select id="order" name="placement" onchange="this.form.board_order.disabled = this.options[this.selectedIndex].value == \'\';">
								', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '', '
								<option value="after">' . $txt['mboards_order_after'] . '...</option>
								<option value="child">' . $txt['mboards_order_child_of'] . '...</option>
								<option value="before">' . $txt['mboards_order_before'] . '...</option>
							</select>';
        // The second select box lists all the boards in the category.
        echo '
							<select id="board_order" name="board_order" ', isset($context['board']['is_new']) ? '' : 'disabled="disabled"', '>
									', !isset($context['board']['is_new']) ? '<option value="">(' . $txt['mboards_unchanged'] . ')</option>' : '';
        foreach ($context['board_order'] as $order) {
            echo '
								<option', $order['selected'] ? ' selected="selected"' : '', ' value="', $order['id'], '">', $order['name'], '</option>';
        }
        echo '
							</select>
						</dd>';
    }
    // Options for board name and description.
    echo '
						<dt>
							<strong><label for="board_name">', $txt['full_name'], '</label>:</strong><br />
							<span class="smalltext">', $txt['name_on_display'], '</span>
						</dt>
						<dd>
							<input type="text" id="board_name" name="board_name" value="', $context['board']['name'], '" size="30" class="input_text" />
						</dd>
						<dt>
							<strong><label for="desc">', $txt['mboards_description'], '</label>:</strong><br />
							<span class="smalltext">', $txt['mboards_description_desc'], '</span>
						</dt>
						<dd>
							<textarea id="desc" name="desc" rows="3" cols="35" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';">', $context['board']['description'], '</textarea>
						</dd>
						<dt>
							<strong><label for="profile">', $txt['permission_profile'], '</label>:</strong><br />
							<span class="smalltext">', $context['can_manage_permissions'] ? sprintf($txt['permission_profile_desc'], $scripturl . '?action=admin;area=permissions;sa=profiles;' . $context['session_var'] . '=' . $context['session_id']) : strip_tags($txt['permission_profile_desc']), '</span>
						</dt>
						<dd>
							<select id="profile" name="profile">';
    if (isset($context['board']['is_new'])) {
        echo '
								<option value="-1">[', $txt['permission_profile_inherit'], ']</option>';
    }
    foreach ($context['profiles'] as $id => $profile) {
        echo '
								<option value="', $id, '" ', $id == $context['board']['profile'] ? 'selected="selected"' : '', '>', $profile['name'], '</option>';
    }
    echo '
							</select>
						</dd>
						<dt>
							<strong>', $txt['mboards_groups'], ':</strong><br />
							<span class="smalltext">', empty($modSettings['deny_boards_access']) ? $txt['mboards_groups_desc'] : $txt['boardsaccess_option_desc'], '</span>';
    echo '
						</dt>
						<dd>';
    if (!empty($modSettings['deny_boards_access'])) {
        echo '
							<table>
								<tr>
									<td></td>
									<th>', $txt['permissions_option_on'], '</th>
									<th>', $txt['permissions_option_off'], '</th>
									<th>', $txt['permissions_option_deny'], '</th>
									<th></th>
								</tr>';
    }
    // List all the membergroups so the user can choose who may access this board.
    foreach ($context['groups'] as $group) {
        if (empty($modSettings['deny_boards_access'])) {
            echo '
							<label for="groups_', $group['id'], '">
								<input type="checkbox" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '"', $group['allow'] ? ' checked="checked"' : '', ' class="input_check" />
								<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '>
									', $group['name'], '
								</span>
							</label>
							<br />';
        } else {
            echo '
								<tr>
									<td>
										<span', $group['is_post_group'] ? ' class="post_group" title="' . $txt['mboards_groups_post_group'] . '"' : '', $group['id'] == 0 ? ' class="regular_members" title="' . $txt['mboards_groups_regular_members'] . '"' : '', '>
											', $group['name'], '
										</span>
									</td>
									<td>
										<input type="radio" name="groups[', $group['id'], ']" value="allow" id="groups_', $group['id'], '_a"', $group['allow'] ? ' checked="checked"' : '', ' class="input_radio" />
									</td>
									<td>
										<input type="radio" name="groups[', $group['id'], ']" value="ignore" id="groups_', $group['id'], '_x"', !$group['allow'] && !$group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
									</td>
									<td>
										<input type="radio" name="groups[', $group['id'], ']" value="deny" id="groups_', $group['id'], '_d"', $group['deny'] ? ' checked="checked"' : '', ' class="input_radio" />
									</td>
									<td></td>
								</tr>';
        }
    }
    if (empty($modSettings['deny_boards_access'])) {
        echo '
							<span class="select_all_box">
								<em><label for="check_all">', $txt['check_all'], '</label></em> <input type="checkbox" id="check_all" class="input_check" onclick="invertAll(this, this.form, \'groups[\');" />
							</span>
							<br />
							<br />
						</dd>';
    } else {
        echo '
								<tr class="select_all_box">
									<td>
									</td>
									<td>
										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'allow\');" />
									</td>
									<td>
										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'ignore\');" />
									</td>
									<td>
										<input type="radio" name="select_all" class="input_radio" onclick="selectAllRadio(this, this.form, \'groups\', \'deny\');" />
									</td>
									<td>
										<em>', $txt['check_all'], '</em>
									</td>
								</tr>
							</table>
						</dd>';
    }
    // Options to choose moderators, specify as announcement board and choose whether to count posts here.
    echo '
						<dt>
							<strong><label for="moderators">', $txt['mboards_moderators'], '</label>:</strong><br />
							<span class="smalltext">', $txt['mboards_moderators_desc'], '</span><br />
						</dt>
						<dd>
							<input type="text" name="moderators" id="moderators" value="', $context['board']['moderator_list'], '" size="30" class="input_text" />
							<div id="moderator_container"></div>
						</dd>
					</dl>
					<hr />';
    // Add a select all box for the allowed groups section
    echo '
					<script><!-- // --><![CDATA[
						$(document).ready(function () {
							$(".select_all_box").each(function () {
								$(this).removeClass(\'select_all_box\');
							});
						});
					// ]]></script>';
    if (empty($context['board']['is_recycle']) && empty($context['board']['topics'])) {
        echo '
					<dl class="settings">
						<dt>
							<strong><label for="redirect_enable">', $txt['mboards_redirect'], '</label>:</strong><br />
							<span class="smalltext">', $txt['mboards_redirect_desc'], '</span><br />
						</dt>
						<dd>
							<input type="checkbox" id="redirect_enable" name="redirect_enable"', $context['board']['redirect'] != '' ? ' checked="checked"' : '', ' onclick="refreshOptions();" class="input_check" />
						</dd>
					</dl>';
    }
    if (!empty($context['board']['is_recycle'])) {
        echo '
					<div class="infobox">', $txt['mboards_redirect_disabled_recycle'], '<br />', $txt['mboards_recycle_disabled_delete'], '</div>';
    }
    if (empty($context['board']['is_recycle']) && !empty($context['board']['topics'])) {
        echo '
					<div class="infobox">
						<strong>', $txt['mboards_redirect'], '</strong><br />
						', $txt['mboards_redirect_disabled'], '
					</div>';
    }
    if (!$context['board']['topics'] && empty($context['board']['is_recycle'])) {
        echo '
					<div id="redirect_address_div">
						<dl class="settings">
							<dt>
								<strong><label for="redirect_address">', $txt['mboards_redirect_url'], '</label>:</strong><br />
								<span class="smalltext">', $txt['mboards_redirect_url_desc'], '</span><br />
							</dt>
							<dd>
								<input type="text" id="redirect_address" name="redirect_address" value="', $context['board']['redirect'], '" size="40" class="input_text" />
							</dd>
						</dl>
					</div>';
        if ($context['board']['redirect']) {
            echo '
					<div id="reset_redirect_div">
						<dl class="settings">
							<dt>
								<strong><label for="reset_redirect">', $txt['mboards_redirect_reset'], '</label>:</strong><br />
								<span class="smalltext">', $txt['mboards_redirect_reset_desc'], '</span><br />
							</dt>
							<dd>
								<input type="checkbox" id="reset_redirect" name="reset_redirect" class="input_check" />
								<em>(', sprintf($txt['mboards_current_redirects'], $context['board']['posts']), ')</em>
							</dd>
						</dl>
					</div>';
        }
    }
    echo '
					<div id="count_posts_div">
						<dl class="settings">
							<dt>
								<strong><label for="count">', $txt['mboards_count_posts'], '</label>:</strong><br />
								<span class="smalltext">', $txt['mboards_count_posts_desc'], '</span><br />
							</dt>
							<dd>
								<input type="checkbox" id="count" name="count" ', $context['board']['count_posts'] ? ' checked="checked"' : '', ' class="input_check" />
							</dd>
						</dl>
					</div>';
    // Here the user can choose to force this board to use a theme other than the default theme for the forum.
    echo '
					<div id="board_theme_div">
						<dl class="settings">
							<dt>
								<strong><label for="boardtheme">', $txt['mboards_theme'], '</label>:</strong><br />
								<span class="smalltext">', $txt['mboards_theme_desc'], '</span><br />
							</dt>
							<dd>
								<select name="boardtheme" id="boardtheme" onchange="refreshOptions();">
									<option value="0"', $context['board']['theme'] == 0 ? ' selected="selected"' : '', '>', $txt['mboards_theme_default'], '</option>';
    foreach ($context['themes'] as $theme) {
        echo '
									<option value="', $theme['id'], '"', $context['board']['theme'] == $theme['id'] ? ' selected="selected"' : '', '>', $theme['name'], '</option>';
    }
    echo '
								</select>
							</dd>
						</dl>
					</div>
					<div id="override_theme_div">
						<dl class="settings">
							<dt>
								<strong><label for="override_theme">', $txt['mboards_override_theme'], '</label>:</strong><br />
								<span class="smalltext">', $txt['mboards_override_theme_desc'], '</span><br />
							</dt>
							<dd>
								<input type="checkbox" id="override_theme" name="override_theme"', $context['board']['override_theme'] ? ' checked="checked"' : '', ' class="input_check" />
							</dd>
						</dl>
					</div>';
    echo '
					<div class="submitbutton">
						<input type="hidden" name="rid" value="', $context['redirect_location'], '" />
						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
						<input type="hidden" name="', $context['admin-be-' . $context['board']['id'] . '_token_var'], '" value="', $context['admin-be-' . $context['board']['id'] . '_token'], '" />';
    // If this board has no children don't bother with the next confirmation screen.
    if ($context['board']['no_children']) {
        echo '
						<input type="hidden" name="no_children" value="1" />';
    }
    if (isset($context['board']['is_new'])) {
        echo '
						<input type="hidden" name="cur_cat" value="', $context['board']['category'], '" />
						<input type="submit" name="add" value="', $txt['mboards_new_board'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit" />';
    } else {
        echo '
						<input type="submit" name="edit" value="', $txt['modify'], '" onclick="return !isEmptyText(this.form.board_name);" class="button_submit" />';
    }
    if (!isset($context['board']['is_new']) && empty($context['board']['is_recycle'])) {
        echo '
						<span', $context['board']['is_recycle'] ? ' style="visibility:hidden">' : '>', '<input type="submit" name="delete" value="', $txt['mboards_delete_board'], '" onclick="return confirm(\'', $txt['boardConfirm'], '\');"', ' class="button_submit" /></span>';
    }
    echo '
					</div>
				</div>
			</div>
		</form>
	</div>';
    $js = '
		var oModeratorSuggest = new smc_AutoSuggest({
			sSelf: \'oModeratorSuggest\',
			sSessionId: elk_session_id,
			sSessionVar: elk_session_var,
			sSuggestId: \'moderators\',
			sControlId: \'moderators\',
			sSearchType: \'member\',
			bItemList: true,
			sPostName: \'moderator_list\',
			sURLMask: \'action=profile;u=%item_id%\',
			sTextDeleteItem: \'' . $txt['autosuggest_delete_item'] . '\',
			sItemListContainerId: \'moderator_container\',
			aListItems: [';
    foreach ($context['board']['moderators'] as $id_member => $member_name) {
        $js .= '
					{
						sItemId: ' . JavaScriptEscape($id_member) . ',
						sItemName: ' . JavaScriptEscape($member_name) . '
					}' . ($id_member == $context['board']['last_moderator_id'] ? '' : ',');
    }
    $js .= '
			]
		});';
    addInlineJavascript($js, true);
    // Javascript for deciding what to show.
    echo '
	<script><!-- // --><![CDATA[
		function refreshOptions()
		{
			var redirect = document.getElementById("redirect_enable"),
				redirectEnabled = redirect ? redirect.checked : false,
				nonDefaultTheme = document.getElementById("boardtheme").value == 0 ? false : true;

			// What to show?
			document.getElementById("override_theme_div").style.display = redirectEnabled || !nonDefaultTheme ? "none" : "";
			document.getElementById("board_theme_div").style.display = redirectEnabled ? "none" : "";
			document.getElementById("count_posts_div").style.display = redirectEnabled ? "none" : "";';
    if (!$context['board']['topics'] && empty($context['board']['is_recycle'])) {
        echo '
			document.getElementById("redirect_address_div").style.display = redirectEnabled ? "" : "none";';
        if ($context['board']['redirect']) {
            echo '
			document.getElementById("reset_redirect_div").style.display = redirectEnabled ? "" : "none";';
        }
    }
    echo '
		}

		refreshOptions();
	// ]]></script>';
}
Esempio n. 22
0
/**
 * Allows to view and modify the mail settings.
 *
 * @param bool $return_config = false
 * @return array
 */
function ModifyMailSettings($return_config = false)
{
    global $txt, $scripturl, $context, $settings, $modSettings, $txtBirthdayEmails;
    loadLanguage('EmailTemplates');
    $body = $txtBirthdayEmails[(empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']) . '_body'];
    $subject = $txtBirthdayEmails[(empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']) . '_subject'];
    $emails = array();
    $processedBirthdayEmails = array();
    foreach ($txtBirthdayEmails as $key => $value) {
        $index = substr($key, 0, strrpos($key, '_'));
        $element = substr($key, strrpos($key, '_') + 1);
        $processedBirthdayEmails[$index][$element] = $value;
    }
    foreach ($processedBirthdayEmails as $index => $dummy) {
        $emails[$index] = $index;
    }
    $config_vars = array(array('check', 'mail_queue'), array('int', 'mail_limit'), array('int', 'mail_quantity'), '', array('select', 'mail_type', array($txt['mail_type_default'], 'SMTP')), array('text', 'smtp_host'), array('text', 'smtp_port'), array('text', 'smtp_username'), array('password', 'smtp_password'), '', array('select', 'birthday_email', $emails, 'value' => array('subject' => $subject, 'body' => $body), 'javascript' => 'onchange="fetch_birthday_preview()"'), 'birthday_subject' => array('var_message', 'birthday_subject', 'var_message' => $processedBirthdayEmails[empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']]['subject'], 'disabled' => true, 'size' => strlen($subject) + 3), 'birthday_body' => array('var_message', 'birthday_body', 'var_message' => nl2br($body), 'disabled' => true, 'size' => ceil(strlen($body) / 25)));
    call_integration_hook('integrate_modify_mail_settings', array(&$config_vars));
    if ($return_config) {
        return $config_vars;
    }
    // Saving?
    if (isset($_GET['save'])) {
        // Make the SMTP password a little harder to see in a backup etc.
        if (!empty($_POST['smtp_password'][1])) {
            $_POST['smtp_password'][0] = base64_encode($_POST['smtp_password'][0]);
            $_POST['smtp_password'][1] = base64_encode($_POST['smtp_password'][1]);
        }
        checkSession();
        // We don't want to save the subject and body previews.
        unset($config_vars['birthday_subject'], $config_vars['birthday_body']);
        call_integration_hook('integrate_save_mail_settings');
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=mailqueue;sa=settings');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=mailqueue;save;sa=settings';
    $context['settings_title'] = $txt['mailqueue_settings'];
    prepareDBSettingContext($config_vars);
    $context['settings_insert_above'] = '
	<script type="text/javascript"><!-- // --><![CDATA[
		var bDay = {';
    $i = 0;
    foreach ($processedBirthdayEmails as $index => $email) {
        $is_last = ++$i == count($processedBirthdayEmails);
        $context['settings_insert_above'] .= '
			' . $index . ': {
				subject: ' . JavaScriptEscape($email['subject']) . ',
				body: ' . JavaScriptEscape(nl2br($email['body'])) . '
			}' . (!$is_last ? ',' : '');
    }
    $context['settings_insert_above'] .= '
		};
		function fetch_birthday_preview()
		{
			var index = document.getElementById(\'birthday_email\').value;
			document.getElementById(\'birthday_subject\').innerHTML = bDay[index].subject;
			document.getElementById(\'birthday_body\').innerHTML = bDay[index].body;
		}
	// ]]></script>';
}
Esempio n. 23
0
function template_body_above()
{
    global $context, $settings, $options, $scripturl, $txt, $modSettings;
    // Because of the way width/padding are calculated, we have to tell Internet Explorer 4 and 5 that the content should be 100% wide. (or else it will assume about 108%!)
    echo '
	<div id="headerarea" style="padding: 12px 30px 4px 30px;', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' : '', '">';
    // The logo and the three info boxes.
    echo '
		<table cellspacing="0" cellpadding="0" border="0" width="100%" style="position: relative;">
			<tr>
				<td colspan="2" valign="bottom" style="padding: 5px; white-space: nowrap;">';
    // This part is the logo and forum name.  You should be able to change this to whatever you want...
    echo '
					<img src="', $settings['images_url'], '/smflogo.gif" style="width: 250px; float: ', !$context['right_to_left'] ? 'right' : 'left', ';" alt="" />';
    if (empty($context['header_logo_url_html_safe'])) {
        echo '
					<span style="font-family: Georgia, sans-serif; font-size: xx-large;">', $context['forum_name_html_safe'], '</span>';
    } else {
        echo '
					<img src="', $context['header_logo_url_html_safe'], '" alt="', $context['forum_name_html_safe'], '" border="0" />';
    }
    echo '
				</td>
			</tr>
			<tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
				<td valign="top">
					<div class="headertitles" style="margin-right: 5px; position: relative;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
					<div class="headerbodies" style="position: relative; margin-right: 5px; background-image: url(', $settings['images_url'], '/box_bg.gif);">
						<img src="', $settings['lang_images_url'], '/userinfo.gif" style="position: absolute; left: ', $context['browser']['is_ie5'] || $context['browser']['is_ie4'] ? '0' : '-1px', '; top: -16px;" class="clear" alt="" />
						<table width="99%" cellpadding="0" cellspacing="5" border="0"><tr>';
    if (!empty($context['user']['avatar'])) {
        echo '<td valign="middle">', $context['user']['avatar']['image'], '</td>';
    }
    echo '<td valign="top" class="smalltext" style="width: 100%; font-family: verdana, arial, sans-serif;">';
    // If the user is logged in, display stuff like their name, new messages, etc.
    if ($context['user']['is_logged']) {
        echo '
							', $txt['hello_member'], ' <strong>', $context['user']['name'], '</strong>';
        // Only tell them about their messages if they can read their messages!
        if ($context['allow_pm']) {
            echo ', ', $txt['msg_alert_you_have'], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt['msg_alert_messages'] : $txt['message_lowercase'], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
        }
        echo '.<br />';
        // Is the forum in maintenance mode?
        if ($context['in_maintenance'] && $context['user']['is_admin']) {
            echo '
							<strong>', $txt['maintain_mode_on'], '</strong><br />';
        }
        // Are there any members waiting for approval?
        if (!empty($context['unapproved_members'])) {
            echo '
							', $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'], '<br />';
        }
        // Show the total time logged in?
        if (!empty($context['user']['total_time_logged_in'])) {
            echo '
							', $txt['totalTimeLogged1'];
            // If days is just zero, don't bother to show it.
            if ($context['user']['total_time_logged_in']['days'] > 0) {
                echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];
            }
            // Same with hours - only show it if it's above zero.
            if ($context['user']['total_time_logged_in']['hours'] > 0) {
                echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];
            }
            // But, let's always show minutes - Time wasted here: 0 minutes ;).
            echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
        }
        echo '
							<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a><br />
							<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />
							', $context['current_time'], '<br />';
        if (!empty($context['open_mod_reports']) && $context['show_open_reports']) {
            echo '
								<a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a>';
        }
    } else {
        echo '
							', sprintf($txt['welcome_guest'], $txt['guest_title']), '<br />
							', $context['current_time'], '<br />

							<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>

							<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" style="margin: 3px 1ex 1px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
								<div class="righttext">
									<input type="text" name="user" size="10" class="input_text" /> <input type="password" name="passwrd" size="10" class="input_password" />
									<select name="cookielength">
										<option value="60">', $txt['one_hour'], '</option>
										<option value="1440">', $txt['one_day'], '</option>
										<option value="10080">', $txt['one_week'], '</option>
										<option value="43200">', $txt['one_month'], '</option>
										<option value="-1" selected="selected">', $txt['forever'], '</option>
									</select>
									<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
									', $txt['quick_login_dec'], '
									<input type="hidden" name="hash_passwrd" value="" />
								</div>
							</form>';
    }
    echo '
						</td></tr></table>
					</div>

					<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
						<div style="margin-top: 7px;">
							<strong>', $txt['search'], ': </strong><input type="text" name="search" value="" style="width: 190px;" class="input_text" />&nbsp;
							<input type="submit" name="submit" value="', $txt['search'], '" style="width: 8ex;" class="button_submit" />&nbsp;
							<a href="', $scripturl, '?action=search;advanced">', $txt['search_advanced'], '</a>
							<input type="hidden" name="advanced" value="0" />';
    // Search within current topic?
    if (!empty($context['current_topic'])) {
        echo '
							<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
    } elseif (!empty($context['current_board'])) {
        echo '
							<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
    }
    echo '
						</div>
					</form>

				</td>
				<td style="width: 262px; ', !$context['right_to_left'] ? 'padding-left' : 'padding-right', ': 6px;" valign="top">';
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news'])) {
        echo '
					<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
					<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif); margin-bottom: 8px;">
						<img src="', $settings['lang_images_url'], '/newsbox.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
						<div style="height: 50px; overflow: auto; padding: 5px;" class="smalltext">', $context['random_news_line'], '</div>
					</div>';
    }
    // The "key stats" box.
    echo '
					<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
					<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif);">
						<img src="', $settings['lang_images_url'], '/keystats.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
						<div style="', !$context['browser']['is_ie'] ? 'min-height: 35px;' : 'height: 4em;', ' padding: 5px;" class="smalltext">
							<strong>', $context['common_stats']['total_posts'], '</strong> ', $txt['posts_made'], ' ', $txt['in'], ' <strong>', $context['common_stats']['total_topics'], '</strong> ', $txt['topics'], ' ', $txt['by'], ' <span style="white-space: nowrap;"><strong>', $context['common_stats']['total_members'], '</strong> ', $txt['members'], '</span><br />
							', $txt['latest_member'], ': <strong> ', $context['common_stats']['latest_member']['link'], '</strong>
						</div>
					</div>';
    echo '
				</td>
			</tr>
		</table>

		<img id="upshrink" src="', $settings['images_url'], '/upshrink.gif" alt="*" title="', $txt['upshrink_description'], '" style="margin: 2px 2ex 2px 0; display: none;" border="0" />';
    // Show the menu here, according to the menu sub template.
    template_menu();
    // Define the upper_section toggle in JavaScript.
    echo '
		<script type="text/javascript"><!-- // --><![CDATA[
			var oMainHeaderToggle = new smc_Toggle({
				bToggleEnabled: true,
				bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
				aSwappableContainers: [
					\'upshrinkHeader\',
					\'upshrinkHeader2\'
				],
				aSwapImages: [
					{
						sId: \'upshrink\',
						srcExpanded: smf_images_url + \'/upshrink.gif\',
						altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
						srcCollapsed: smf_images_url + \'/upshrink2.gif\',
						altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
					}
				],
				oThemeOptions: {
					bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
					sOptionName: \'collapse_header\',
					sSessionVar: ', JavaScriptEscape($context['session_var']), ',
					sSessionId: ', JavaScriptEscape($context['session_id']), '
				},
				oCookieOptions: {
					bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
					sCookieName: \'upshrink\'
				}
			});
		// ]]></script>';
    echo '
	</div>';
    // The main content should go here.  A table is used because IE 6 just can't handle a div.
    echo '
	<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
		<td id="bodyarea" style="padding: 1ex 20px 2ex 20px;">';
    // Show the navigation tree.
    theme_linktree();
}
Esempio n. 24
0
function template_body_above()
{
    global $context, $settings, $scripturl, $txt, $modSettings;
    // Wrapper div now echoes permanently for better layout options. h1 a is now target for "Go up" links.
    echo '
	<div id="header">
		<div class="frame">
			<h1 class="forumtitle rubberBand">
				<a id="top" href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name_html_safe'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name_html_safe'] . '">', '</a>
			</h1>';
    echo '
			', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum">' : '<div id="siteslogan" class="floatright">' . $settings['site_slogan'] . '</div>', '';
    echo '
		</div>
	</div>
	<div id="wrapper">
	<div id="top_section">
		<div class="frame">';
    // If the user is logged in, display some things that might be useful.
    if ($context['user']['is_logged']) {
        // Firstly, the user's menu
        echo '
			<ul class="floatleft" id="top_info">
				<li>
					<a class="welcomelen1" href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
        if (!empty($context['user']['avatar'])) {
            echo $context['user']['avatar']['image'];
        }
        echo $context['user']['name'], ' &#9660;</a>
					<div id="profile_menu" class="top_menu"></div>
				</li>';
        // Secondly, PMs if we're doing them
        if ($context['allow_pm']) {
            echo '
				<li>
					<a class="welcomelen1" href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">', $txt['pm_short'], !empty($context['user']['unread_messages']) ? ' <span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '</a>
					<div id="pm_menu" class="top_menu scrollable"></div>
				</li>';
        }
        // Thirdly, alerts
        echo '
				<li>
					<a class="welcomelen1" href="', $scripturl, '?action=profile;area=showalerts;u=', $context['user']['id'], '"', !empty($context['self_alerts']) ? ' class="active"' : '', ' id="alerts_menu_top">', $txt['alerts'], !empty($context['user']['alerts']) ? ' <span class="amt">' . $context['user']['alerts'] . '</span>' : '', '</a>
					<div id="alerts_menu" class="top_menu scrollable"></div>
				</li>';
        // And now we're done.
        echo '
			<li>
				<a class="welcomelen1" href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">', $txt['view_unread_category'], '</a>
			</li><li>	
				<a class="welcomelen1" href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">', $txt['unread_replies'], '</a>
			</li>
			</ul>';
    } else {
        echo '
			<ul class="floatleft welcome">
				<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register1' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li>
			</ul>';
    }
    if (!empty($modSettings['userLanguage']) && !empty($context['languages']) && count($context['languages']) > 1) {
        echo '
			<form id="languages_form" action="" method="get" class="floatright">
				<select id="language_select" name="language" onchange="this.form.submit()">';
        foreach ($context['languages'] as $language) {
            echo '
					<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';
        }
        echo '
				</select>
				<noscript>
					<input type="submit" value="', $txt['quick_mod_go'], '" />
				</noscript>
			</form>';
    }
    if ($context['allow_search']) {
        echo '<div class="konusal-search">
			<form  class="floatright" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
				<input type="search" name="search" value="" class="">&nbsp;';
        // Using the quick search dropdown?
        $selected = !empty($context['current_topic']) ? 'current_topic' : (!empty($context['current_board']) ? 'current_board' : 'all');
        echo '<label>
			<select name="search_selection">
				<option value="all"', $selected == 'all' ? ' selected' : '', '>', $txt['search_entireforum'], ' </option>';
        // Can't limit it to a specific topic if we are not in one
        if (!empty($context['current_topic'])) {
            echo '
				<option value="topic"', $selected == 'current_topic' ? ' selected' : '', '>', $txt['search_thistopic'], '</option>';
        }
        // Can't limit it to a specific board if we are not in one
        if (!empty($context['current_board'])) {
            echo '
					<option value="board"', $selected == 'current_board' ? ' selected' : '', '>', $txt['search_thisbrd'], '</option>';
        }
        echo '
					<option value="members"', $selected == 'members' ? ' selected' : '', '>', $txt['search_members'], ' </option>
				</select></label>';
        // Search within current topic?
        if (!empty($context['current_topic'])) {
            echo '
				<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
        } elseif (!empty($context['current_board'])) {
            echo '
				<input type="hidden" name="sd_brd[', $context['current_board'], ']" value="', $context['current_board'], '">';
        }
        echo '
				<button type="submit" name="search2" value="', $txt['search'], '" >', $txt['search'], '</button>
				<input type="hidden" name="advanced" value="0">
			</form></div>';
    }
    echo '
		</div>
	</div>
		<div id="upper_section">
			<div id="inner_section">
				<div id="inner_wrap">
					<div class="user">
						', $context['current_time'], '
					</div>';
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
        echo '
					<div class="news">
						<h2>', $txt['news'], ': </h2>
						<p>', $context['random_news_line'], '</p>
					</div>';
    }
    echo '
					<hr class="clear">
				</div>';
    // Show the menu here, according to the menu sub template, followed by the navigation tree.
    theme_linktree();
    global $context, $settings, $scripturl, $txt, $modSettings;
    require_once $settings['theme_dir'] . '/konusal-com.php';
    if (empty($context['current_board']) && empty($context['current_action'])) {
        global $context, $options, $txt;
        // Here's where the "Info Center" starts...
        echo '
	<div class="roundframe" id="info_center">
		<div class="title_bar">
			<h3 class="titlebg">
				<span class="toggle_up floatright" id="upshrink_ic" title="', $txt['hide_infocenter'], '" style="display: none;"></span>
				<a href="#" id="upshrink_link">', sprintf($txt['info_center_title'], $context['forum_name_html_safe']), '</a>
			</h3>
		</div>
		<div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>';
        top10();
        echo '
		</div>
	</div>';
        // Info center collapse object.
        echo '
	<script><!-- // --><![CDATA[
		var oInfoCenterToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_header_ic']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'upshrinkHeaderIC\'
			],
			aSwapImages: [
				{
					sId: \'upshrink_ic\',
					altExpanded: ', JavaScriptEscape($txt['hide_infocenter']), ',
					altCollapsed: ', JavaScriptEscape($txt['show_infocenter']), '
				}
			],
			aSwapLinks: [
				{
					sId: \'upshrink_link\',
					msgExpanded: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), ',
					msgCollapsed: ', JavaScriptEscape(sprintf($txt['info_center_title'], $context['forum_name_html_safe'])), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_header_ic\',
				sSessionId: smf_session_id,
				sSessionVar: smf_session_var,
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'upshrinkIC\'
			}
		});
	// ]]></script>';
    }
    template_menu();
    echo '
			</div>
		</div>';
    // The main content should go here.
    echo '
		<div id="content_section">             
			<div class="scrollbar-light" id="main_content_section" >';
}
Esempio n. 25
0
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */
function template_main()
{
    global $context, $settings, $options, $txt, $scripturl, $modSettings;
    // Show some statistics next to the link tree if SP1 info is off.
    echo '
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>
		<td align="right">';
    if (!$settings['show_stats_index']) {
        echo '
			', $txt['members'], ': ', $context['common_stats']['total_members'], ' &nbsp;&#8226;&nbsp; ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' &nbsp;&#8226;&nbsp; ', $txt['topics'], ': ', $context['common_stats']['total_topics'], '
			', $settings['show_latest_member'] ? '<br />' . $txt['welcome_member'] . ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>' . $txt['newest_member'] : '';
    }
    echo '
		</td>
	</tr>
</table>';
    // Show the news fader?  (assuming there are things to show...)
    if ($settings['show_newsfader'] && !empty($context['fader_news_lines'])) {
        echo '
<div class="tborder" style="margin-bottom: 2ex;">
	<table border="0" width="100%" cellspacing="1" cellpadding="0">
		<tr class="titlebg" align="center">
			<td><img id="newsupshrink" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="margin: 0 1ex; display: none;" />', $txt['news'], '</td>
		</tr>
		<tr>
			<td valign="middle" align="center" style="height: 60px;" id="smfNewsFaderContainer">';
        // Prepare all the javascript settings.
        echo '
				<div class="windowbg2" id="smfNewsFader">
					<div id="smfFadeScroller"><strong>', $context['news_lines'][0], '</strong></div>
				</div>
			</td>
		</tr>
	</table>
	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/fader.js"></script>
	<script type="text/javascript"><!-- // --><![CDATA[

		// Create a news fader object.
		var oNewsFader = new smf_NewsFader({
			sSelf: \'oNewsFader\',
			sFaderControlId: \'smfFadeScroller\',
			aFaderItems: [
				"', implode('",
				"', $context['fader_news_lines']), '"],
			sItemTemplate: ', JavaScriptEscape('<strong>%1$s</strong>'), ',
			iFadeDelay: ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], '
		});

		// Create the news fader toggle.
		var smfNewsFadeToggle = new smc_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ', empty($options['collapse_news_fader']) ? 'false' : 'true', ',
			aSwappableContainers: [
				\'smfNewsFaderContainer\'
			],
			aSwapImages: [
				{
					sId: \'newsupshrink\',
					srcExpanded: smf_images_url + \'/collapse.gif\',
					altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
					srcCollapsed: smf_images_url + \'/expand.gif\',
					altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
				sOptionName: \'collapse_news_fader\',
				sSessionVar: ', JavaScriptEscape($context['session_var']), ',
				sSessionId: ', JavaScriptEscape($context['session_id']), '
			},
			oCookieOptions: {
				bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
				sCookieName: \'newsupshrink\'
			}
		});
	// ]]></script>

</div>';
    }
    /* Each category in categories is made up of:
    		id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
    		new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down iamge),
    		and boards. (see below.) */
    foreach ($context['categories'] as $category) {
        // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
        if (empty($category['boards']) && !$category['is_collapsed']) {
            continue;
        }
        echo '
<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="5">
	<tr class="catbg', $category['new'] ? '2' : '', '">
		<td colspan="', $context['user']['is_guest'] ? '5' : '4', '" height="18">';
        if (!$context['user']['is_guest'] && !empty($category['show_unread'])) {
            echo '
			<div class="floatright">
				<a href="', $scripturl, '?action=unread;c=', $category['id'], '">', $txt['view_unread_category'], '</a>
			</div>';
        }
        // If this category even can collapse, show a link to collapse it.
        if ($category['can_collapse']) {
            echo '
			<a href="', $category['collapse_href'], '" rel="nofollow">', $category['collapse_image'], '</a>';
        }
        echo '
			', $category['link'], '
		</td>
	</tr>';
        // Assuming the category hasn't been collapsed...
        if (!$category['is_collapsed']) {
            /* Each board in each category's boards has:
            			new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
            			children (see below.), link_children (easier to use.), children_new (are they new?),
            			topics (# of), posts (# of), link, href, and last_post. (see below.) */
            foreach ($category['boards'] as $board) {
                echo '
	<tr class="windowbg2">
		<td class="windowbg" width="6%" align="center" valign="top"><a href="', $board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children', '">';
                // If the board or children is new, show an indicator.
                if ($board['new'] || $board['children_new']) {
                    echo '<img src="', $settings['images_url'], '/on', $board['new'] ? '' : '2', '.gif" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" border="0" />';
                } elseif ($board['is_redirect']) {
                    echo '<img src="', $settings['images_url'], '/redirect.gif" alt="*" title="*" border="0" />';
                } else {
                    echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" border="0" />';
                }
                echo '</a></td>
		<td>
			<strong><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></strong>';
                // Has it outstanding posts for approval?
                if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) {
                    echo '
					<a href="', $scripturl, '?action=moderate;area=postmod;sa=', $board['unapproved_topics'] > 0 ? 'topics' : 'posts', ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';
                }
                echo '
			<br />
			', $board['description'];
                // Show the "Moderators: ".  Each has name, href, link, and id. (but we're gonna use link_moderators.)
                if (!empty($board['moderators'])) {
                    echo '
			<div style="padding-top: 1px;" class="smalltext"><em>', count($board['moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</em></div>';
                }
                // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
                if (!empty($board['children'])) {
                    // Sort the links into an array with new boards bold so it can be imploded.
                    $children = array();
                    /* Each child in each board's children has:
                    			id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
                    foreach ($board['children'] as $child) {
                        if (!$child['is_redirect']) {
                            $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>';
                        } else {
                            $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '">' . $child['name'] . '</a>';
                        }
                        // Does the child have any posts awaiting approval?!
                        if ($child['can_approve_posts'] && $child['unapproved_posts'] | $child['unapproved_topics']) {
                            $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
                        }
                        $children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
                    }
                    echo '
			<div style="padding-top: 1px;" class="smalltext"><em>', $txt['parent_boards'], ': ', implode(', ', $children), '</em></div>';
                }
                // Show some basic information about the number of posts, etc.
                echo '
		</td>
		<td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
			', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], !$board['is_redirect'] ? ' ' . $txt['in'] . '<br />
			' . comma_format($board['topics']) . ' ' . $txt['board_topics'] : '', '
		</span></td>
		<td class="smalltext" valign="middle" width="22%">';
                /* The board's and children's 'last_post's have:
                			time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
                			link, href, subject, start (where they should go for the first unread post.),
                			and member. (which has id, name, link, href, username in it.) */
                if (!empty($board['last_post']['id'])) {
                    echo '
			', $txt['last_post'], ' ', $txt['on'], ' ', $board['last_post']['time'], '<br />
			', $txt['in'], ' ', $board['last_post']['link'], ' ', $txt['by'], ' ', $board['last_post']['member']['link'];
                }
                echo '
		</td>
	</tr>';
            }
        }
        echo '
</table></div>
<br />';
    }
    if ($context['user']['is_logged']) {
        echo '
<div class="tborder" style="padding: 3px;"><table border="0" width="100%" cellspacing="0" cellpadding="5">
	<tr class="titlebg">
		<td align="', !$context['right_to_left'] ? 'left' : 'right', '" class="smalltext">
			<img src="', $settings['images_url'], '/new_some.gif" alt="" border="0" align="middle" /> ', $txt['new_posts'], '
			<img src="', $settings['images_url'], '/new_none.gif" alt="" border="0" align="middle" style="margin-left: 4ex;" /> ', $txt['old_posts'], '
		</td>
		<td align="', !$context['right_to_left'] ? 'right' : 'left', '" class="smalltext">';
        // Show the mark all as read button?
        if ($settings['show_mark_read']) {
            echo '
			<a href="', $scripturl, '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id'] . '">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/markread.gif" alt="' . $txt['mark_as_read'] . '" border="0" />' : $txt['mark_as_read'], '</a>';
        }
        echo '
		</td>
	</tr>
</table></div>';
    }
    template_info_center();
}
/**
 * A template that displays a list of boards subdivided by categories, with
 * a checkbox to allow select them, toggle selection on the category title
 *
 * @param string $form_name The name of the form that contains the list
 * @param string $input_names Name that should be assigned to the inputs
 * @param bool $select_all if true the a "select all" option is shown
 */
function template_pick_boards($form_name, $input_names = 'brd', $select_all = true)
{
    global $context, $txt;
    if ($select_all) {
        echo '
						<h3 class="secondary_header">
							<span id="category_toggle">&nbsp;
								<span id="advanced_panel_toggle" class="', $context['boards_check_all'] ? 'expand' : 'collapse', '" style="display: none;" title="', $txt['hide'], '"></span>
							</span>
							<a href="#" id="advanced_panel_link">', $txt['choose_board'], '</a>
						</h3>
						<div id="advanced_panel_div"', $context['boards_check_all'] ? ' style="display: none;"' : '', '>';
    }
    // Make two nice columns of boards, link each category header to toggle select all boards in each
    $group_cats = optimizeBoardsSubdivision($context['boards_in_category'], $context['num_boards']);
    foreach ($group_cats as $groups) {
        echo '
							<ul class="ignoreboards floatleft">';
        foreach ($groups as $cat_id) {
            $category = $context['categories'][$cat_id];
            echo '
								<li class="category">
									<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'', $form_name, '\', \'', $input_names, '\'); return false;">', $category['name'], '</a>
									<ul>';
            foreach ($category['boards'] as $board) {
                echo '
										<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
											<label for="', $input_names, $board['id'], '">
												<input type="checkbox" id="', $input_names, $board['id'], '" name="', $input_names, '[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '
											</label>
										</li>';
            }
            echo '
									</ul>
								</li>';
        }
        echo '
							</ul>';
    }
    // Provide an easy way to select all boards
    if ($select_all) {
        echo '
						</div>
						<div class="submitbutton">
							<span class="floatleft">
								<input type="checkbox" name="all" id="check_all" value=""', $context['boards_check_all'] ? ' checked="checked"' : '', ' onclick="invertAll(this, this.form, \'', $input_names, '\');" class="input_check" />
								<label for="check_all">
									<em> ', $txt['check_all'], '</em>
								</label>
							</span>
						</div>';
        // And now all the JS to make this work
        addInlineJavascript('
		// Some javascript for the advanced board select toggling
		var oAdvancedPanelToggle = new elk_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ' . ($context['boards_check_all'] ? 'true' : 'false') . ',
			aSwappableContainers: [
				\'advanced_panel_div\'
			],
			aSwapClasses: [
				{
					sId: \'advanced_panel_toggle\',
					classExpanded: \'collapse\',
					titleExpanded: ' . JavaScriptEscape($txt['hide']) . ',
					classCollapsed: \'expand\',
					titleCollapsed: ' . JavaScriptEscape($txt['show']) . '
				}
			],
			aSwapLinks: [
				{
					sId: \'advanced_panel_link\',
					msgExpanded: ' . JavaScriptEscape($txt['choose_board']) . ',
					msgCollapsed: ' . JavaScriptEscape($txt['choose_board']) . '
				}
			],
		});', true);
    }
}
/**
 * Main search page. Allows the user to search the forum according to criteria.
 */
function template_searchform()
{
    global $context, $settings, $txt, $scripturl, $modSettings;
    echo '
				<form action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8" name="searchform" id="searchform" class="standard_category">
					<h2 class="category_header', !empty($settings['use_buttons']) ? ' hdicon cat_img_search' : '', '">
						', $txt['set_parameters'], '
					</h2>';
    // Any search errors to inform the user about
    if (!empty($context['search_errors'])) {
        echo '
					<p class="errorbox">', implode('<br />', $context['search_errors']['messages']), '</p>';
    }
    // Start off showing our basic search form
    echo '
					<fieldset id="simple_search" class="content">
						<div id="search_term_input">
							<label for="search">
								<strong>', $txt['search_for'], '</strong>
							</label>:
							<input type="search" id="search" class="input_text" name="search" value="', $context['search_params']['search'], '" maxlength="', $context['search_string_limit'], '" size="40" placeholder="' . $txt['search'] . '" required="required" autofocus="autofocus" />', '
							<input id="submit" type="submit" name="s_search" value="' . $txt['search'] . '" class="button_submit"/>
						</div>';
    if (empty($modSettings['search_simple_fulltext'])) {
        echo '
						<p class="smalltext">', $txt['search_example'], '</p>';
    }
    // Does the search require a visual verification screen to annoy them?
    if ($context['require_verification']) {
        template_verification_controls($context['visual_verification_id'], '
						<div class="verification">
							<strong>' . $txt['search_visual_verification_label'] . ':</strong>
							<br />', '
						</div>');
    }
    // All of the advanced options, this div is collapsed by the JS when available
    echo '
						<div id="advanced_search" class="content">
							<dl id="search_options">
								<dt class="righttext"><label for="searchtype">
									', $txt['search_match'], ':</label>
								</dt>
								<dd>
									<select name="searchtype" id="searchtype">
										<option value="1"', empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['all_words'], '</option>
										<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected="selected"' : '', '>', $txt['any_words'], '</option>
									</select>
								</dd>
								<dt class="righttext">
									<label for="userspec">', $txt['by_user'], ':</label>
								</dt>
								<dd>
									<input id="userspec" type="text" name="userspec" value="', $context['search_params']['userspec'], '" size="40" class="input_text" />
								</dd>
								<dt class="righttext">
									<label for="sort">', $txt['search_order'], ':</label>
								</dt>
								<dd>
									<select id="sort" name="sort">
										<option value="relevance|desc">', $txt['search_orderby_relevant_first'], '</option>
										<option value="num_replies|desc">', $txt['search_orderby_large_first'], '</option>
										<option value="num_replies|asc">', $txt['search_orderby_small_first'], '</option>
										<option value="id_msg|desc">', $txt['search_orderby_recent_first'], '</option>
										<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
									</select>
								</dd>
								<dt class="righttext options">
									', $txt['search_options'], ':
								</dt>
								<dd class="options">
									<label for="show_complete">', $txt['search_show_complete_messages'], '
										<input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked="checked"' : '', ' class="input_check" />
									</label><br />
									<label for="subject_only">', $txt['search_subject_only'], '
										<input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" />
									</label>
								</dd>
								<dt class="righttext between">
									', $txt['search_post_age'], ':
								</dt>
								<dd><label for="minage">
									', $txt['search_between'], '</label><input type="text" name="minage" id="minage" value="', $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;<label for="maxage">', $txt['search_and'], '&nbsp;</label><input type="text" name="maxage" id="maxage" value="', $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '
								</dd>
							</dl>
						</div>
						<a id="upshrink_link" href="', $scripturl, '?action=search;advanced" class="linkbutton" style="display:none">', $txt['search_simple'], '</a>';
    // Set the initial search style for the form
    echo '
						<input id="advanced" type="hidden" name="advanced" value="1" />';
    // 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 '
					</fieldset>';
    // This starts our selection area to allow searching by specific boards
    if (empty($context['search_params']['topic'])) {
        echo '
					<fieldset id="pick_boards" class="content">';
        template_pick_boards('searchform');
        echo '
					</fieldset>';
    }
    echo '
				</form>';
    // And now all the JS to make this work
    addInlineJavascript('
		createEventListener(window);
		window.addEventListener("load", initSearch, false);

		var oAddMemberSuggest = new smc_AutoSuggest({
			sSelf: \'oAddMemberSuggest\',
			sSessionId: elk_session_id,
			sSessionVar: elk_session_var,
			sControlId: \'userspec\',
			sSearchType: \'member\',
			bItemList: false
		});

		// Set the search style
		document.getElementById(\'advanced\').value = "' . (empty($context['minmax_preferences']['asearch']) ? '1' : '0') . '";

		// And allow for the collapsing of the advanced search options
		var oSearchToggle = new elk_Toggle({
			bToggleEnabled: true,
			bCurrentlyCollapsed: ' . (empty($context['minmax_preferences']['asearch']) ? 'false' : 'true') . ',
			funcOnBeforeCollapse: function () {
				document.getElementById(\'advanced\').value = \'0\';
			},
			funcOnBeforeExpand: function () {
				document.getElementById(\'advanced\').value = \'1\';
			},
			aSwappableContainers: [
				\'advanced_search\'
			],
			aSwapLinks: [
				{
					sId: \'upshrink_link\',
					msgExpanded: ' . JavaScriptEscape($txt['search_simple']) . ',
					msgCollapsed: ' . JavaScriptEscape($txt['search_advanced']) . '
				}
			],
			oThemeOptions: {
				bUseThemeSettings: ' . ($context['user']['is_guest'] ? 'false' : 'true') . ',
				sOptionName: \'minmax_preferences\',
				sSessionId: elk_session_id,
				sSessionVar: elk_session_var,
				sAdditionalVars: \';minmax_key=asearch\'
			},
		});', true);
}
function up_template_control_richedit($editor_id, $smileyContainer, $bbcContainer)
{
    global $context, $settings, $txt, $modSettings;
    $editor_context =& $context['controls']['richedit'][$editor_id];
    $content = '
		<div>
			<div>
				<textarea class="editor" name="' . $editor_id . '" id="' . $editor_id . '" rows="' . $editor_context['rows'] . '" cols="' . $editor_context['columns'] . '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="' . $context['tabindex']++ . '" style="' . ($context['browser']['is_ie8'] ? 'max-width: ' . $editor_context['width'] . '; min-width: ' . $editor_context['width'] : 'width: ' . $editor_context['width']) . '; height: ' . $editor_context['height'] . ';">' . $editor_context['value'] . '</textarea>
			</div>
			<div id="' . $editor_id . '_resizer" style="display: none; ' . ($context['browser']['is_ie8'] ? 'max-width: ' . $editor_context['width'] . '; min-width: ' . $editor_context['width'] : 'width: ' . $editor_context['width']) . '" class="richedit_resize"></div>
		</div>
		<input type="hidden" name="' . $editor_id . '_mode" id="' . $editor_id . '_mode" value="0" />
		<script type="text/javascript"><!-- // --><![CDATA[';
    // Show the smileys.
    if (!empty($smileyContainer)) {
        $content .= '
				var oSmileyBox_' . $editor_id . ' = new smc_SmileyBox({
					sUniqueId: ' . JavaScriptEscape('smileyBox_' . $editor_id) . ',
					sContainerDiv: ' . JavaScriptEscape($smileyContainer) . ',
					sClickHandler: ' . JavaScriptEscape('oEditorHandle_' . $editor_id . '.insertSmiley') . ',
					oSmileyLocations: {';
        foreach ($context['smileys'] as $location => $smileyRows) {
            $content .= '
						' . $location . ': [';
            foreach ($smileyRows as $smileyRow) {
                $content .= '
							[';
                foreach ($smileyRow['smileys'] as $smiley) {
                    $content .= '
								{
									sCode: ' . JavaScriptEscape($smiley['code']) . ',
									sSrc: ' . JavaScriptEscape($settings['smileys_url'] . '/' . $smiley['filename']) . ',
									sDescription: ' . JavaScriptEscape($smiley['description']) . '
								}' . (empty($smiley['isLast']) ? ',' : '');
                }
                $content .= '
							]' . (empty($smileyRow['isLast']) ? ',' : '');
            }
            $content .= '
						]' . ($location === 'postform' ? ',' : '');
        }
        $content .= '
					},
					sSmileyBoxTemplate: ' . JavaScriptEscape('
						%smileyRows% %moreSmileys%
					') . ',
					sSmileyRowTemplate: ' . JavaScriptEscape('
						<div>%smileyRow%</div>
					') . ',
					sSmileyTemplate: ' . JavaScriptEscape('
						<img src="%smileySource%" align="bottom" alt="%smileyDescription%" title="%smileyDescription%" id="%smileyId%" />
					') . ',
					sMoreSmileysTemplate: ' . JavaScriptEscape('
						<a href="#" id="%moreSmileysId%">[' . (!empty($context['smileys']['postform']) ? $txt['more_smileys'] : $txt['more_smileys_pick']) . ']</a>
					') . ',
					sMoreSmileysLinkId: ' . JavaScriptEscape('moreSmileys_' . $editor_id) . ',
					sMoreSmileysPopupTemplate: ' . JavaScriptEscape('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
						<html>
							<head>
								<title>' . $txt['more_smileys_title'] . '</title>
								<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/css/index' . $context['theme_variant'] . '.css?rc2" />
							</head>
							<body id="help_popup">
								<div class="padding windowbg">
									<h3 class="catbg"><span class="left"></span>
										' . $txt['more_smileys_pick'] . '
									</h3>
									<div class="padding">
										%smileyRows%
									</div>
									<div class="smalltext centertext">
										<a href="#" id="%moreSmileysCloseLinkId%">' . $txt['more_smileys_close_window'] . '</a>
									</div>
								</div>
							</body>
						</html>') . '
				});';
    }
    if (!empty($bbcContainer)) {
        $content .= '
				var oBBCBox_' . $editor_id . ' = new smc_BBCButtonBox({
					sUniqueId: ' . JavaScriptEscape('BBCBox_' . $editor_id) . ',
					sContainerDiv: ' . JavaScriptEscape($bbcContainer) . ',
					sButtonClickHandler: ' . JavaScriptEscape('oEditorHandle_' . $editor_id . '.handleButtonClick') . ',
					sSelectChangeHandler: ' . JavaScriptEscape('oEditorHandle_' . $editor_id . '.handleSelectChange') . ',
					aButtonRows: [';
        // Here loop through the array, printing the images/rows/separators!
        foreach ($context['bbc_tags'] as $i => $buttonRow) {
            $content .= '
						[';
            foreach ($buttonRow as $tag) {
                // Is there a "before" part for this bbc button? If not, it can't be a button!!
                if (isset($tag['before'])) {
                    $content .= '
							{
								sType: \'button\',
								bEnabled: ' . (empty($context['disabled_tags'][$tag['code']]) ? 'true' : 'false') . ',
								sImage: ' . JavaScriptEscape($settings['images_url'] . '/bbc/' . $tag['image'] . '.gif') . ',
								sCode: ' . JavaScriptEscape($tag['code']) . ',
								sBefore: ' . JavaScriptEscape($tag['before']) . ',
								sAfter: ' . (isset($tag['after']) ? JavaScriptEscape($tag['after']) : 'null') . ',
								sDescription: ' . JavaScriptEscape($tag['description']) . '
							}' . (empty($tag['isLast']) ? ',' : '');
                } else {
                    $content .= '
							{
								sType: \'divider\'
							}' . (empty($tag['isLast']) ? ',' : '');
                }
            }
            // Add the select boxes to the first row.
            if ($i == 0) {
                // Show the font drop down...
                if (!isset($context['disabled_tags']['font'])) {
                    $content .= ',
							{
								sType: \'select\',
								sName: \'sel_face\',
								oOptions: {
									\'\': ' . JavaScriptEscape($txt['font_face']) . ',
									\'courier\': \'Courier\',
									\'arial\': \'Arial\',
									\'arial black\': \'Arial Black\',
									\'impact\': \'Impact\',
									\'verdana\': \'Verdana\',
									\'times new roman\': \'Times New Roman\',
									\'georgia\': \'Georgia\',
									\'andale mono\': \'Andale Mono\',
									\'trebuchet ms\': \'Trebuchet MS\',
									\'comic sans ms\': \'Comic Sans MS\'
								}
							}';
                }
                // Font sizes anyone?
                if (!isset($context['disabled_tags']['size'])) {
                    $content .= ',
							{
								sType: \'select\',
								sName: \'sel_size\',
								oOptions: {
									\'\': ' . JavaScriptEscape($txt['font_size']) . ',
									\'1\': \'8pt\',
									\'2\': \'10pt\',
									\'3\': \'12pt\',
									\'4\': \'14pt\',
									\'5\': \'18pt\',
									\'6\': \'24pt\',
									\'7\': \'36pt\'
								}
							}';
                }
                // Print a drop down list for all the colors we allow!
                if (!isset($context['disabled_tags']['color'])) {
                    $content .= ',
							{
								sType: \'select\',
								sName: \'sel_color\',
								oOptions: {
									\'\': ' . JavaScriptEscape($txt['change_color']) . ',
									\'black\': ' . JavaScriptEscape($txt['black']) . ',
									\'red\': ' . JavaScriptEscape($txt['red']) . ',
									\'yellow\': ' . JavaScriptEscape($txt['yellow']) . ',
									\'pink\': ' . JavaScriptEscape($txt['pink']) . ',
									\'green\': ' . JavaScriptEscape($txt['green']) . ',
									\'orange\': ' . JavaScriptEscape($txt['orange']) . ',
									\'purple\': ' . JavaScriptEscape($txt['purple']) . ',
									\'blue\': ' . JavaScriptEscape($txt['blue']) . ',
									\'beige\': ' . JavaScriptEscape($txt['beige']) . ',
									\'brown\': ' . JavaScriptEscape($txt['brown']) . ',
									\'teal\': ' . JavaScriptEscape($txt['teal']) . ',
									\'navy\': ' . JavaScriptEscape($txt['navy']) . ',
									\'maroon\': ' . JavaScriptEscape($txt['maroon']) . ',
									\'limegreen\': ' . JavaScriptEscape($txt['lime_green']) . ',
									\'white\': ' . JavaScriptEscape($txt['white']) . '
								}
							}';
                }
            }
            $content .= '
						]' . ($i == count($context['bbc_tags']) - 1 ? '' : ',');
        }
        $content .= '
					],
					sButtonTemplate: ' . JavaScriptEscape('
						<img id="%buttonId%" src="%buttonSrc%" align="bottom" width="23" height="22" alt="%buttonDescription%" title="%buttonDescription%" />
					') . ',
					sButtonBackgroundImage: ' . JavaScriptEscape($settings['images_url'] . '/bbc/bbc_bg.gif') . ',
					sButtonBackgroundImageHover: ' . JavaScriptEscape($settings['images_url'] . '/bbc/bbc_hoverbg.gif') . ',
					sActiveButtonBackgroundImage: ' . JavaScriptEscape($settings['images_url'] . '/bbc/bbc_hoverbg.gif') . ',
					sDividerTemplate: ' . JavaScriptEscape('
						<img src="' . $settings['images_url'] . '/bbc/divider.gif" alt="|" style="margin: 0 3px 0 3px;" />
					') . ',
					sSelectTemplate: ' . JavaScriptEscape('
						<select name="%selectName%" id="%selectId%" style="margin-bottom: 1ex; font-size: x-small;">
							%selectOptions%
						</select>
					') . ',
					sButtonRowTemplate: ' . JavaScriptEscape('
						<div>%buttonRow%</div>
					') . '
				});';
    }
    // Now it's all drawn out we'll actually setup the box.
    $content .= '
				var oEditorHandle_' . $editor_id . ' = new smc_Editor({
					sSessionId: ' . JavaScriptEscape($context['session_id']) . ',
					sSessionVar: ' . JavaScriptEscape($context['session_var']) . ',
					sFormId: ' . JavaScriptEscape($editor_context['form']) . ',
					sUniqueId: ' . JavaScriptEscape($editor_id) . ',
					bWysiwyg: ' . ($editor_context['rich_active'] ? 'true' : 'false') . ',
					sText: ' . JavaScriptEscape($editor_context['rich_active'] ? $editor_context['rich_value'] : '') . ',
					sEditWidth: ' . JavaScriptEscape($editor_context['width']) . ',
					sEditHeight: ' . JavaScriptEscape($editor_context['height']) . ',
					bRichEditOff: ' . (empty($modSettings['disable_wysiwyg']) ? 'false' : 'true') . ',
					oSmileyBox: ' . (!empty($context['smileys']['postform']) && !$editor_context['disable_smiley_box'] && $smileyContainer !== null ? 'oSmileyBox_' . $editor_id : 'null') . ',
					oBBCBox: ' . ($context['show_bbc'] && $bbcContainer !== null ? 'oBBCBox_' . $editor_id : 'null') . '
				});
				smf_editorArray[smf_editorArray.length] = oEditorHandle_' . $editor_id . ';';
    $content .= '
			// ]]></script>';
    return $content;
}
function template_ticket_additional_options()
{
    global $context, $options, $txt, $modSettings, $settings;
    echo '
					<div class="information shd_reply_attachments" id="shd_attach_container"', !empty($context['shd_display']) ? ' style="display:none;"' : '', '>
						<ul class="post_options">';
    foreach ($context['ticket_form']['additional_opts'] as $key => $details) {
        if (!empty($details['show'])) {
            echo '
							<li><label for="', $key, '"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($details['checked']) ? ' checked="checked"' : '', ' value="1" class="input_check" /> ', $details['text'], '</label></li>';
        }
    }
    echo '
						</ul>
						<hr />';
    if (empty($context['current_attachments']) && empty($context['ticket_form']['do_attach'])) {
        echo '
					</div>';
        return;
    }
    if (!empty($context['current_attachments'])) {
        echo '
						<dl id="postAttachment">
							<dt>
								', $txt['attached'], ':
							</dt>';
        $can_delete = false;
        foreach ($context['current_attachments'] as $attachment) {
            if (!empty($attachment['can_delete'])) {
                $can_delete = true;
            }
            break;
        }
        if ($can_delete) {
            echo '
							<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" onclick="javascript:oAttach.checkActive();" /> ', $attachment['name'], '</label>
							</dd>';
            }
        } else {
            foreach ($context['current_attachments'] as $attachment) {
                echo '
							<dd class="smalltext">', $attachment['name'], '</dd>';
            }
        }
        echo '
						</dl>';
    }
    if (!empty($context['ticket_form']['do_attach'])) {
        // JS for our pretty widget
        echo '
						<dl id="postAttachment2">
							<dt>
								', $txt['attach'], ':
							</dt>
							<dd class="smalltext">
								<input type="file" size="60" name="attachment" id="shd_attach" class="input_file" />
								<div id="shd_attachlist_container"></div>
							</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 />';
        }
        echo '
							</dd>
						</dl>';
        template_singleton_email();
        echo '
					</div>
					<script type="text/javascript"><!-- // --><![CDATA[
	var oAttach = new shd_attach_select({
		file_item: "shd_attach",
		file_container: "shd_attachlist_container",
		max: ', $context['ticket_form']['num_allowed_attachments'], ',
		message_txt_delete: ', JavaScriptEscape($txt['remove']);
        if (!empty($modSettings['attachmentExtensions']) && !empty($modSettings['attachmentCheckExtensions'])) {
            $ext = explode(',', $modSettings['attachmentExtensions']);
            foreach ($ext as $k => $v) {
                $ext[$k] = JavaScriptEscape($v);
            }
            echo ',
		message_ext_error: ', JavaScriptEscape(str_replace('{attach_exts}', $context['allowed_extensions'], $txt['shd_cannot_attach_ext'])), ',
		attachment_ext: [', implode(',', $ext), ']';
        }
        echo '
	});
					// ]]></script>';
    }
}
Esempio n. 30
0
/**
 * Show the menu up top. Something like [home] [help] [profile] [logout]...
 */
function template_menu()
{
    global $context, $settings, $txt;
    echo '
				<div id="main_menu">
					<ul class="dropmenu" id="menu_nav">';
    // Note: Menu markup has been cleaned up to remove unnecessary spans and classes.
    foreach ($context['menu_buttons'] as $act => $button) {
        echo '
						<li id="button_', $act, '" ', !empty($button['sub_buttons']) ? 'class="subsections"' : '', '>
							<a class="', $button['sub_buttons'] ? 'submenu' : '', !empty($button['active_button']) ? ' active' : '', '" href="', $button['href'], '" ', isset($button['target']) ? 'target="' . $button['target'] . '"' : '', '>', $button['title'], '</a>';
        if (!empty($button['sub_buttons'])) {
            echo '
							<ul>';
            foreach ($button['sub_buttons'] as $childbutton) {
                echo '
								<li ', !empty($childbutton['sub_buttons']) ? 'class="subsections"' : '', '>
									<a href="', $childbutton['href'], '" ', isset($childbutton['target']) ? 'target="' . $childbutton['target'] . '"' : '', '>
								', $childbutton['title'], '</a>';
                // 3rd level menus :)
                if (!empty($childbutton['sub_buttons'])) {
                    echo '
									<ul>';
                    foreach ($childbutton['sub_buttons'] as $grandchildbutton) {
                        echo '
										<li>
											<a href="', $grandchildbutton['href'], '" ', isset($grandchildbutton['target']) ? 'target="' . $grandchildbutton['target'] . '"' : '', '>
										', $grandchildbutton['title'], '
											</a>
										</li>';
                    }
                    echo '
									</ul>';
                }
                echo '
								</li>';
            }
            echo '
							</ul>';
        }
        echo '
						</li>';
    }
    // The upshrink image, right-floated. Yes, I know it takes some space from the menu bar.
    // Menu bar will still accommodate ten buttons on a 1024, with theme set to 90%. That's more than enough.
    // If anyone is terrified of losing 40px out of the menu bar, set your theme to 92% instead of 90%. :P
    echo '
						<li id="collapse_button">
							<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="padding: 4px 9px 3px 9px; display: none;" />
						</li>';
    echo '
					</ul>
				</div>';
    // Define the upper_section toggle in JavaScript.
    // Note that this definition had to be shifted for the js to work with the new markup.
    echo '
				<script><!-- // --><![CDATA[
					var oMainHeaderToggle = new smc_Toggle({
						bToggleEnabled: true,
						bCurrentlyCollapsed: ', empty($context['minmax_preferences']['upshrink']) ? 'false' : 'true', ',
						aSwappableContainers: [
							\'inner_wrap\',
							\'header\'
						],
						aSwapImages: [
							{
								sId: \'upshrink\',
								srcExpanded: smf_images_url + \'/upshrink.png\',
								altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
								srcCollapsed: smf_images_url + \'/upshrink2.png\',
								altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
							}
						],
						oThemeOptions: {
							bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
							sOptionName: \'minmax_preferences\',
							sSessionId: smf_session_id,
							sSessionVar: smf_session_var,
							sAdditionalVars: \';minmax_key=upshrink\'
						},
						oCookieOptions: {
							bUseCookie: smf_member_id == 0 ? true : false,
							sCookieName: \'upshrink\'
						}
					});
				// ]]></script>';
}