function template_editlink() { global $context, $scripturl, $txt, $modSettings, $settings; // Load the spell checker? if ($context['show_spellchecking']) { echo ' <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>'; } echo ' <form name="links" id="links" method="POST" action="' . $scripturl . '?action=links&sa=editlink2"> <table cellspacing="0" align="center" cellpadding="4" class="tborder" width="100%"> <tr> <td width="50%" colspan="2" align="center" class="catbg"> <strong>' . $txt['smflinks_editlink'] . '</strong></td> </tr> <tr> <td width="28%" class="windowbg2"><span class="gen"><strong>' . $txt['smflinks_ctitle'] . '</strong></span></td> <td width="72%" class="windowbg2"><input type="text" name="title" size="64" maxlength="100" value="' . $context['links_link']['title'] . '" /></td> </tr> <tr> <td width="28%" class="windowbg2"><span class="gen"><strong>' . $txt['smflinks_category'] . '</strong></span></td> <td width="72%" class="windowbg2"><select name="catid">'; foreach ($context['links_cats'] as $row2) { echo '<option value="' . $row2['ID_CAT'] . '" ' . ($row2['ID_CAT'] == $context['links_link']['ID_CAT'] ? 'selected="selected" ' : '') . '>' . $row2['title'] . '</option>'; } echo '</select> </td> </tr> <tr> <td width="28%" class="windowbg2"><span class="gen"><strong>' . $txt['smflinks_url'] . '</strong></span></td> <td width="72%" class="windowbg2"><input type="text" name="url" size="64" maxlength="250" value="' . $context['links_link']['url'] . '" /></td> </tr> <tr> <td width="28%" valign="top" class="windowbg2"><span class="gen"><strong>' . $txt['smflinks_description'] . '</strong></span></td> <td width="72%" class="windowbg2">'; if (!empty($modSettings['smflinks_setallowbbc'])) { echo '<table>'; theme_postbox($context['links_link']['description']); echo '</table>'; } else { // No BBC echo ' <textarea rows="6" name="description" cols="54">' . $context['links_link']['description'] . '</textarea><br />'; } if ($context['show_spellchecking']) { echo ' <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'links\', \'description\');" />'; } echo ' </td> </tr> <tr> <td width="28%" colspan="2" align="center" class="windowbg2"> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="hidden" value="' . $context['link_id'] . '" name="id" /> <input type="submit" value="' . $txt['smflinks_editlink'] . '" name="submit" /></td> </tr> </table> </form>'; 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>'; } LinksCopyright(); }
function template_send() { global $context, $settings, $options, $scripturl, $modSettings, $txt; if ($context['show_spellchecking']) { echo ' <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>'; } // Show which messages were sent successfully and which failed. if (!empty($context['send_log'])) { echo ' <br /> <table border="0" width="80%" cellspacing="1" cellpadding="3" class="bordercolor" align="center"> <tr class="titlebg"> <td>', $txt['pm_send_report'], '</td> </tr> <tr> <td class="windowbg">'; foreach ($context['send_log']['sent'] as $log_entry) { echo '<span style="color: green">', $log_entry, '</span><br />'; } foreach ($context['send_log']['failed'] as $log_entry) { echo '<span style="color: red">', $log_entry, '</span><br />'; } echo ' </td> </tr> </table><br />'; } // Show the preview of the personal message. if (isset($context['preview_message'])) { echo ' <br /> <table border="0" width="80%" cellspacing="1" cellpadding="3" class="bordercolor" align="center"> <tr class="titlebg"> <td>', $context['preview_subject'], '</td> </tr> <tr> <td class="windowbg"> ', $context['preview_message'], ' </td> </tr> </table><br />'; } // Main message editing box. echo ' <table border="0" width="80%" align="center" cellpadding="3" cellspacing="1" class="bordercolor"> <tr class="titlebg"> <td><img src="', $settings['images_url'], '/icons/im_newmsg.gif" alt="', $txt[321], '" title="', $txt[321], '" /> ', $txt[321], '</td> </tr><tr> <td class="windowbg"> <form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);saveEntities();"> <table border="0" cellpadding="3" width="100%">'; // If there were errors for sending the PM, show them. if (!empty($context['post_error']['messages'])) { echo ' <tr> <td></td> <td align="left"> <b>', $txt['error_while_submitting'], '</b> <div style="color: red; margin: 1ex 0 2ex 3ex;"> ', implode('<br />', $context['post_error']['messages']), ' </div> </td> </tr>'; } // To and bcc. Include a button to search for members. echo ' <tr> <td align="right"><b', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' style="color: red;"' : '', '>', $txt[150], ':</b></td> <td class="smalltext"> <input type="text" name="to" id="to" value="', $context['to'], '" tabindex="', $context['tabindex']++, '" size="40" /> <a href="', $scripturl, '?action=findmember;input=to;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" /></a> <a href="', $scripturl, '?action=findmember;input=to;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);">', $txt['find_members'], '</a> </td> </tr><tr> <td align="right"><b', isset($context['post_error']['bad_bcc']) ? ' style="color: red;"' : '', '>', $txt[1502], ':</b></td> <td class="smalltext"> <input type="text" name="bcc" id="bcc" value="', $context['bcc'], '" tabindex="', $context['tabindex']++, '" size="40" /> <a href="', $scripturl, '?action=findmember;input=bcc;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" /></a> ', $txt[748], ' </td> </tr>'; // Subject of personal message. echo ' <tr> <td align="right"><b', isset($context['post_error']['no_subject']) ? ' style="color: red;"' : '', '>', $txt[70], ':</b></td> <td><input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="40" maxlength="50" /></td> </tr>'; if ($context['visual_verification']) { echo ' <tr> <td align="right" valign="top"> <b>', $txt['pm_visual_verification_label'], ':</b> </td> <td>'; if ($context['use_graphic_library']) { echo ' <img src="', $context['verificiation_image_href'], '" alt="', $txt['pm_visual_verification_desc'], '" /><br />'; } else { echo ' <img src="', $context['verificiation_image_href'], ';letter=1" alt="', $txt['pm_visual_verification_desc'], '" /> <img src="', $context['verificiation_image_href'], ';letter=2" alt="', $txt['pm_visual_verification_desc'], '" /> <img src="', $context['verificiation_image_href'], ';letter=3" alt="', $txt['pm_visual_verification_desc'], '" /> <img src="', $context['verificiation_image_href'], ';letter=4" alt="', $txt['pm_visual_verification_desc'], '" /> <img src="', $context['verificiation_image_href'], ';letter=5" alt="', $txt['pm_visual_verification_desc'], '" /><br />'; } echo ' <a href="', $context['verificiation_image_href'], ';sound" onclick="return reqWin(this.href, 400, 120);">', $txt['pm_visual_verification_listen'], '</a><br /><br /> <input type="text" name="visual_verification_code" size="30" tabindex="', $context['tabindex']++, '" /> <div class="smalltext">', $txt['pm_visual_verification_desc'], '</div> </td> </tr>'; } // Show BBC buttons, smileys and textbox. theme_postbox($context['message']); // Send, Preview, spellcheck buttons. echo ' <tr> <td align="right" colspan="2"> <input type="submit" value="', $txt[148], '" tabindex="', $context['tabindex']++, '" onclick="return submitThisOnce(this);" accesskey="s" /> <input type="submit" name="preview" value="', $txt[507], '" tabindex="', $context['tabindex']++, '" onclick="return submitThisOnce(this);" accesskey="p" />'; if ($context['show_spellchecking']) { echo ' <input type="button" value="', $txt['spell_check'], '" tabindex="', $context['tabindex']++, '" onclick="spellCheck(\'postmodify\', \'message\');" />'; } echo ' </td> </tr> <tr> <td></td> <td align="left"> <label for="outbox"><input type="checkbox" name="outbox" id="outbox" value="1" tabindex="', $context['tabindex']++, '"', $context['copy_to_outbox'] ? ' checked="checked"' : '', ' class="check" /> ', $txt['pm_save_outbox'], '</label> </td> </tr> </table> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" /> <input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" /> <input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" /> <input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" /> </form> </td> </tr> </table>'; // Some hidden information is needed in order to make the spell checking work. if ($context['show_spellchecking']) { echo ' <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value="" /></form>'; } // Show the message you're replying to. if ($context['reply']) { echo ' <br /> <br /> <table width="100%" border="0" cellspacing="1" cellpadding="4" class="bordercolor"> <tr> <td colspan="2" class="windowbg"><b>', $txt[319], ': ', $context['quoted_message']['subject'], '</b></td> </tr> <tr> <td class="windowbg2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="windowbg2">', $txt[318], ': ', $context['quoted_message']['member']['name'], '</td> <td class="windowbg2" align="right">', $txt[30], ': ', $context['quoted_message']['time'], '</td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="windowbg">', $context['quoted_message']['body'], '</td> </tr> </table>'; } echo ' <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ function autocompleter(element) { if (typeof(element) != "object") element = document.getElementById(element); this.element = element; this.key = null; this.request = null; this.source = null; this.lastSearch = ""; this.oldValue = ""; this.cache = []; this.change = function (ev, force) { if (window.event) this.key = window.event.keyCode + 0; else this.key = ev.keyCode + 0; if (this.key == 27) return true; if (this.key == 34 || this.key == 8 || this.key == 13 || (this.key >= 37 && this.key <= 40)) force = false; if (isEmptyText(this.element)) return true; if (this.request != null && typeof(this.request) == "object") this.request.abort(); var element = this.element, search = this.element.value.replace(/^("[^"]+",[ ]*)+/, "").replace(/^([^,]+,[ ]*)+/, ""); this.oldValue = this.element.value.substr(0, this.element.value.length - search.length); if (search.substr(0, 1) == \'"\') search = search.substr(1); if (search == "" || search.substr(search.length - 1) == \'"\') return true; if (this.lastSearch == search) { if (force) this.select(this.cache[0]); return true; } else if (search.substr(0, this.lastSearch.length) == this.lastSearch && this.cache.length != 100) { // Instead of hitting the server again, just narrow down the results... var newcache = [], j = 0; for (var k = 0; k < this.cache.length; k++) { if (this.cache[k].substr(0, search.length) == search) newcache[j++] = this.cache[k]; } if (newcache.length != 0) { this.lastSearch = search; this.cache = newcache; if (force) this.select(newcache[0]); return true; } } this.request = new XMLHttpRequest(); this.request.onreadystatechange = function () { element.autocompleter.handler(force); } this.request.open("GET", this.source + escape(textToEntities(search).replace(/&#(\\d+);/g, "%#$1%")).replace(/%26/g, "%25%23038%25") + ";" + (new Date().getTime()), true); this.request.send(null); return true; } this.keyup = function (ev) { this.change(ev, true); return true; } this.keydown = function () { if (this.request != null && typeof(this.request) == "object") this.request.abort(); } this.handler = function (force) { if (this.request.readyState != 4) return true; var response = this.request.responseText.split("\\n"); this.lastSearch = this.element.value; this.cache = response; if (response.length < 2) return true; if (force) this.select(response[0]); return true; } this.select = function (value) { if (value == "") return; var i = this.element.value.length + (this.element.value.substr(this.oldValue.length, 1) == \'"\' ? 0 : 1); this.element.value = this.oldValue + \'"\' + value + \'"\'; if (typeof(this.element.createTextRange) != "undefined") { var d = this.element.createTextRange(); d.moveStart("character", i); d.select(); } else if (this.element.setSelectionRange) { this.element.focus(); this.element.setSelectionRange(i, this.element.value.length); } } this.element.autocompleter = this; this.element.setAttribute("autocomplete", "off"); this.element.onchange = function (ev) { this.autocompleter.change(ev); } this.element.onkeyup = function (ev) { this.autocompleter.keyup(ev); } this.element.onkeydown = function (ev) { this.autocompleter.keydown(ev); } } if (window.XMLHttpRequest) { var toComplete = new autocompleter("to"), bccComplete = new autocompleter("bcc"); toComplete.source = "', $scripturl, '?action=requestmembers;sesc=', $context['session_id'], ';search="; bccComplete.source = "', $scripturl, '?action=requestmembers;sesc=', $context['session_id'], ';search="; } function saveEntities() { var textFields = ["subject", "message"]; for (i in textFields) if (document.forms.postmodify.elements[textFields[i]]) document.forms.postmodify[textFields[i]].value = document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#"); } // ]]></script>'; }
function template_editpost() { global $context, $txt, $scripturl, $settings; echo ' <table border="0" width="80%" cellspacing="0" align="center" cellpadding="4" class="tborder"> <tr class="titlebg"> <td>', $txt['postscheduler_editpost'], '</td> </tr> <tr class="windowbg"> <td> <form method="post" action="', $scripturl, '?action=postscheduler;sa=editpost2" name="frmfeed"> <table border="0" width="100%" cellspacing="0" align="center" cellpadding="4"> <tr> <td width="30%">', $txt['postscheduler_subject'], '</td><td><input type="text" name="subject" size="50" value="' . $context['schedulepost']['subject'] . '" /></td> </tr> <tr> <td width="30%">' . $txt['postscheduler_date'] . '</td> <td> '; $day = date("j", $context['schedulepost']['post_time']); $month = date("n", $context['schedulepost']['post_time']); $year = date("Y", $context['schedulepost']['post_time']); $minute = date("i", $context['schedulepost']['post_time']); $ampm = date("a", $context['schedulepost']['post_time']); $hour = date("g", $context['schedulepost']['post_time']); echo '<select name="month"> <option value="0"></option>'; for ($i = 1; $i < 13; $i++) { echo '<option value="' . $i . '" ' . ($i == $month ? ' selected="selected" ' : '') . '>' . date("M", mktime(0, 0, 0, $i + 1, 0, 0)) . '</option>'; } echo ' </select> <select name="day"> <option value="0"></option> '; for ($i = 1; $i < 32; $i++) { echo '<option value="' . $i . '" ' . ($i == $day ? ' selected="selected" ' : '') . '>' . $i . '</option>'; } echo ' </select> <select name="year"> <option value="0"></option> '; for ($i = date("Y"); $i < date("Y") + 3; $i++) { echo '<option value="' . $i . '" ' . ($i == $year ? ' selected="selected" ' : '') . '>' . $i . '</option>'; } echo ' </select>'; echo '<select name="hour">'; for ($i = 1; $i < 13; $i++) { echo '<option value="' . $i . '" ' . ($i == $hour ? ' selected="selected" ' : '') . '>' . $i . '</option>'; } echo ' </select>'; echo '<select name="minute">'; for ($i = 0; $i < 60; $i++) { echo '<option value="' . $i . '" ' . ($i == $minute ? ' selected="selected" ' : '') . '>' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>'; } echo ' </select> <select name="ampm"> <option value="am" ' . ('am' == $ampm ? ' selected="selected" ' : '') . '>AM</option> <option value="pm" ' . ('pm' == $ampm ? ' selected="selected" ' : '') . '>PM</option> </select> </td> </tr> <tr> <td width="30%">', $txt['postscheduler_topicid'], '</td><td><input type="text" name="topicid" size="10" value="' . $context['schedulepost']['ID_TOPIC'] . '" /></td></tr> <tr> <td width="30%">', $txt['postscheduler_forum'], '</td> <td><select name="boardselect" id="boardselect"> '; foreach ($context['schedule_boards'] as $key => $option) { echo '<option value="', $key, ' " ', $key == $context['schedulepost']['ID_BOARD'] ? ' selected="selected" ' : '', '>', $option, '</option>'; } echo '</select></td></tr> <tr> <td width="30%">', $txt['postscheduler_msg_icon'], '</td><td> <select name="msgicon" id="msgicon" onchange="ChangeIconPic(this.value)"> '; foreach ($context['msg_icons'] as $key => $option) { echo '<option value="', $option['filename'], '"' . ($context['schedulepost']['msgicon'] == $option['filename'] ? ' selected="selected"' : '') . '>', $option['title'], '</option>'; } echo '</select> <img id="iconPick" src="" alter="" /> <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ // iconSelect var selectIcons = new Array(); '; foreach ($context['msg_icons'] as $key => $option) { echo ' selectIcons["', $option['filename'], '"] = "', $settings[file_exists($settings['theme_dir'] . '/images/post/' . $option['filename'] . '.gif') ? 'actual_images_url' : 'default_images_url'] . '/post/' . $option['filename'] . '.gif' . '";'; } echo ' function ChangeIconPic(iconIndex) { document.frmfeed.iconPick.src = selectIcons[iconIndex]; } ChangeIconPic("' . $context['schedulepost']['msgicon'] . '"); // ]]></script> </td> </tr> <tr> <td width="30%">', $txt['postscheduler_postername'], '</td><td><input type="text" name="postername" id="postername" value="' . $context['schedulepost']['postername'] . '" /><a href="', $scripturl, '?action=findmember;input=postername;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" /></a> <a href="', $scripturl, '?action=findmember;input=postername;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);">', $txt['find_members'], '</a> </td> </tr> <tr> <td colspan="2" align="center"> <table> '; theme_postbox($context['schedulepost']['body']); echo '</table> </td> </tr> <tr> <td width="30%" align="right"><input type="checkbox" name="topiclocked" ', $context['schedulepost']['locked'] ? ' checked="checked" ' : '', ' /></td><td>', $txt['postscheduler_topiclocked'], '</td></tr> <tr> <td colspan="2" align="center"> <input type="hidden" name="id" value="', $context['schedulepost']['ID_POST'], '" /> <input type="submit" name="editpost" value="', $txt['postscheduler_editpost'], '" /> <input type="hidden" name="sc" value="', $context['session_id'], '" /> </td> </tr> </table> </form> </td> </tr> </table>'; schedulercopyright(); }
function template_commentsedit() { global $db_prefix, $context, $scripturl, $txt, $settings; //Get the comment id $id = (int) $_REQUEST['id']; if (empty($id)) { fatal_error($txt['pcomments_err_nocom']); } $dbresult = db_query("\n\tSELECT \n\t\tp.ID_COMMENT, p.ID_MEMBER, p.comment, p.subject, p.date, p.COMMENT_MEMBER_ID \n\tFROM {$db_prefix}profile_comments as p \n\tWHERE p.ID_COMMENT = {$id} LIMIT 1", __FILE__, __LINE__); $row = mysql_fetch_assoc($dbresult); mysql_free_result($dbresult); // Load the spell checker? if ($context['show_spellchecking']) { echo ' <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>'; } echo '<div class="tborder"> <form method="POST" name="cprofile" id="cprofile" action="', $scripturl, '?action=comment&sa=edit2"> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" width="100%" > <tr> <td width="50%" colspan="2" align="center" class="catbg"> <b>', $txt['pcomments_editcomment'], '</b></td> </tr> <tr> <td width="28%" class="windowbg2" align="right"><span class="gen"><b>', $txt['pcomments_subject'], '</b></span></td> <td width="72%" class="windowbg2"><input type="text" name="subject" size="64" maxlength="100" value="', $row['subject'], '" /></td> </tr> <tr> <td width="28%" valign="top" class="windowbg2" align="right"><span class="gen"><b>', $txt['pcomments_acomment'], '</b></span></td> <td width="72%" class="windowbg2"> <table> '; theme_postbox($row['comment']); echo '</table></td> </tr> <tr> <td width="28%" colspan="2" align="center" class="windowbg2"> <input type="hidden" name="commentid" value="', $row['ID_COMMENT'], '" />'; // Check if comments are autoapproved if (allowedTo('pcomments_autocomment') == false) { echo $txt['pcomments_text_commentwait'] . '<br />'; } if ($context['show_spellchecking']) { echo ' <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'cprofile\', \'comment\');" />'; } echo ' <input type="submit" value="', $txt['pcomments_editcomment'], '" name="submit" /></td> </tr> </table> </form>'; if ($context['show_spellchecking']) { if (function_exists('parse_bbc')) { 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>'; } else { echo '<form name="spell_form" id="spell_form" method="post" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spell_formname" value="" /><input type="hidden" name="spell_fieldname" value="" /><input type="hidden" name="spellstring" value="" /></form>'; } } echo '</div>'; ProfileCommentsCopyright(); }
function template_main() { global $context, $settings, $options, $txt, $scripturl, $modSettings; if ($context['show_spellchecking']) { echo ' <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>'; } // Start the javascript... and boy is there a lot. echo ' <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA['; // Start with message icons - and any missing from this theme. echo ' var icon_urls = {'; foreach ($context['icons'] as $icon) { echo ' "', $icon['value'], '": "', $icon['url'], '"', $icon['is_last'] ? '' : ','; } echo ' };'; // The actual message icon selector. echo ' function showimage() { document.images.icons.src = icon_urls[document.forms.postmodify.icon.options[document.forms.postmodify.icon.selectedIndex].value]; }'; // The functions used to preview a posts without loading a new page. echo ' var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], '; var make_poll = ', $context['make_poll'] ? 'true' : 'false', '; var txt_preview_title = "', $txt['preview_title'], '"; var txt_preview_fetch = "', $txt['preview_fetch'], '"; function previewPost() { if (window.XMLHttpRequest) {', $context['browser']['is_firefox'] ? ' // Firefox doesn\'t render <marquee> that have been put it using javascript if (document.forms.postmodify.elements["message"].value.indexOf("[move]") != -1) { return submitThisOnce(document.forms.postmodify); }' : '', ' // Opera didn\'t support setRequestHeader() before 8.01. if (typeof(window.opera) != "undefined") { var test = new XMLHttpRequest(); if (typeof(test.setRequestHeader) != "function") return submitThisOnce(document.forms.postmodify); } // !!! Currently not sending poll options and option checkboxes. var i, x = new Array(); var textFields = ["subject", "message", "icon", "guestname", "email", "evtitle", "question", "topic"]; var numericFields = [ "board", "topic", "num_replies", "eventid", "calendar", "year", "month", "day", "poll_max_votes", "poll_expire", "poll_change_vote", "poll_hide" ]; var checkboxFields = [ "ns", ]; for (i in textFields) if (document.forms.postmodify.elements[textFields[i]]) x[x.length] = textFields[i] + "=" + escape(textToEntities(document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#"))).replace(/\\+/g, "%2B"); for (i in numericFields) if (document.forms.postmodify.elements[numericFields[i]] && typeof(document.forms.postmodify[numericFields[i]].value) != "undefined") x[x.length] = numericFields[i] + "=" + parseInt(document.forms.postmodify.elements[numericFields[i]].value); for (i in checkboxFields) if (document.forms.postmodify.elements[checkboxFields[i]] && document.forms.postmodify.elements[checkboxFields[i]].checked) x[x.length] = checkboxFields[i] + "=" + document.forms.postmodify.elements[checkboxFields[i]].value; sendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent); document.getElementById("preview_section").style.display = ""; setInnerHTML(document.getElementById("preview_subject"), txt_preview_title); setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch); return false; } else return submitThisOnce(document.forms.postmodify); } function onDocSent(XMLDoc) { if (!XMLDoc) { document.forms.postmodify.preview.onclick = new function () { return true; } document.forms.postmodify.preview.click(); } // Show the preview section. var i, preview = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("preview")[0]; setInnerHTML(document.getElementById("preview_subject"), preview.getElementsByTagName("subject")[0].firstChild.nodeValue); var bodyText = ""; for (i = 0; i < preview.getElementsByTagName("body")[0].childNodes.length; i++) bodyText += preview.getElementsByTagName("body")[0].childNodes[i].nodeValue; setInnerHTML(document.getElementById("preview_body"), bodyText); document.getElementById("preview_body").className = "post"; // Show a list of errors (if any). var errors = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("errors")[0]; var numErrors = errors.getElementsByTagName("error").length, errorList = new Array(); for (i = 0; i < numErrors; i++) errorList[errorList.length] = errors.getElementsByTagName("error")[i].firstChild.nodeValue; document.getElementById("errors").style.display = numErrors == 0 ? "none" : ""; document.getElementById("error_serious").style.display = errors.getAttribute("serious") == 1 ? "" : "none"; setInnerHTML(document.getElementById("error_list"), numErrors == 0 ? "" : errorList.join("<br />")); // Show a warning if the topic has been locked. document.getElementById("lock_warning").style.display = errors.getAttribute("topic_locked") == 1 ? "" : "none"; // Adjust the color of captions if the given data is erroneous. var captions = errors.getElementsByTagName("caption"), numCaptions = errors.getElementsByTagName("caption").length; for (i = 0; i < numCaptions; i++) if (document.getElementById("caption_" + captions[i].getAttribute("name"))) document.getElementById("caption_" + captions[i].getAttribute("name")).style.color = captions[i].getAttribute("color"); if (errors.getElementsByTagName("post_error").length == 1) document.forms.postmodify.message.style.border = "1px solid red"; else if (document.forms.postmodify.message.style.borderColor == "red" || document.forms.postmodify.message.style.borderColor == "red red red red") { if (typeof(document.forms.postmodify.message.runtimeStyle) == "undefined") document.forms.postmodify.message.style.border = null; else document.forms.postmodify.message.style.borderColor = ""; } // Set the new number of replies. if (document.forms.postmodify.elements["num_replies"]) document.forms.postmodify.num_replies.value = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("num_replies")[0].firstChild.nodeValue; var newPosts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0] ? XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0].getElementsByTagName("post") : {length: 0}; var numNewPosts = newPosts.length; if (numNewPosts != 0) { var newTable = \'<span id="new_replies"></span><table width="100%" class="windowbg" cellspacing="0" cellpadding="2" align="center" style="table-layout: fixed;">\'; for (i = 0; i < numNewPosts; i++) newTable += \'<tr class="catbg"><td colspan="2" align="left" class="smalltext"><div style="float: right;">', $txt[280], ': \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \' <img src="\' + smf_images_url + \'/', $context['user']['language'], '/new.gif" alt="', $txt['preview_new'], '" /></div>', $txt[279], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</td></tr><tr class="windowbg2"><td colspan="2" class="smalltext" id="msg\' + newPosts[i].getAttribute("id") + \'" width="100%"><div align="right" class="smalltext"><a href="#top" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');">', $txt[260], '</a></div><div class="post">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'</div></td></tr>\'; newTable += \'</table>\'; setOuterHTML(document.getElementById("new_replies"), newTable); } if (typeof(smf_codeFix) != "undefined") smf_codeFix(); }'; // A function needed to discern HTML entities from non-western characters. echo ' function saveEntities() { var textFields = ["subject", "message", "guestname", "evtitle", "question"]; for (i in textFields) if (document.forms.postmodify.elements[textFields[i]]) document.forms.postmodify[textFields[i]].value = document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#"); for (var i = document.forms.postmodify.elements.length - 1; i >= 0; i--) if (document.forms.postmodify.elements[i].name.indexOf("options") == 0) document.forms.postmodify.elements[i].value = document.forms.postmodify.elements[i].value.replace(/&#/g, "&#"); }'; // Code for showing and hiding additional options. if (!empty($settings['additional_options_collapsable'])) { echo ' var currentSwap = false; function swapOptions() { document.getElementById("postMoreExpand").src = smf_images_url + "/" + (currentSwap ? "collapse.gif" : "expand.gif"); document.getElementById("postMoreExpand").alt = currentSwap ? "-" : "+"; document.getElementById("postMoreOptions").style.display = currentSwap ? "" : "none"; if (document.getElementById("postAttachment")) document.getElementById("postAttachment").style.display = currentSwap ? "" : "none"; if (document.getElementById("postAttachment2")) document.getElementById("postAttachment2").style.display = currentSwap ? "" : "none"; if (typeof(document.forms.postmodify) != "undefined") document.forms.postmodify.additional_options.value = currentSwap ? "1" : "0"; currentSwap = !currentSwap; }'; } // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations. if ($context['make_poll']) { echo ' function pollOptions() { var expireTime = document.getElementById("poll_expire"); if (isEmptyText(expireTime) || expireTime.value == 0) { document.forms.postmodify.poll_hide[2].disabled = true; if (document.forms.postmodify.poll_hide[2].checked) document.forms.postmodify.poll_hide[1].checked = true; } else document.forms.postmodify.poll_hide[2].disabled = false; } var pollOptionNum = 0, pollTabIndex; function addPollOption() { if (pollOptionNum == 0) { for (var i = 0; i < document.forms.postmodify.elements.length; i++) if (document.forms.postmodify.elements[i].id.substr(0, 8) == "options-") { pollOptionNum++; pollTabIndex = document.forms.postmodify.elements[i].tabIndex; } } pollOptionNum++ setOuterHTML(document.getElementById("pollMoreOptions"), \'<br /><label for="options-\' + pollOptionNum + \'">', $txt['smf22'], ' \' + pollOptionNum + \'</label>: <input type="text" name="options[\' + pollOptionNum + \']" id="options-\' + pollOptionNum + \'" value="" size="25" tabindex="\' + pollTabIndex + \'" /><span id="pollMoreOptions"></span>\'); }'; } // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here. if ($context['make_event']) { echo ' var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; function generateDays() { var dayElement = document.getElementById("day"), yearElement = document.getElementById("year"), monthElement = document.getElementById("month"); var days, selected = dayElement.selectedIndex; monthLength[1] = yearElement.options[yearElement.selectedIndex].value % 4 == 0 ? 29 : 28; days = monthLength[monthElement.value - 1]; while (dayElement.options.length) dayElement.options[0] = null; for (i = 1; i <= days; i++) dayElement.options[dayElement.length] = new Option(i, i); if (selected < days) dayElement.selectedIndex = selected; }'; } // End of the javascript, start the form and display the link tree. echo ' // ]]></script> <form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" onsubmit="submitonce(this);saveEntities();" enctype="multipart/form-data" style="margin: 0;"> <table width="100%" align="center" cellpadding="0" cellspacing="3"> <tr> <td valign="bottom" colspan="2"> ', theme_linktree(), ' </td> </tr> </table>'; // If the user wants to see how their message looks - the preview table is where it's at! echo ' <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '> <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor" align="center" style="table-layout: fixed;"> <tr class="titlebg"> <td id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</td> </tr> <tr> <td class="post" width="100%" id="preview_body"> ', empty($context['preview_message']) ? str_repeat('<br />', 5) : $context['preview_message'], ' </td> </tr> </table><br /> </div>'; if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) { echo ' <input type="hidden" name="eventid" value="', $context['event']['id'], '" />'; } // Start the main table. echo ' <table border="0" width="100%" align="center" cellspacing="1" cellpadding="3" class="bordercolor"> <tr class="titlebg"> <td>', $context['page_title'], '</td> </tr> <tr> <td class="windowbg">', isset($context['current_topic']) ? ' <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', ' <table border="0" cellpadding="3" width="100%">'; // If an error occurred, explain what happened. echo ' <tr', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors"> <td></td> <td align="left"> <div style="padding: 0px; font-weight: bold;', empty($context['error_type']) || $context['error_type'] != 'serious' ? ' display: none;' : '', '" id="error_serious"> ', $txt['error_while_submitting'], ' </div> <div style="color: red; margin: 1ex 0 2ex 3ex;" id="error_list"> ', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), ' </div> </td> </tr>'; // If it's locked, show a message to warn the replyer. echo ' <tr', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning"> <td></td> <td align="left"> ', $txt['smf287'], ' </td> </tr>'; // Guests have to put in their name and email... if (isset($context['name']) && isset($context['email'])) { echo ' <tr> <td align="right" style="font-weight: bold;', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? 'color: red;' : '', '" id="caption_guestname"> ', $txt[68], ': </td> <td> <input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" /> </td> </tr>'; if (empty($modSettings['guest_post_no_email'])) { echo ' <tr> <td align="right" style="font-weight: bold;', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? 'color: red;' : '', '" id="caption_email"> ', $txt[69], ': </td> <td> <input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" /> </td> </tr>'; } } // Are you posting a calendar event? if ($context['make_event']) { echo ' <tr> <td align="right" style="font-weight: bold;', isset($context['post_error']['no_event']) ? 'color: red;' : '', '" id="caption_evtitle"> ', $txt['calendar12'], ' </td> <td class="smalltext"> <input type="text" name="evtitle" maxlength="30" size="30" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '" /> </td> </tr><tr> <td></td> <td class="smalltext"> <input type="hidden" name="calendar" value="1" />', $txt['calendar10'], ' <select name="year" id="year" tabindex="', $context['tabindex']++, '" onchange="generateDays();">'; // Show a list of all the years we allow... for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++) { echo ' <option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '</option>'; } echo ' </select> ', $txt['calendar9'], ' <select name="month" id="month" onchange="generateDays();">'; // There are 12 months per year - ensure that they all get listed. for ($month = 1; $month <= 12; $month++) { echo ' <option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '</option>'; } echo ' </select> ', $txt['calendar11'], ' <select name="day" id="day">'; // This prints out all the days in the current month - this changes dynamically as we switch months. for ($day = 1; $day <= $context['event']['last_day']; $day++) { echo ' <option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '</option>'; } echo ' </select> </td> </tr>'; // If events can span more than one day then allow the user to select how long it should last. if (!empty($modSettings['cal_allowspan'])) { echo ' <tr> <td align="right"><b>', $txt['calendar54'], '</b></td> <td class="smalltext"> <select name="span">'; for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++) { echo ' <option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '</option>'; } echo ' </select> </td> </tr>'; } // If this is a new event let the user specify which board they want the linked post to be put into. if ($context['event']['new'] && $context['is_new_post']) { echo ' <tr> <td align="right"><b>', $txt['calendar13'], '</b></td> <td class="smalltext"> <select name="board">'; foreach ($context['event']['boards'] as $board) { echo ' <option value="', $board['id'], '"', $board['id'] == $context['event']['board'] ? ' selected="selected"' : '', '>', $board['cat']['name'], ' - ', $board['prefix'], $board['name'], '</option>'; } echo ' </select> </td> </tr>'; } } // Now show the subject box for this post. echo ' <tr> <td align="right" style="font-weight: bold;', isset($context['post_error']['no_subject']) ? 'color: red;' : '', '" id="caption_subject"> ', $txt[70], ': </td> <td> <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" /> </td> </tr> <tr> <td align="right"> <b>', $txt[71], ':</b> </td> <td> <select name="icon" id="icon" onchange="showimage()">'; // Loop through each message icon allowed, adding it to the drop down list. foreach ($context['icons'] as $icon) { echo ' <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>'; } echo ' </select> <img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" /> </td> </tr>'; // Tagging system // Version 2.4.1+stef if (!isset($context['num_replies']) && in_array($context['current_board'], explode(" ", $modSettings['smftags_set_taggable'])) && (allowedTo('smftags_add') || allowedTo('smftags_suggest_own'))) { if ($modSettings['smftags_set_manualtags']) { echo ' <tr> <td align="right"> <b>', $txt['smftags_topic'], '</b></td> <td> <input type="text" name="tags"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80" /> <br /><span class="smalltext">', sprintf($txt['smftags_separate'], chr($modSettings['smftags_set_delimiter'])), '</span> </td> </tr>'; } if ($modSettings['smftags_set_listtags'] && !empty($context['tags']) && @(include_once $settings['default_theme_dir'] . '/Tags.tree.inc.php')) { echo ' <tr> <td align="right"> <b>', $txt['smftags_topic'], '</b> </td> <td> '; tag_draw_js(); $context['tags']['rows'] = $modSettings['smftags_set_listcols'] < 1 ? 0 : ceil(count($context['tags']['by_parent'][0]) / $modSettings['smftags_set_listcols']); tag_draw_branch(0, 0, 2); if ($modSettings['smftags_set_manualtags']) { echo '<div style="clear:both;"><small>' . $txt['smftags_bothtags'] . '</small>'; } echo ' </td> </tr>'; } } // End Tagging System // If this is a poll then display all the poll options! if ($context['make_poll']) { echo ' <tr> <td align="right" style="font-weight: bold;', isset($context['post_error']['no_question']) ? 'color: red;' : '', '" id="caption_question"> ', $txt['smf21'], ': </td> <td align="left"> <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" /> </td> </tr> <tr> <td align="right"></td> <td>'; // Loop through all the choices and print them out. foreach ($context['choices'] as $choice) { echo ' <label for="options-', $choice['id'], '">', $txt['smf22'], ' ', $choice['number'], '</label>: <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="25" />'; if (!$choice['is_last']) { echo '<br />'; } } echo ' <span id="pollMoreOptions"></span> <a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a> </td> </tr> <tr> <td align="right"><b>', $txt['poll_options'], ':</b></td> <td class="smalltext"><input type="text" name="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" /> ', $txt['poll_options5'], '</td> </tr> <tr> <td align="right"></td> <td class="smalltext">', $txt['poll_options1a'], ' <input type="text" id="poll_expire" name="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" /> ', $txt['poll_options1b'], '</td> </tr> <tr> <td align="right"></td> <td class="smalltext"><label for="poll_change_vote"><input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll_options']['change_vote']) ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options7'], '</label></td> </tr> <tr> <td align="right"></td> <td class="smalltext"> <input type="radio" id="poll_hide" name="poll_hide" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options2'], '<br /> <input type="radio" id="poll_hide" name="poll_hide" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="check" /> ', $txt['poll_options3'], '<br /> <input type="radio" id="poll_hide" name="poll_hide" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? ' disabled="disabled"' : '', ' class="check" /> ', $txt['poll_options4'], '<br /> <br /> </td> </tr>'; } // The below function prints the BBC, smileys and the message itself out. theme_postbox($context['message']); // If this message has been edited in the past - display when it was. if (isset($context['last_modified'])) { echo ' <tr> <td valign="top" align="right"> <b>', $txt[211], ':</b> </td> <td> ', $context['last_modified'], ' </td> </tr>'; } // If the admin has enabled the hiding of the additional options - show a link and image for it. if (!empty($settings['additional_options_collapsable'])) { echo ' <tr> <td colspan="2" style="padding-left: 5ex;"> <a href="javascript:swapOptions();"><img src="', $settings['images_url'], '/expand.gif" alt="+" id="postMoreExpand" /></a> <a href="javascript:swapOptions();"><b>', $txt['post_additionalopt'], '</b></a> </td> </tr>'; } // Display the check boxes for all the standard options - if they are available to the user! echo ' <tr> <td></td> <td> <div id="postMoreOptions"> <table width="80%" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="smalltext">', $context['can_notify'] ? '<input type="hidden" name="notify" value="0" /><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['smf14'] . '</label>' : '', '</td> <td class="smalltext">', $context['can_lock'] ? '<input type="hidden" name="lock" value="0" /><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['smf15'] . '</label>' : '', '</td> </tr> <tr> <td class="smalltext"><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['back_to_topic'] . '</label></td> <td class="smalltext">', $context['can_sticky'] ? '<input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="check" /> ' . $txt['sticky_after2'] . '</label>' : '', '</td> </tr> <tr> <td class="smalltext"><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="check" /> ', $txt[277], '</label></td>', ' <td class="smalltext">', $context['can_move'] ? '<input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="check" /> ' . $txt['move_after2'] . '</label>' : '', '</td> </tr>', $context['can_announce'] && $context['is_first_post'] ? ' <tr> <td class="smalltext"><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="check" /> ' . $txt['announce_topic'] . '</label></td> <td class="smalltext"></td> </tr>' : '', ' </table> </div> </td> </tr>'; // If this post already has attachments on it - give information about them. if (!empty($context['current_attachments'])) { echo ' <tr id="postAttachment"> <td align="right" valign="top"> <b>', $txt['smf119b'], ':</b> </td> <td class="smalltext"> <input type="hidden" name="attach_del[]" value="0" /> ', $txt['smf130'], ':<br />'; foreach ($context['current_attachments'] as $attachment) { echo ' <input type="checkbox" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="check" /> ', $attachment['name'], '<br />'; } echo ' <br /> </td> </tr>'; } // Is the user allowed to post any additional ones? If so give them the boxes to do it! if ($context['can_post_attachment']) { echo ' <tr id="postAttachment2"> <td align="right" valign="top"> <b>', $txt['smf119'], ':</b> </td> <td class="smalltext"> <input type="file" size="48" name="attachment[]" />'; // Show more boxes only if they aren't approaching their limit. if ($context['num_allowed_attachments'] > 1) { echo ' <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ var allowed_attachments = ', $context['num_allowed_attachments'], ' - 1; function addAttachment() { if (allowed_attachments <= 0) return alert("', $txt['more_attachments_error'], '"); setOuterHTML(document.getElementById("moreAttachments"), \'<br /><input type="file" size="48" name="attachment[]" /><span id="moreAttachments"></span>\'); allowed_attachments = allowed_attachments - 1; return true; } // ]]></script> <span id="moreAttachments"></span> <a href="javascript:addAttachment(); void(0);">(', $txt['more_attachments'], ')</a><br /> <noscript><input type="file" size="48" name="attachment[]" /><br /></noscript>'; } else { echo ' <br />'; } // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed. if (!empty($modSettings['attachmentCheckExtensions'])) { echo ' ', $txt['smf120'], ': ', $context['allowed_extensions'], '<br />'; } echo ' ', $txt['smf121'], ': ', $modSettings['attachmentSizeLimit'], ' ' . $txt['smf211'], !empty($modSettings['attachmentNumPerPostLimit']) ? ', ' . $txt['maxAttachPerPost'] . ': ' . $modSettings['attachmentNumPerPostLimit'] : '', ' </td> </tr>'; } // Finally, the submit buttons. echo ' <tr> <td align="center" colspan="2"> <span class="smalltext"><br />', $txt['smf16'], '</span><br /> <input type="submit" name="post" value="', $context['submit_label'], '" tabindex="', $context['tabindex']++, '" onclick="return submitThisOnce(this);" accesskey="s" /> <input type="submit" name="preview" value="', $txt[507], '" tabindex="', $context['tabindex']++, '" onclick="return event.ctrlKey || previewPost();" accesskey="p" />'; // Option to delete an event if user is editing one. if ($context['make_event'] && !$context['event']['new']) { echo ' <input type="submit" name="deleteevent" value="', $txt['calendar22'], '" onclick="return confirm(\'', $txt['calendar21'], '\');" />'; } // Spell check button if the option is enabled. if ($context['show_spellchecking']) { echo ' <input type="button" value="', $txt['spell_check'], '" tabindex="', $context['tabindex']++, '" onclick="spellCheck(\'postmodify\', \'message\');" />'; } echo ' </td> </tr> <tr> <td colspan="2"></td> </tr> </table> </td> </tr> </table>'; // Assuming this isn't a new topic pass across the number of replies when the topic was created. if (isset($context['num_replies'])) { echo ' <input type="hidden" name="num_replies" value="', $context['num_replies'], '" />'; } echo ' <input type="hidden" name="additional_options" value="', $context['show_additional_options'] ? 1 : 0, '" /> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" /> </form>'; // Now some javascript to hide the additional options on load... if (!empty($settings['additional_options_collapsable']) && !$context['show_additional_options']) { echo ' <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ swapOptions(); // ]]></script>'; } // A hidden form to post data to the spell checking window. 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>'; } // If the user is replying to a topic show the previous posts. if (isset($context['previous_posts']) && count($context['previous_posts']) > 0) { echo ' <br /> <br /> <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[ function insertQuoteFast(messageid) { if (window.XMLHttpRequest) getXMLDocument("', $scripturl, '?action=quotefast;quote=" + messageid + ";sesc=', $context['session_id'], ';xml", onDocReceived); else reqWin("', $scripturl, '?action=quotefast;quote=" + messageid + ";sesc=', $context['session_id'], '", 240, 90); return true; } function onDocReceived(XMLDoc) { var text = ""; for (var i = 0; i < XMLDoc.getElementsByTagName("quote")[0].childNodes.length; i++) text += XMLDoc.getElementsByTagName("quote")[0].childNodes[i].nodeValue; replaceText(text, document.forms.postmodify.message); } // ]]></script> <table cellspacing="1" cellpadding="0" width="92%" align="center" class="bordercolor"> <tr> <td> <table width="100%" class="windowbg" cellspacing="0" cellpadding="2" align="center"> <tr class="titlebg"> <td colspan="2">', $txt[468], '</td> </tr> </table> <span id="new_replies"></span> <table width="100%" class="windowbg" cellspacing="0" cellpadding="2" align="center" style="table-layout: fixed;">'; foreach ($context['previous_posts'] as $post) { echo ' <tr class="catbg"> <td colspan="2" align="left" class="smalltext"> <div style="float: right;">', $txt[280], ': ', $post['time'], $post['is_new'] ? ' <img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt['preview_new'] . '" />' : '', '</div> ', $txt[279], ': ', $post['poster'], ' </td> </tr><tr class="windowbg2"> <td colspan="2" class="smalltext" id="msg', $post['id'], '" width="100%"> <div align="right" class="smalltext"><a href="#top" onclick="return insertQuoteFast(', $post['id'], ');">', $txt[260], '</a></div> <div class="post">', $post['message'], '</div> </td> </tr>'; } echo ' </table> </td> </tr> </table>'; } }