Post.template.php 47 KB

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