Post.template.php 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // The main template for the post page.
  13. function template_main()
  14. {
  15. global $context, $settings, $options, $txt, $scripturl, $modSettings, $counter;
  16. // Start the javascript... and boy is there a lot.
  17. echo '
  18. <script type="text/javascript"><!-- // --><![CDATA[';
  19. // When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
  20. if (isBrowser('is_firefox'))
  21. echo '
  22. window.addEventListener("pageshow", reActivate, false);';
  23. // Start with message icons - and any missing from this theme.
  24. echo '
  25. var icon_urls = {';
  26. foreach ($context['icons'] as $icon)
  27. echo '
  28. \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
  29. echo '
  30. };';
  31. // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
  32. if ($context['make_poll'])
  33. echo '
  34. var pollOptionNum = 0, pollTabIndex;
  35. var pollOptionId = ', $context['last_choice_id'], ';
  36. function addPollOption()
  37. {
  38. if (pollOptionNum == 0)
  39. {
  40. for (var i = 0, n = document.forms.postmodify.elements.length; i < n; i++)
  41. if (document.forms.postmodify.elements[i].id.substr(0, 8) == \'options-\')
  42. {
  43. pollOptionNum++;
  44. pollTabIndex = document.forms.postmodify.elements[i].tabIndex;
  45. }
  46. }
  47. pollOptionNum++
  48. pollOptionId++
  49. setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<li><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>: <input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text" /></li><li id="pollMoreOptions"></li>'), ');
  50. }';
  51. // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
  52. if ($context['make_event'])
  53. echo '
  54. var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
  55. // End of the javascript, start the form and display the link tree.
  56. echo '
  57. // ]]></script>
  58. <form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="', ($context['becomes_approved'] ? '' : 'alert(\'' . $txt['js_post_will_require_approval'] . '\');'), 'submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'', $context['post_box_name'], '\', \'guestname\', \'evtitle\', \'question\'], \'options\');" enctype="multipart/form-data">';
  59. // If the user wants to see how their message looks - the preview section is where it's at!
  60. echo '
  61. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  62. <div class="cat_bar">
  63. <h3 class="catbg">
  64. <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
  65. </h3>
  66. </div>
  67. <div class="windowbg">
  68. <div class="content">
  69. <div class="post" id="preview_body">
  70. ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
  71. </div>
  72. </div>
  73. </div>
  74. </div><br />';
  75. if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
  76. echo '
  77. <input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
  78. // Start the main table.
  79. echo '
  80. <div class="cat_bar">
  81. <h3 class="catbg">', $context['page_title'], '</h3>
  82. </div>
  83. <div>
  84. <div class="roundframe">', isset($context['current_topic']) ? '
  85. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '';
  86. // If an error occurred, explain what happened.
  87. echo '
  88. <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']) ? ' style="display: none"' : '', ' id="errors">
  89. <dl>
  90. <dt>
  91. <strong id="error_serious">', $txt['error_while_submitting'], '</strong>
  92. </dt>
  93. <dd class="error" id="error_list">
  94. ', empty($context['post_error']) ? '' : implode('<br />', $context['post_error']), '
  95. </dd>
  96. </dl>
  97. </div>';
  98. // If this won't be approved let them know!
  99. if (!$context['becomes_approved'])
  100. {
  101. echo '
  102. <p class="information">
  103. <em>', $txt['wait_for_approval'], '</em>
  104. <input type="hidden" name="not_approved" value="1" />
  105. </p>';
  106. }
  107. // If it's locked, show a message to warn the replyer.
  108. echo '
  109. <p class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
  110. ', $txt['topic_locked_no_reply'], '
  111. </p>';
  112. // The post header... important stuff
  113. echo '
  114. <dl id="post_header">';
  115. // Guests have to put in their name and email...
  116. if (isset($context['name']) && isset($context['email']))
  117. {
  118. echo '
  119. <dt>
  120. <span', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? ' class="error"' : '', ' id="caption_guestname">', $txt['name'], ':</span>
  121. </dt>
  122. <dd>
  123. <input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  124. </dd>';
  125. if (empty($modSettings['guest_post_no_email']))
  126. echo '
  127. <dt>
  128. <span', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</span>
  129. </dt>
  130. <dd>
  131. <input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  132. </dd>';
  133. }
  134. // Now show the subject box for this post.
  135. echo '
  136. <dt class="clear">
  137. <span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
  138. </dt>
  139. <dd>
  140. <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
  141. </dd>
  142. <dt class="clear_left">
  143. ', $txt['message_icon'], ':
  144. </dt>
  145. <dd>
  146. <select name="icon" id="icon" onchange="showimage()">';
  147. // Loop through each message icon allowed, adding it to the drop down list.
  148. foreach ($context['icons'] as $icon)
  149. echo '
  150. <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
  151. echo '
  152. </select>
  153. <img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
  154. </dd>
  155. </dl><hr class="clear" />';
  156. // Are you posting a calendar event?
  157. if ($context['make_event'])
  158. {
  159. echo '
  160. <div id="post_event">
  161. <fieldset id="event_main">
  162. <legend><span', isset($context['post_error']['no_event']) ? ' class="error"' : '', ' id="caption_evtitle">', $txt['calendar_event_title'], '</span></legend>
  163. <input type="text" name="evtitle" maxlength="255" size="55" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  164. <div class="smalltext" style="white-space: nowrap;">
  165. <input type="hidden" name="calendar" value="1" />', $txt['calendar_year'], '
  166. <select name="year" id="year" tabindex="', $context['tabindex']++, '" onchange="generateDays();">';
  167. // Show a list of all the years we allow...
  168. for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
  169. echo '
  170. <option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '&nbsp;</option>';
  171. echo '
  172. </select>
  173. ', $txt['calendar_month'], '
  174. <select name="month" id="month" onchange="generateDays();">';
  175. // There are 12 months per year - ensure that they all get listed.
  176. for ($month = 1; $month <= 12; $month++)
  177. echo '
  178. <option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '&nbsp;</option>';
  179. echo '
  180. </select>
  181. ', $txt['calendar_day'], '
  182. <select name="day" id="day">';
  183. // This prints out all the days in the current month - this changes dynamically as we switch months.
  184. for ($day = 1; $day <= $context['event']['last_day']; $day++)
  185. echo '
  186. <option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
  187. echo '
  188. </select>
  189. </div>
  190. </fieldset>';
  191. if (!empty($modSettings['cal_allowspan']) || ($context['event']['new'] && $context['is_new_post']))
  192. {
  193. echo '
  194. <fieldset id="event_options">
  195. <legend>', $txt['calendar_event_options'], '</legend>
  196. <div class="event_options smalltext">
  197. <ul class="event_options">';
  198. // If events can span more than one day then allow the user to select how long it should last.
  199. if (!empty($modSettings['cal_allowspan']))
  200. {
  201. echo '
  202. <li>
  203. ', $txt['calendar_numb_days'], '
  204. <select name="span">';
  205. for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++)
  206. echo '
  207. <option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '&nbsp;</option>';
  208. echo '
  209. </select>
  210. </li>';
  211. }
  212. // If this is a new event let the user specify which board they want the linked post to be put into.
  213. if ($context['event']['new'] && $context['is_new_post'])
  214. {
  215. echo '
  216. <li>
  217. ', $txt['calendar_post_in'], '
  218. <select name="board">';
  219. foreach ($context['event']['categories'] as $category)
  220. {
  221. echo '
  222. <optgroup label="', $category['name'], '">';
  223. foreach ($category['boards'] as $board)
  224. echo '
  225. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
  226. echo '
  227. </optgroup>';
  228. }
  229. echo '
  230. </select>
  231. </li>';
  232. }
  233. echo '
  234. </ul>
  235. </div>
  236. </fieldset>';
  237. }
  238. echo '
  239. </div>';
  240. }
  241. // If this is a poll then display all the poll options!
  242. if ($context['make_poll'])
  243. {
  244. echo '
  245. <div id="edit_poll">
  246. <fieldset id="poll_main">
  247. <legend><span ', (isset($context['poll_error']['no_question']) ? ' class="error"' : ''), '>', $txt['poll_question'], '</span></legend>
  248. <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" />
  249. <ul class="poll_main">';
  250. // Loop through all the choices and print them out.
  251. foreach ($context['choices'] as $choice)
  252. {
  253. echo '
  254. <li>
  255. <label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>:
  256. <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />
  257. </li>';
  258. }
  259. echo '
  260. <li id="pollMoreOptions"></li>
  261. </ul>
  262. <strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong>
  263. </fieldset>
  264. <fieldset id="poll_options">
  265. <legend>', $txt['poll_options'], '</legend>
  266. <dl class="settings poll_options">
  267. <dt>
  268. <label for="poll_max_votes">', $txt['poll_max_votes'], ':</label>
  269. </dt>
  270. <dd>
  271. <input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" class="input_text" />
  272. </dd>
  273. <dt>
  274. <label for="poll_expire">', $txt['poll_run'], ':</label><br />
  275. <em class="smalltext">', $txt['poll_run_limit'], '</em>
  276. </dt>
  277. <dd>
  278. <input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4" class="input_text" /> ', $txt['days_word'], '
  279. </dd>
  280. <dt>
  281. <label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label>
  282. </dt>
  283. <dd>
  284. <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  285. </dd>';
  286. if ($context['poll_options']['guest_vote_enabled'])
  287. echo '
  288. <dt>
  289. <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
  290. </dt>
  291. <dd>
  292. <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  293. </dd>';
  294. echo '
  295. <dt>
  296. ', $txt['poll_results_visibility'], ':
  297. </dt>
  298. <dd>
  299. <input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label><br />
  300. <input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label><br />
  301. <input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? 'disabled="disabled"' : '', ' class="input_radio" /> <label for="poll_results_expire">', $txt['poll_results_after'], '</label>
  302. </dd>
  303. </dl>
  304. </fieldset>
  305. </div>';
  306. }
  307. // Show the actual posting area...
  308. if ($context['show_bbc'])
  309. {
  310. echo '
  311. <div id="bbcBox_message"></div>';
  312. }
  313. // What about smileys?
  314. if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup']))
  315. echo '
  316. <div id="smileyBox_message"></div>';
  317. echo '
  318. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
  319. // If this message has been edited in the past - display when it was.
  320. if (isset($context['last_modified']))
  321. echo '
  322. <div class="padding smalltext">
  323. <strong>', $txt['last_edit'], ':</strong>
  324. ', $context['last_modified'], '
  325. </div>';
  326. // If the admin has enabled the hiding of the additional options - show a link and image for it.
  327. if (!empty($settings['additional_options_collapsable']))
  328. echo '
  329. <div id="postAdditionalOptionsHeader" class="title_bar">
  330. <h4 class="titlebg">
  331. <img id="postMoreExpand" class="panel_toggle" style="display: none;" src="', $settings['images_url'], '/collapse.png" alt="-" /> <strong><a href="#" id="postMoreExpandLink">', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
  332. </h4>
  333. </div>';
  334. // Display the check boxes for all the standard options - if they are available to the user!
  335. echo '
  336. <div id="postMoreOptions" class="smalltext">
  337. <ul class="post_options">
  338. ', $context['can_notify'] ? '<li><input type="hidden" name="notify" value="0" /><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['notify_replies'] . '</label></li>' : '', '
  339. ', $context['can_lock'] ? '<li><input type="hidden" name="lock" value="0" /><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['lock_topic'] . '</label></li>' : '', '
  340. <li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['back_to_topic'] . '</label></li>
  341. ', $context['can_sticky'] ? '<li><input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['sticky_after'] . '</label></li>' : '', '
  342. <li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="input_check" /> ', $txt['dont_use_smileys'], '</label></li>', '
  343. ', $context['can_move'] ? '<li><input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="input_check" ' . (!empty($context['move']) ? 'checked="checked" ' : '') . '/> ' . $txt['move_after2'] . '</label></li>' : '', '
  344. ', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="input_check" ' . (!empty($context['announce']) ? 'checked="checked" ' : '') . '/> ' . $txt['announce_topic'] . '</label></li>' : '', '
  345. ', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
  346. </ul>
  347. </div>';
  348. // If this post already has attachments on it - give information about them.
  349. if (!empty($context['current_attachments']))
  350. {
  351. echo '
  352. <dl id="postAttachment">
  353. <dt>
  354. ', $txt['attached'], ':
  355. </dt>
  356. <dd class="smalltext">
  357. <input type="hidden" name="attach_del[]" value="0" />
  358. ', $txt['uncheck_unwatchd_attach'], ':
  359. </dd>';
  360. foreach ($context['current_attachments'] as $attachment)
  361. echo '
  362. <dd class="smalltext">
  363. <label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''),
  364. !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label>
  365. </dd>';
  366. if (!empty($context['files_in_session_warning']))
  367. echo '
  368. <dd class="smalltext">', $context['files_in_session_warning'], '</dd>';
  369. echo '
  370. </dl>';
  371. }
  372. // Is the user allowed to post any additional ones? If so give them the boxes to do it!
  373. if ($context['can_post_attachment'])
  374. {
  375. echo '
  376. <dl id="postAttachment2">';
  377. // But, only show them if they haven't reached a limit. Or a mod author hasn't hidden them.
  378. if ($context['num_allowed_attachments'] > 0 || !empty($context['dont_show_them']))
  379. {
  380. echo '
  381. <dt>
  382. ', $txt['attach'], ':
  383. </dt>
  384. <dd class="smalltext">
  385. ', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '" />'), '
  386. <input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
  387. // Show more boxes if they aren't approaching that limit.
  388. if ($context['num_allowed_attachments'] > 1)
  389. echo '
  390. <script type="text/javascript"><!-- // --><![CDATA[
  391. var allowed_attachments = ', $context['num_allowed_attachments'], ';
  392. var current_attachment = 1;
  393. function addAttachment()
  394. {
  395. allowed_attachments = allowed_attachments - 1;
  396. current_attachment = current_attachment + 1;
  397. if (allowed_attachments <= 0)
  398. return alert("', $txt['more_attachments_error'], '");
  399. setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '<\/a>)\' + \'<\/dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');
  400. return true;
  401. }
  402. // ]]></script>
  403. </dd>
  404. <dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
  405. else
  406. echo '
  407. </dd>';
  408. }
  409. // Add any template changes for an alternative upload system here.
  410. call_integration_hook('integrate_upload_template');
  411. echo '
  412. <dd class="smalltext">';
  413. // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
  414. if (!empty($modSettings['attachmentCheckExtensions']))
  415. echo '
  416. ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';
  417. if (!empty($context['attachment_restrictions']))
  418. echo '
  419. ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';
  420. if ($context['num_allowed_attachments'] == 0)
  421. echo '
  422. ', $txt['attach_limit_nag'], '<br />';
  423. if (!$context['can_post_attachment_unapproved'])
  424. echo '
  425. <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';
  426. echo '
  427. </dd>
  428. </dl>';
  429. }
  430. // Is visual verification enabled?
  431. if ($context['require_verification'])
  432. {
  433. echo '
  434. <div class="post_verification">
  435. <span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
  436. <strong>', $txt['verification'], ':</strong>
  437. </span>
  438. ', template_control_verification($context['visual_verification_id'], 'all'), '
  439. </div>';
  440. }
  441. // Finally, the submit buttons.
  442. echo '
  443. <hr class="hrcolor" />
  444. <span class="smalltext" >
  445. ', isBrowser('is_firefox') ? $txt['shortcuts_firefox'] : $txt['shortcuts'], '
  446. </span>
  447. <span id="post_confirm_buttons">
  448. ', template_control_richedit_buttons($context['post_box_name']);
  449. // Option to delete an event if user is editing one.
  450. if ($context['make_event'] && !$context['event']['new'])
  451. echo '
  452. <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" onclick="return confirm(\'', $txt['event_delete_confirm'], '\');" class="button_submit" />';
  453. echo '
  454. </span>
  455. <br class="clear_right" />
  456. </div>
  457. </div>
  458. <br class="clear" />';
  459. // Assuming this isn't a new topic pass across the last message id.
  460. if (isset($context['topic_last_message']))
  461. echo '
  462. <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
  463. echo '
  464. <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
  465. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  466. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  467. </form>';
  468. echo '
  469. <script type="text/javascript"><!-- // --><![CDATA[';
  470. // The functions used to preview a posts without loading a new page.
  471. echo '
  472. var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ';
  473. var make_poll = ', $context['make_poll'] ? 'true' : 'false', ';
  474. var txt_preview_title = "', $txt['preview_title'], '";
  475. var txt_preview_fetch = "', $txt['preview_fetch'], '";
  476. var new_replies = new Array();
  477. var reply_counter = ', empty($counter) ? 0 : $counter, ';
  478. function previewPost()
  479. {';
  480. if (isBrowser('is_firefox'))
  481. echo '
  482. // Firefox doesn\'t render <marquee> that have been put it using javascript
  483. if (document.forms.postmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
  484. {
  485. return submitThisOnce(document.forms.postmodify);
  486. }';
  487. echo '
  488. if (window.XMLHttpRequest)
  489. {
  490. // Opera didn\'t support setRequestHeader() before 8.01.
  491. if (\'opera\' in window)
  492. {
  493. var test = new XMLHttpRequest();
  494. if (!(\'setRequestHeader\' in test))
  495. return submitThisOnce(document.forms.postmodify);
  496. }
  497. // @todo Currently not sending poll options and option checkboxes.
  498. var x = new Array();
  499. var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', ', JavaScriptEscape($context['session_var']), ', \'icon\', \'guestname\', \'email\', \'evtitle\', \'question\', \'topic\'];
  500. var numericFields = [
  501. \'board\', \'topic\', \'last_msg\',
  502. \'eventid\', \'calendar\', \'year\', \'month\', \'day\',
  503. \'poll_max_votes\', \'poll_expire\', \'poll_change_vote\', \'poll_hide\'
  504. ];
  505. var checkboxFields = [
  506. \'ns\'
  507. ];
  508. for (var i = 0, n = textFields.length; i < n; i++)
  509. if (textFields[i] in document.forms.postmodify)
  510. {
  511. // Handle the WYSIWYG editor.
  512. if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled)
  513. x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  514. else
  515. x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  516. }
  517. for (var i = 0, n = numericFields.length; i < n; i++)
  518. if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]])
  519. x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
  520. for (var i = 0, n = checkboxFields.length; i < n; i++)
  521. if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
  522. x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value;
  523. sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=post2\' + (current_board ? \';board=\' + current_board : \'\') + (make_poll ? \';poll\' : \'\') + \';preview;xml\', x.join(\'&\'), onDocSent);
  524. document.getElementById(\'preview_section\').style.display = \'\';
  525. setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
  526. setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);
  527. return false;
  528. }
  529. else
  530. return submitThisOnce(document.forms.postmodify);
  531. }
  532. function onDocSent(XMLDoc)
  533. {
  534. if (!XMLDoc)
  535. {
  536. document.forms.postmodify.preview.onclick = new function ()
  537. {
  538. return true;
  539. }
  540. document.forms.postmodify.preview.click();
  541. }
  542. // Show the preview section.
  543. var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
  544. setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);
  545. var bodyText = \'\';
  546. for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
  547. bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;
  548. setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
  549. document.getElementById(\'preview_body\').className = \'post\';
  550. // Show a list of errors (if any).
  551. var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
  552. var errorList = new Array();
  553. for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
  554. errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
  555. document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
  556. document.getElementById(\'errors\').className = errors.getAttribute(\'serious\') == 1 ? \'errorbox\' : \'noticebox\';
  557. document.getElementById(\'error_serious\').style.display = numErrors == 0 ? \'none\' : \'\';
  558. setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));
  559. // Show a warning if the topic has been locked.
  560. document.getElementById(\'lock_warning\').style.display = errors.getAttribute(\'topic_locked\') == 1 ? \'\' : \'none\';
  561. // Adjust the color of captions if the given data is erroneous.
  562. var captions = errors.getElementsByTagName(\'caption\');
  563. for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
  564. if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
  565. document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');
  566. if (errors.getElementsByTagName(\'post_error\').length == 1)
  567. document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
  568. else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
  569. {
  570. if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ')
  571. document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\';
  572. else
  573. document.forms.postmodify.', $context['post_box_name'], '.style.border = null;
  574. }
  575. // Set the new last message id.
  576. if (\'last_msg\' in document.forms.postmodify)
  577. document.forms.postmodify.last_msg.value = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'last_msg\')[0].firstChild.nodeValue;
  578. // Remove the new image from old-new replies!
  579. for (i = 0; i < new_replies.length; i++)
  580. document.getElementById(\'image_new_\' + new_replies[i]).style.display = \'none\';
  581. new_replies = new Array();
  582. var ignored_replies = new Array(), ignoring;
  583. var newPosts = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0] ? XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0].getElementsByTagName(\'post\') : {length: 0};
  584. var numNewPosts = newPosts.length;
  585. if (numNewPosts != 0)
  586. {
  587. var newPostsHTML = \'<span id="new_replies"><\' + \'/span>\';
  588. for (var i = 0; i < numNewPosts; i++)
  589. {
  590. new_replies[new_replies.length] = newPosts[i].getAttribute("id");
  591. ignoring = false;
  592. if (newPosts[i].getElementsByTagName("is_ignored")[0].firstChild.nodeValue != 0)
  593. ignored_replies[ignored_replies.length] = ignoring = newPosts[i].getAttribute("id");
  594. newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \' core_posts"><div class="content" id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';';
  595. if ($context['can_quote'])
  596. echo '
  597. newPostsHTML += \'<ul class="reset smalltext quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>',$txt['bbc_quote'],'</span><\' + \'/a></li></ul>\';';
  598. echo '
  599. newPostsHTML += \'<br class="clear" />\';
  600. if (ignoring)
  601. newPostsHTML += \'<div id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_prompt" class="smalltext">', $txt['ignoring_user'], '<a href="#" id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a></div>\';
  602. newPostsHTML += \'<div class="list_posts smalltext" id="msg_\' + newPosts[i].getAttribute("id") + \'_body">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'<\' + \'/div></div></div>\';
  603. }
  604. setOuterHTML(document.getElementById(\'new_replies\'), newPostsHTML);
  605. }
  606. var numIgnoredReplies = ignored_replies.length;
  607. if (numIgnoredReplies != 0)
  608. {
  609. for (var i = 0; i < numIgnoredReplies; i++)
  610. {
  611. aIgnoreToggles[ignored_replies[i]] = new smc_Toggle({
  612. bToggleEnabled: true,
  613. bCurrentlyCollapsed: true,
  614. aSwappableContainers: [
  615. \'msg_\' + ignored_replies[i] + \'_body\',
  616. \'msg_\' + ignored_replies[i] + \'_quote\',
  617. ],
  618. aSwapLinks: [
  619. {
  620. sId: \'msg_\' + ignored_replies[i] + \'_ignored_link\',
  621. msgExpanded: \'\',
  622. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  623. }
  624. ]
  625. });
  626. }
  627. }
  628. location.hash = \'#\' + \'preview_section\';
  629. if (typeof(smf_codeFix) != \'undefined\')
  630. smf_codeFix();
  631. }';
  632. // Code for showing and hiding additional options.
  633. if (!empty($settings['additional_options_collapsable']))
  634. echo '
  635. var oSwapAdditionalOptions = new smc_Toggle({
  636. bToggleEnabled: true,
  637. bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
  638. funcOnBeforeCollapse: function () {
  639. document.getElementById(\'additional_options\').value = \'0\';
  640. },
  641. funcOnBeforeExpand: function () {
  642. document.getElementById(\'additional_options\').value = \'1\';
  643. },
  644. aSwappableContainers: [
  645. \'postMoreOptions\',
  646. \'postAttachment\',
  647. \'postAttachment2\',
  648. \'postAttachment3\'
  649. ],
  650. aSwapImages: [
  651. {
  652. sId: \'postMoreExpand\',
  653. srcExpanded: smf_images_url + \'/collapse.png\',
  654. altExpanded: \'-\',
  655. srcCollapsed: smf_images_url + \'/expand.png\',
  656. altCollapsed: \'+\'
  657. }
  658. ],
  659. aSwapLinks: [
  660. {
  661. sId: \'postMoreExpandLink\',
  662. msgExpanded: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ',
  663. msgCollapsed: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), '
  664. }
  665. ]
  666. });';
  667. echo '
  668. // ]]></script>';
  669. // If the user is replying to a topic show the previous posts.
  670. if (isset($context['previous_posts']) && count($context['previous_posts']) > 0)
  671. {
  672. echo '
  673. <div id="recent" class="flow_hidden main_section">
  674. <div class="cat_bar">
  675. <h3 class="catbg">', $txt['topic_summary'], '</h3>
  676. </div>
  677. <span id="new_replies"></span>';
  678. $ignored_posts = array();
  679. foreach ($context['previous_posts'] as $post)
  680. {
  681. $ignoring = false;
  682. if (!empty($post['is_ignored']))
  683. $ignored_posts[] = $ignoring = $post['id'];
  684. echo '
  685. <div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
  686. <div class="content" id="msg', $post['id'], '">
  687. <div class="floatleft">
  688. <h5>', $txt['posted_by'], ': ', $post['poster'], '</h5>
  689. <span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $post['time'], '&nbsp;&#187;</span>
  690. </div>';
  691. if ($context['can_quote'])
  692. {
  693. echo '
  694. <ul class="reset smalltext quickbuttons" id="msg_', $post['id'], '_quote">
  695. <li><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');" class="quote_button"><span>',$txt['bbc_quote'],'</span></a></li>
  696. </ul>';
  697. }
  698. echo '
  699. <br class="clear" />';
  700. if ($ignoring)
  701. {
  702. echo '
  703. <div id="msg_', $post['id'], '_ignored_prompt" class="smalltext">
  704. ', $txt['ignoring_user'], '
  705. <a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
  706. </div>';
  707. }
  708. echo '
  709. <div class="list_posts smalltext" id="msg_', $post['id'], '_body">', $post['message'], '</div>
  710. </div>
  711. </div>';
  712. }
  713. echo '
  714. </div>
  715. <script type="text/javascript"><!-- // --><![CDATA[
  716. var aIgnoreToggles = new Array();';
  717. foreach ($ignored_posts as $post_id)
  718. {
  719. echo '
  720. aIgnoreToggles[', $post_id, '] = new smc_Toggle({
  721. bToggleEnabled: true,
  722. bCurrentlyCollapsed: true,
  723. aSwappableContainers: [
  724. \'msg_', $post_id, '_body\',
  725. \'msg_', $post_id, '_quote\',
  726. ],
  727. aSwapLinks: [
  728. {
  729. sId: \'msg_', $post_id, '_ignored_link\',
  730. msgExpanded: \'\',
  731. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  732. }
  733. ]
  734. });';
  735. }
  736. echo '
  737. function insertQuoteFast(messageid)
  738. {
  739. if (window.XMLHttpRequest)
  740. getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=0\', onDocReceived);
  741. else
  742. reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=0\', 240, 90);
  743. return true;
  744. }
  745. function onDocReceived(XMLDoc)
  746. {
  747. var text = \'\';
  748. // var bIsSource = $("#', $context['post_box_name'], '").data("sceditor").inSourceMode();
  749. for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
  750. text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
  751. $("#', $context['post_box_name'], '").data("sceditor").InsertText(text);
  752. /* var current_value = $("#', $context['post_box_name'], '").data("sceditor").getWysiwygEditorValue() + "\n" + text;
  753. if (!bIsSource)
  754. $("#', $context['post_box_name'], '").data("sceditor").toggleTextMode();
  755. $("#', $context['post_box_name'], '").data("sceditor").setTextareaValue(current_value);
  756. if (!bIsSource)
  757. $("#', $context['post_box_name'], '").data("sceditor").toggleTextMode();*/
  758. }
  759. // ]]></script>';
  760. }
  761. }
  762. // The template for the spellchecker.
  763. function template_spellcheck()
  764. {
  765. global $context, $settings, $options, $txt;
  766. // The style information that makes the spellchecker look... like the forum hopefully!
  767. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  768. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  769. <head>
  770. <title>', $txt['spell_check'], '</title>
  771. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  772. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  773. <style type="text/css">
  774. body, td
  775. {
  776. font-size: small;
  777. margin: 0;
  778. background: #f0f0f0;
  779. color: #000;
  780. padding: 10px;
  781. }
  782. .highlight
  783. {
  784. color: red;
  785. font-weight: bold;
  786. }
  787. #spellview
  788. {
  789. border-style: outset;
  790. border: 1px solid black;
  791. padding: 5px;
  792. width: 95%;
  793. height: 314px;
  794. overflow: auto;
  795. background: #ffffff;
  796. }';
  797. // As you may expect - we need a lot of javascript for this... load it form the separate files.
  798. echo '
  799. </style>
  800. <script type="text/javascript"><!-- // --><![CDATA[
  801. var spell_formname = window.opener.spell_formname;
  802. var spell_fieldname = window.opener.spell_fieldname;
  803. // ]]></script>
  804. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>
  805. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  806. <script type="text/javascript"><!-- // --><![CDATA[
  807. ', $context['spell_js'], '
  808. // ]]></script>
  809. </head>
  810. <body onload="nextWord(false);">
  811. <form action="#" method="post" accept-charset="', $context['character_set'], '" name="spellingForm" id="spellingForm" onsubmit="return false;" style="margin: 0;">
  812. <div id="spellview">&nbsp;</div>
  813. <table border="0" cellpadding="4" cellspacing="0" width="100%"><tr class="windowbg">
  814. <td width="50%" valign="top">
  815. ', $txt['spellcheck_change_to'], '<br />
  816. <input type="text" name="changeto" style="width: 98%;" class="input_text" />
  817. </td>
  818. <td width="50%">
  819. ', $txt['spellcheck_suggest'], '<br />
  820. <select name="suggestions" style="width: 98%;" size="5" onclick="if (this.selectedIndex != -1) this.form.changeto.value = this.options[this.selectedIndex].text;" ondblclick="replaceWord();">
  821. </select>
  822. </td>
  823. </tr></table>
  824. <div class="righttext" style="padding: 4px;">
  825. <input type="button" name="change" value="', $txt['spellcheck_change'], '" onclick="replaceWord();" class="button_submit" />
  826. <input type="button" name="changeall" value="', $txt['spellcheck_change_all'], '" onclick="replaceAll();" class="button_submit" />
  827. <input type="button" name="ignore" value="', $txt['spellcheck_ignore'], '" onclick="nextWord(false);" class="button_submit" />
  828. <input type="button" name="ignoreall" value="', $txt['spellcheck_ignore_all'], '" onclick="nextWord(true);" class="button_submit" />
  829. </div>
  830. </form>
  831. </body>
  832. </html>';
  833. }
  834. function template_quotefast()
  835. {
  836. global $context, $settings, $options, $txt;
  837. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  838. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  839. <head>
  840. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  841. <title>', $txt['retrieving_quote'], '</title>
  842. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  843. </head>
  844. <body>
  845. ', $txt['retrieving_quote'], '
  846. <div id="temporary_posting_area" style="display: none;"></div>
  847. <script type="text/javascript"><!-- // --><![CDATA[';
  848. if ($context['close_window'])
  849. echo '
  850. window.close();';
  851. else
  852. {
  853. // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
  854. echo '
  855. var quote = \'', $context['quote']['text'], '\';
  856. var stage = \'createElement\' in document ? document.createElement("DIV") : document.getElementById("temporary_posting_area");
  857. if (\'DOMParser\' in window && !(\'opera\' in window))
  858. {
  859. var xmldoc = new DOMParser().parseFromString("<temp>" + \'', $context['quote']['mozilla'], '\'.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_") + "</temp>", "text/xml");
  860. quote = xmldoc.childNodes[0].textContent.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  861. }
  862. else if (\'innerText\' in stage)
  863. {
  864. setInnerHTML(stage, quote.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_").replace(/</g, "&lt;").replace(/>/g, "&gt;"));
  865. quote = stage.innerText.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  866. }
  867. if (\'opera\' in window)
  868. quote = quote.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, \'"\').replace(/&amp;/g, "&");
  869. window.opener.oEditorHandle_', $context['post_box_name'], '.InsertText(quote);
  870. window.focus();
  871. setTimeout("window.close();", 400);';
  872. }
  873. echo '
  874. // ]]></script>
  875. </body>
  876. </html>';
  877. }
  878. function template_announce()
  879. {
  880. global $context, $settings, $options, $txt, $scripturl;
  881. echo '
  882. <div id="announcement">
  883. <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '">
  884. <div class="cat_bar">
  885. <h3 class="catbg">', $txt['announce_title'], '</h3>
  886. </div>
  887. <div class="information">
  888. ', $txt['announce_desc'], '
  889. </div>
  890. <div class="windowbg2">
  891. <div class="content">
  892. <p>
  893. ', $txt['announce_this_topic'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0">', $context['topic_subject'], '</a>
  894. </p>
  895. <ul class="reset">';
  896. foreach ($context['groups'] as $group)
  897. echo '
  898. <li>
  899. <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
  900. </li>';
  901. echo '
  902. <li>
  903. <label for="checkall"><input type="checkbox" id="checkall" class="input_check" onclick="invertAll(this, this.form);" checked="checked" /> <em>', $txt['check_all'], '</em></label>
  904. </li>
  905. </ul>
  906. <hr class="hrcolor" />
  907. <div id="confirm_buttons">
  908. <input type="submit" value="', $txt['post'], '" class="button_submit" />
  909. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  910. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  911. <input type="hidden" name="move" value="', $context['move'], '" />
  912. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  913. </div>
  914. </div>
  915. <br class="clear_right" />
  916. </div>
  917. </form>
  918. </div>
  919. <br />';
  920. }
  921. function template_announcement_send()
  922. {
  923. global $context, $settings, $options, $txt, $scripturl;
  924. echo '
  925. <div id="announcement">
  926. <form action="' . $scripturl . '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  927. <div class="windowbg2">
  928. <div class="content">
  929. <p>', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank" class="new_win">', $context['topic_subject'], '</a></p>
  930. <div class="progress_bar">
  931. <div class="full_bar">', $context['percentage_done'], '% ', $txt['announce_done'], '</div>
  932. <div class="green_percent" style="width: ', $context['percentage_done'], '%;">&nbsp;</div>
  933. </div>
  934. <hr class="hrcolor" />
  935. <div id="confirm_buttons">
  936. <input type="submit" name="b" value="', $txt['announce_continue'], '" class="button_submit" />
  937. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  938. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  939. <input type="hidden" name="move" value="', $context['move'], '" />
  940. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  941. <input type="hidden" name="start" value="', $context['start'], '" />
  942. <input type="hidden" name="membergroups" value="', $context['membergroups'], '" />
  943. </div>
  944. </div>
  945. <br class="clear_right" />
  946. </div>
  947. </form>
  948. </div>
  949. <br />
  950. <script type="text/javascript"><!-- // --><![CDATA[
  951. var countdown = 2;
  952. doAutoSubmit();
  953. function doAutoSubmit()
  954. {
  955. if (countdown == 0)
  956. document.forms.autoSubmit.submit();
  957. else if (countdown == -1)
  958. return;
  959. document.forms.autoSubmit.b.value = "', $txt['announce_continue'], ' (" + countdown + ")";
  960. countdown--;
  961. setTimeout("doAutoSubmit();", 1000);
  962. }
  963. // ]]></script>';
  964. }
  965. ?>