Post.template.php 47 KB

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