Post.template.php 47 KB

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