1 | <?php |
||||||
2 | /** |
||||||
3 | * Simple Machines Forum (SMF) |
||||||
4 | * |
||||||
5 | * @package SMF |
||||||
6 | * @author Simple Machines https://www.simplemachines.org |
||||||
7 | * @copyright 2020 Simple Machines and individual contributors |
||||||
8 | * @license https://www.simplemachines.org/about/smf/license.php BSD |
||||||
9 | * |
||||||
10 | * @version 2.1 RC2 |
||||||
11 | */ |
||||||
12 | |||||||
13 | /** |
||||||
14 | * The main template for the post page. |
||||||
15 | */ |
||||||
16 | function template_main() |
||||||
17 | { |
||||||
18 | global $context, $options, $txt, $scripturl, $modSettings, $counter; |
||||||
19 | |||||||
20 | // Start the javascript... and boy is there a lot. |
||||||
21 | echo ' |
||||||
22 | <script>'; |
||||||
23 | |||||||
24 | // When using Go Back due to fatal_error, allow the form to be re-submitted with changes. |
||||||
25 | if (isBrowser('is_firefox')) |
||||||
26 | echo ' |
||||||
27 | window.addEventListener("pageshow", reActivate, false);'; |
||||||
28 | |||||||
29 | // Start with message icons - and any missing from this theme. |
||||||
30 | echo ' |
||||||
31 | var icon_urls = {'; |
||||||
32 | |||||||
33 | foreach ($context['icons'] as $icon) |
||||||
34 | echo ' |
||||||
35 | \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ','; |
||||||
36 | |||||||
37 | echo ' |
||||||
38 | };'; |
||||||
39 | |||||||
40 | // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations. |
||||||
41 | if ($context['make_poll']) |
||||||
42 | echo ' |
||||||
43 | var pollOptionNum = 0, pollTabIndex; |
||||||
44 | var pollOptionId = ', $context['last_choice_id'], '; |
||||||
45 | function addPollOption() |
||||||
46 | { |
||||||
47 | if (pollOptionNum == 0) |
||||||
48 | { |
||||||
49 | for (var i = 0, n = document.forms.postmodify.elements.length; i < n; i++) |
||||||
50 | if (document.forms.postmodify.elements[i].id.substr(0, 8) == \'options-\') |
||||||
51 | { |
||||||
52 | pollOptionNum++; |
||||||
53 | pollTabIndex = document.forms.postmodify.elements[i].tabIndex; |
||||||
54 | } |
||||||
55 | } |
||||||
56 | pollOptionNum++ |
||||||
57 | pollOptionId++ |
||||||
58 | |||||||
59 | setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<dt><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>:</dt><dd><input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('"></dd><p id="pollMoreOptions"></p>'), '); |
||||||
60 | }'; |
||||||
61 | |||||||
62 | // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here. |
||||||
63 | if ($context['make_event']) |
||||||
64 | echo ' |
||||||
65 | var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];'; |
||||||
66 | |||||||
67 | // End of the javascript, start the form and display the link tree. |
||||||
68 | echo ' |
||||||
69 | </script> |
||||||
70 | <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);" enctype="multipart/form-data">'; |
||||||
71 | |||||||
72 | // If the user wants to see how their message looks - the preview section is where it's at! |
||||||
73 | echo ' |
||||||
74 | <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '> |
||||||
75 | <div class="cat_bar"> |
||||||
76 | <h3 class="catbg"> |
||||||
77 | <span id="preview_subject">', empty($context['preview_subject']) ? ' ' : $context['preview_subject'], '</span> |
||||||
78 | </h3> |
||||||
79 | </div> |
||||||
80 | <div id="preview_body" class="windowbg"> |
||||||
81 | ', empty($context['preview_message']) ? '<br>' : $context['preview_message'], ' |
||||||
82 | </div> |
||||||
83 | </div> |
||||||
84 | <br>'; |
||||||
85 | |||||||
86 | if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board']))) |
||||||
87 | echo ' |
||||||
88 | <input type="hidden" name="eventid" value="', $context['event']['id'], '">'; |
||||||
89 | |||||||
90 | // Start the main table. |
||||||
91 | echo ' |
||||||
92 | <div class="cat_bar"> |
||||||
93 | <h3 class="catbg">', $context['page_title'], '</h3> |
||||||
94 | </div> |
||||||
95 | <div id="post_area"> |
||||||
96 | <div class="roundframe">', isset($context['current_topic']) ? ' |
||||||
97 | <input type="hidden" name="topic" value="' . $context['current_topic'] . '">' : ''; |
||||||
98 | |||||||
99 | // If an error occurred, explain what happened. |
||||||
100 | echo ' |
||||||
101 | <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']) ? ' style="display: none"' : '', ' id="errors"> |
||||||
102 | <dl> |
||||||
103 | <dt> |
||||||
104 | <strong id="error_serious">', $txt['error_while_submitting'], '</strong> |
||||||
105 | </dt> |
||||||
106 | <dd class="error" id="error_list"> |
||||||
107 | ', empty($context['post_error']) ? '' : implode('<br>', $context['post_error']), ' |
||||||
108 | </dd> |
||||||
109 | </dl> |
||||||
110 | </div>'; |
||||||
111 | |||||||
112 | // If this won't be approved let them know! |
||||||
113 | if (!$context['becomes_approved']) |
||||||
114 | echo ' |
||||||
115 | <div class="noticebox"> |
||||||
116 | <em>', $txt['wait_for_approval'], '</em> |
||||||
117 | <input type="hidden" name="not_approved" value="1"> |
||||||
118 | </div>'; |
||||||
119 | |||||||
120 | // If it's locked, show a message to warn the replier. |
||||||
121 | if (!empty($context['locked'])) |
||||||
122 | echo ' |
||||||
123 | <div class="errorbox"> |
||||||
124 | ', $txt['topic_locked_no_reply'], ' |
||||||
125 | </div>'; |
||||||
126 | |||||||
127 | if (!empty($modSettings['drafts_post_enabled'])) |
||||||
128 | echo ' |
||||||
129 | <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
||||||
130 | sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), ' |
||||||
131 | ', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
||||||
132 | </div>'; |
||||||
133 | |||||||
134 | // The post header... important stuff |
||||||
135 | template_post_header(); |
||||||
136 | |||||||
137 | // Are you posting a calendar event? |
||||||
138 | if ($context['make_event']) |
||||||
139 | { |
||||||
140 | echo ' |
||||||
141 | <hr class="clear"> |
||||||
142 | <div id="post_event"> |
||||||
143 | <fieldset id="event_main"> |
||||||
144 | <legend><span', isset($context['post_error']['no_event']) ? ' class="error"' : '', '>', $txt['calendar_event_title'], '</span></legend> |
||||||
145 | <input type="hidden" name="calendar" value="1"> |
||||||
146 | <div class="event_options_left" id="event_title"> |
||||||
147 | <div> |
||||||
148 | <input type="text" id="evtitle" name="evtitle" maxlength="255" size="55" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '"> |
||||||
149 | </div> |
||||||
150 | </div>'; |
||||||
151 | |||||||
152 | // If this is a new event let the user specify which board they want the linked post to be put into. |
||||||
153 | if ($context['event']['new'] && $context['is_new_post']) |
||||||
154 | { |
||||||
155 | echo ' |
||||||
156 | <div class="event_options_right" id="event_board"> |
||||||
157 | <div> |
||||||
158 | <span class="label">', $txt['calendar_post_in'], '</span> |
||||||
159 | <select name="board">'; |
||||||
160 | foreach ($context['event']['categories'] as $category) |
||||||
161 | { |
||||||
162 | echo ' |
||||||
163 | <optgroup label="', $category['name'], '">'; |
||||||
164 | |||||||
165 | foreach ($category['boards'] as $board) |
||||||
166 | echo ' |
||||||
167 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=>' : '', ' ', $board['name'], '</option>'; |
||||||
168 | echo ' |
||||||
169 | </optgroup>'; |
||||||
170 | } |
||||||
171 | echo ' |
||||||
172 | </select> |
||||||
173 | </div> |
||||||
174 | </div><!-- #event_board -->'; |
||||||
175 | } |
||||||
176 | |||||||
177 | // Note to theme writers: The JavaScripts expect the input fields for the start and end dates & times to be contained in a wrapper element with the id "event_time_input" |
||||||
178 | echo ' |
||||||
179 | </fieldset> |
||||||
180 | <fieldset id="event_options"> |
||||||
181 | <legend>', $txt['calendar_event_options'], '</legend> |
||||||
182 | <div class="event_options_left" id="event_time_input"> |
||||||
183 | <div> |
||||||
184 | <span class="label">', $txt['start'], '</span> |
||||||
185 | <input type="text" name="start_date" id="start_date" maxlength="10" value="', $context['event']['start_date'], '" tabindex="', $context['tabindex']++, '" class="date_input start" data-type="date"> |
||||||
186 | <input type="text" name="start_time" id="start_time" maxlength="11" value="', $context['event']['start_time'], '" tabindex="', $context['tabindex']++, '" class="time_input start" data-type="time"', !empty($context['event']['allday']) ? ' disabled' : '', '> |
||||||
187 | </div> |
||||||
188 | <div> |
||||||
189 | <span class="label">', $txt['end'], '</span> |
||||||
190 | <input type="text" name="end_date" id="end_date" maxlength="10" value="', $context['event']['end_date'], '" tabindex="', $context['tabindex']++, '" class="date_input end" data-type="date"', $modSettings['cal_maxspan'] == 1 ? ' disabled' : '', '> |
||||||
191 | <input type="text" name="end_time" id="end_time" maxlength="11" value="', $context['event']['end_time'], '" tabindex="', $context['tabindex']++, '" class="time_input end" data-type="time"', !empty($context['event']['allday']) ? ' disabled' : '', '> |
||||||
192 | </div> |
||||||
193 | </div> |
||||||
194 | <div class="event_options_right" id="event_time_options"> |
||||||
195 | <div id="event_allday"> |
||||||
196 | <label for="allday"><span class="label">', $txt['calendar_allday'], '</span></label> |
||||||
197 | <input type="checkbox" name="allday" id="allday"', !empty($context['event']['allday']) ? ' checked' : '', ' tabindex="', $context['tabindex']++, '"> |
||||||
198 | </div> |
||||||
199 | <div id="event_timezone"> |
||||||
200 | <span class="label">', $txt['calendar_timezone'], '</span> |
||||||
201 | <select name="tz" id="tz"', !empty($context['event']['allday']) ? ' disabled' : '', '>'; |
||||||
202 | |||||||
203 | foreach ($context['all_timezones'] as $tz => $tzname) |
||||||
204 | echo ' |
||||||
205 | <option', is_numeric($tz) ? ' value="" disabled' : ' value="' . $tz . '"', $tz === $context['event']['tz'] ? ' selected' : '', '>', $tzname, '</option>'; |
||||||
206 | |||||||
207 | echo ' |
||||||
208 | </select> |
||||||
209 | </div> |
||||||
210 | </div><!-- #event_time_options --> |
||||||
211 | <div> |
||||||
212 | <span class="label">', $txt['location'], '</span> |
||||||
213 | <input type="text" name="event_location" id="event_location" maxlength="255" value="', $context['event']['location'], '" tabindex="', $context['tabindex']++, '"> |
||||||
214 | </div> |
||||||
215 | </fieldset> |
||||||
216 | </div><!-- #post_event -->'; |
||||||
217 | } |
||||||
218 | |||||||
219 | // If this is a poll then display all the poll options! |
||||||
220 | if ($context['make_poll']) |
||||||
221 | { |
||||||
222 | echo ' |
||||||
223 | <hr class="clear"> |
||||||
224 | <div id="edit_poll"> |
||||||
225 | <fieldset id="poll_main"> |
||||||
226 | <legend><span ', (isset($context['poll_error']['no_question']) ? ' class="error"' : ''), '>', $txt['poll_question'], '</span></legend> |
||||||
227 | <dl class="settings poll_options"> |
||||||
228 | <dt>', $txt['poll_question'], '</dt> |
||||||
229 | <dd> |
||||||
230 | <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80"> |
||||||
231 | </dd>'; |
||||||
232 | |||||||
233 | // Loop through all the choices and print them out. |
||||||
234 | foreach ($context['choices'] as $choice) |
||||||
235 | echo ' |
||||||
236 | <dt> |
||||||
237 | <label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>: |
||||||
238 | </dt> |
||||||
239 | <dd> |
||||||
240 | <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255"> |
||||||
241 | </dd>'; |
||||||
242 | |||||||
243 | echo ' |
||||||
244 | <p id="pollMoreOptions"></p> |
||||||
245 | </dl> |
||||||
246 | <strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong> |
||||||
247 | </fieldset> |
||||||
248 | <fieldset id="poll_options"> |
||||||
249 | <legend>', $txt['poll_options'], '</legend> |
||||||
250 | <dl class="settings poll_options"> |
||||||
251 | <dt> |
||||||
252 | <label for="poll_max_votes">', $txt['poll_max_votes'], ':</label> |
||||||
253 | </dt> |
||||||
254 | <dd> |
||||||
255 | <input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '"> |
||||||
256 | </dd> |
||||||
257 | <dt> |
||||||
258 | <label for="poll_expire">', $txt['poll_run'], ':</label><br> |
||||||
259 | <em class="smalltext">', $txt['poll_run_limit'], '</em> |
||||||
260 | </dt> |
||||||
261 | <dd> |
||||||
262 | <input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4"> ', $txt['days_word'], ' |
||||||
263 | </dd> |
||||||
264 | <dt> |
||||||
265 | <label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label> |
||||||
266 | </dt> |
||||||
267 | <dd> |
||||||
268 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '> |
||||||
269 | </dd>'; |
||||||
270 | |||||||
271 | if ($context['poll_options']['guest_vote_enabled']) |
||||||
272 | echo ' |
||||||
273 | <dt> |
||||||
274 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
||||||
275 | </dt> |
||||||
276 | <dd> |
||||||
277 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked' : '', '> |
||||||
278 | </dd>'; |
||||||
279 | |||||||
280 | echo ' |
||||||
281 | <dt> |
||||||
282 | ', $txt['poll_results_visibility'], ': |
||||||
283 | </dt> |
||||||
284 | <dd> |
||||||
285 | <input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked' : '', '> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label><br> |
||||||
286 | <input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked' : '', '> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label><br> |
||||||
287 | <input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked' : '', empty($context['poll_options']['expire']) ? ' disabled' : '', '> <label for="poll_results_expire">', $txt['poll_results_after'], '</label> |
||||||
288 | </dd> |
||||||
289 | </dl> |
||||||
290 | </fieldset> |
||||||
291 | </div><!-- #edit_poll -->'; |
||||||
292 | } |
||||||
293 | |||||||
294 | // Show the actual posting area... |
||||||
295 | echo ' |
||||||
296 | ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); |
||||||
0 ignored issues
–
show
'bbcBox_message' of type string is incompatible with the type boolean|null expected by parameter $bbcContainer of template_control_richedit() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() 'smileyBox_message' of type string is incompatible with the type boolean|null expected by parameter $smileyContainer of template_control_richedit() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
297 | |||||||
298 | // If we're editing and displaying edit details, show a box where they can say why |
||||||
299 | if (isset($context['editing']) && $modSettings['show_modify']) |
||||||
300 | echo ' |
||||||
301 | <dl> |
||||||
302 | <dt class="clear"> |
||||||
303 | <span id="caption_edit_reason">', $txt['reason_for_edit'], ':</span> |
||||||
304 | </dt> |
||||||
305 | <dd> |
||||||
306 | <input type="text" name="modify_reason"', isset($context['last_modified_reason']) ? ' value="' . $context['last_modified_reason'] . '"' : '', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80"> |
||||||
307 | </dd> |
||||||
308 | </dl>'; |
||||||
309 | |||||||
310 | // If this message has been edited in the past - display when it was. |
||||||
311 | if (isset($context['last_modified'])) |
||||||
312 | echo ' |
||||||
313 | <div class="padding smalltext"> |
||||||
314 | ', $context['last_modified_text'], ' |
||||||
315 | </div>'; |
||||||
316 | |||||||
317 | // If the admin has enabled the hiding of the additional options - show a link and image for it. |
||||||
318 | if (!empty($modSettings['additional_options_collapsable'])) |
||||||
319 | echo ' |
||||||
320 | <div id="post_additional_options_header"> |
||||||
321 | <strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong> |
||||||
322 | </div>'; |
||||||
323 | |||||||
324 | echo ' |
||||||
325 | <div id="post_additional_options">'; |
||||||
326 | |||||||
327 | // Display the checkboxes for all the standard options - if they are available to the user! |
||||||
328 | echo ' |
||||||
329 | <div id="post_settings" class="smalltext"> |
||||||
330 | <ul class="post_options"> |
||||||
331 | ', $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']) || $context['auto_notify'] ? ' checked' : '') . ' value="1"> ' . $txt['notify_replies'] . '</label></li>' : '', ' |
||||||
332 | ', $context['can_lock'] ? '<li><input type="hidden" name="already_locked" value="' . $context['already_locked'] . '"><input type="hidden" name="lock" value="0"><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked' : '') . ' value="1"> ' . $txt['lock_topic'] . '</label></li>' : '', ' |
||||||
333 | <li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked' : '') . ' value="1"> ' . $txt['back_to_topic'] . '</label></li> |
||||||
334 | ', $context['can_sticky'] ? '<li><input type="hidden" name="already_sticky" value="' . $context['already_sticky'] . '"><input type="hidden" name="sticky" value="0"><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked' : '') . ' value="1"> ' . $txt['sticky_after_posting'] . '</label></li>' : '', ' |
||||||
335 | <li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked', ' value="NS"> ', $txt['dont_use_smileys'], '</label></li>', ' |
||||||
336 | ', $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"' . (!empty($context['move']) ? ' checked" ' : '') . '> ' . $txt['move_after_posting'] . '</label></li>' : '', ' |
||||||
337 | ', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1"' . (!empty($context['announce']) ? ' checked' : '') . '> ' . $txt['announce_topic'] . '</label></li>' : '', ' |
||||||
338 | ', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2"' . ($context['show_approval'] === 2 ? ' checked' : '') . '> ' . $txt['approve_this_post'] . '</label></li>' : '', ' |
||||||
339 | </ul> |
||||||
340 | </div><!-- #post_settings -->'; |
||||||
341 | |||||||
342 | // If this post already has attachments on it - give information about them. |
||||||
343 | if (!empty($context['current_attachments'])) |
||||||
344 | { |
||||||
345 | echo ' |
||||||
346 | <dl id="postAttachment"> |
||||||
347 | <dt> |
||||||
348 | ', $txt['attached'], ': |
||||||
349 | </dt> |
||||||
350 | <dd class="smalltext" style="width: 100%;"> |
||||||
351 | <input type="hidden" name="attach_del[]" value="0"> |
||||||
352 | ', $txt['uncheck_unwatchd_attach'], ': |
||||||
353 | </dd>'; |
||||||
354 | |||||||
355 | foreach ($context['current_attachments'] as $attachment) |
||||||
356 | echo ' |
||||||
357 | <dd class="smalltext"> |
||||||
358 | <label for="attachment_', $attachment['attachID'], '"><input type="checkbox" id="attachment_', $attachment['attachID'], '" name="attach_del[]" value="', $attachment['attachID'], '"', empty($attachment['unchecked']) ? ' checked' : '', '> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), |
||||||
359 | !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1024) / 1024), 0)) : '', '</label> |
||||||
360 | </dd>'; |
||||||
361 | |||||||
362 | echo ' |
||||||
363 | </dl>'; |
||||||
364 | |||||||
365 | if (!empty($context['files_in_session_warning'])) |
||||||
366 | echo ' |
||||||
367 | <div class="smalltext"><em>', $context['files_in_session_warning'], '</em></div>'; |
||||||
368 | } |
||||||
369 | |||||||
370 | // Is the user allowed to post any additional ones? If so give them the boxes to do it! |
||||||
371 | if ($context['can_post_attachment']) |
||||||
372 | { |
||||||
373 | // Print dropzone UI. |
||||||
374 | echo ' |
||||||
375 | <div class="files" id="attachment_previews"> |
||||||
376 | <div> |
||||||
377 | <strong>', $txt['attached'], ':</strong> |
||||||
378 | </div> |
||||||
379 | <div id="au-template"> |
||||||
380 | <div class="attach-preview"> |
||||||
381 | <img data-dz-thumbnail /> |
||||||
382 | </div> |
||||||
383 | <div class="attachment_info"> |
||||||
384 | <div> |
||||||
385 | <span class="name" data-dz-name></span> |
||||||
386 | <span class="error" data-dz-errormessage></span> |
||||||
387 | <span class="size" data-dz-size></span> |
||||||
388 | <span class="message" data-dz-message></span> |
||||||
389 | </div> |
||||||
390 | <div class="attached_BBC"> |
||||||
391 | <input type="text" name="attachBBC" value="" readonly> |
||||||
392 | <div class="attached_BBC_width_height"> |
||||||
393 | <div class="attached_BBC_width"> |
||||||
394 | <label for="attached_BBC_width">', $txt['attached_insert_width'], '</label> |
||||||
395 | <input type="number" name="attached_BBC_width" min="0" value="" placeholder="auto"> |
||||||
396 | </div> |
||||||
397 | <div class="attached_BBC_height"> |
||||||
398 | <label for="attached_BBC_height">', $txt['attached_insert_height'], '</label> |
||||||
399 | <input type="number" name="attached_BBC_height" min="0" value="" placeholder="auto"> |
||||||
400 | </div> |
||||||
401 | </div> |
||||||
402 | </div><!-- .attached_BBC --> |
||||||
403 | <div class="progress_bar" role="progressBar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
||||||
404 | <div class="bar"></div> |
||||||
405 | </div> |
||||||
406 | <div class="attach-ui"> |
||||||
407 | <a data-dz-remove class="button cancel">', $txt['modify_cancel'], '</a> |
||||||
408 | <a class="button upload">', $txt['upload'], '</a> |
||||||
409 | </div> |
||||||
410 | </div><!-- .attachment_info --> |
||||||
411 | </div><!-- #au-template --> |
||||||
412 | </div><!-- #attachment_previews --> |
||||||
413 | <div id ="max_files_progress" class="max_files_progress progress_bar"> |
||||||
414 | <div class="bar"></div> |
||||||
415 | </div> |
||||||
416 | <div id ="max_files_progress_text"></div>'; |
||||||
417 | |||||||
418 | echo ' |
||||||
419 | <dl id="postAttachment2"> |
||||||
420 | <dt> |
||||||
421 | ', $txt['attach'], ': |
||||||
422 | </dt> |
||||||
423 | <dd class="fallback"> |
||||||
424 | <div id="attachment_upload" class="descbox"> |
||||||
425 | <div id="drop_zone_ui"> |
||||||
426 | <div> |
||||||
427 | <strong>', $txt['attach_drop_zone'], '</strong> |
||||||
428 | </div> |
||||||
429 | <div class="righttext"> |
||||||
430 | <a class="button" id="attach_cancel_all">', $txt['attached_cancel_all'], '</a> |
||||||
431 | <a class="button" id="attach_upload_all">', $txt['attached_upload_all'], '</a> |
||||||
432 | <a class="button fileinput-button">', $txt['attach_add'], '</a> |
||||||
433 | </div> |
||||||
434 | </div> |
||||||
435 | <div id="total_progress" class="progress_bar" role="progressBar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"> |
||||||
436 | <div class="bar"></div> |
||||||
437 | </div> |
||||||
438 | <div class="fallback"> |
||||||
439 | <input type="file" multiple="multiple" name="attachment[]" id="attachment1" class="fallback"> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)'; |
||||||
440 | |||||||
441 | if (!empty($modSettings['attachmentSizeLimit'])) |
||||||
442 | echo ' |
||||||
443 | <input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1024 . '">'; |
||||||
444 | |||||||
445 | // Show more boxes if they aren't approaching that limit. |
||||||
446 | if ($context['num_allowed_attachments'] > 1) |
||||||
447 | echo ' |
||||||
448 | <script> |
||||||
449 | var allowed_attachments = ', $context['num_allowed_attachments'], '; |
||||||
450 | var current_attachment = 1; |
||||||
451 | |||||||
452 | function addAttachment() |
||||||
453 | { |
||||||
454 | allowed_attachments = allowed_attachments - 1; |
||||||
455 | current_attachment = current_attachment + 1; |
||||||
456 | if (allowed_attachments <= 0) |
||||||
457 | return alert("', $txt['more_attachments_error'], '"); |
||||||
458 | |||||||
459 | setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" name="attachment[]" id="attachment\' + current_attachment + \'"> (<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>\'); |
||||||
460 | |||||||
461 | return true; |
||||||
462 | } |
||||||
463 | </script> |
||||||
464 | <a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a> |
||||||
465 | </div><!-- .fallback --> |
||||||
466 | </div><!-- #attachment_upload -->'; |
||||||
467 | |||||||
468 | echo ' |
||||||
469 | </dd>'; |
||||||
470 | |||||||
471 | // Add any template changes for an alternative upload system here. |
||||||
472 | call_integration_hook('integrate_upload_template'); |
||||||
473 | |||||||
474 | echo ' |
||||||
475 | <dd class="smalltext">'; |
||||||
476 | |||||||
477 | // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed. |
||||||
478 | if (!empty($modSettings['attachmentCheckExtensions'])) |
||||||
479 | echo ' |
||||||
480 | ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br>'; |
||||||
481 | |||||||
482 | if (!empty($context['attachment_restrictions'])) |
||||||
483 | echo ' |
||||||
484 | ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br>'; |
||||||
485 | |||||||
486 | if ($context['num_allowed_attachments'] == 0) |
||||||
487 | echo ' |
||||||
488 | ', $txt['attach_limit_nag'], '<br>'; |
||||||
489 | |||||||
490 | if (!$context['can_post_attachment_unapproved']) |
||||||
491 | echo ' |
||||||
492 | <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br>'; |
||||||
493 | |||||||
494 | echo ' |
||||||
495 | </dd> |
||||||
496 | </dl>'; |
||||||
497 | } |
||||||
498 | |||||||
499 | echo ' |
||||||
500 | </div><!-- #post_additional_options -->'; |
||||||
501 | |||||||
502 | // If the admin enabled the drafts feature, show a draft selection box |
||||||
503 | if (!empty($modSettings['drafts_post_enabled']) && !empty($context['drafts']) && !empty($options['drafts_show_saved_enabled'])) |
||||||
504 | { |
||||||
505 | echo ' |
||||||
506 | <div id="post_draft_options_header" class="title_bar"> |
||||||
507 | <h4 class="titlebg"> |
||||||
508 | <span id="postDraftExpand" class="toggle_up floatright" style="display: none;"></span> <strong><a href="#" id="postDraftExpandLink">', $txt['drafts_show'], '</a></strong> |
||||||
509 | </h4> |
||||||
510 | </div> |
||||||
511 | <div id="post_draft_options"> |
||||||
512 | <dl class="settings"> |
||||||
513 | <dt><strong>', $txt['subject'], '</strong></dt> |
||||||
514 | <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
||||||
515 | |||||||
516 | foreach ($context['drafts'] as $draft) |
||||||
517 | echo ' |
||||||
518 | <dt>', $draft['link'], '</dt> |
||||||
519 | <dd>', $draft['poster_time'], '</dd>'; |
||||||
520 | echo ' |
||||||
521 | </dl> |
||||||
522 | </div>'; |
||||||
523 | } |
||||||
524 | |||||||
525 | // Is visual verification enabled? |
||||||
526 | if ($context['require_verification']) |
||||||
527 | echo ' |
||||||
528 | <div class="post_verification"> |
||||||
529 | <span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '> |
||||||
530 | <strong>', $txt['verification'], ':</strong> |
||||||
531 | </span> |
||||||
532 | ', template_control_verification($context['visual_verification_id'], 'all'), ' |
||||||
533 | </div>'; |
||||||
534 | |||||||
535 | // Finally, the submit buttons. |
||||||
536 | echo ' |
||||||
537 | <span id="post_confirm_buttons"> |
||||||
538 | ', template_control_richedit_buttons($context['post_box_name']); |
||||||
0 ignored issues
–
show
Are you sure the usage of
template_control_richedi...ntext['post_box_name']) is correct as it seems to always return null .
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||||
539 | |||||||
540 | // Option to delete an event if user is editing one. |
||||||
541 | if ($context['make_event'] && !$context['event']['new']) |
||||||
542 | echo ' |
||||||
543 | <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" data-confirm="', $txt['event_delete_confirm'], '" class="button you_sure">'; |
||||||
544 | |||||||
545 | echo ' |
||||||
546 | </span> |
||||||
547 | </div><!-- .roundframe --> |
||||||
548 | </div><!-- #post_area --> |
||||||
549 | <br class="clear">'; |
||||||
550 | |||||||
551 | // Assuming this isn't a new topic pass across the last message id. |
||||||
552 | if (isset($context['topic_last_message'])) |
||||||
553 | echo ' |
||||||
554 | <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '">'; |
||||||
555 | |||||||
556 | echo ' |
||||||
557 | <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '"> |
||||||
558 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||||||
559 | <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '"> |
||||||
560 | </form>'; |
||||||
561 | |||||||
562 | echo ' |
||||||
563 | <script>'; |
||||||
564 | |||||||
565 | $newPostsHTML = ' |
||||||
566 | <span id="new_replies"></span> |
||||||
567 | <div class="windowbg"> |
||||||
568 | <div id="msg%PostID%"> |
||||||
569 | <h5 class="floatleft"> |
||||||
570 | <span>' . $txt['posted_by'] . '</span> |
||||||
571 | %PosterName% |
||||||
572 | </h5> |
||||||
573 | - %PostTime% » <span class="new_posts" id="image_new_%PostID%">' . $txt['new'] . '</span>'; |
||||||
574 | |||||||
575 | if ($context['can_quote']) |
||||||
576 | $newPostsHTML .= ' |
||||||
577 | <ul class="quickbuttons sf-js-enabled sf-arrows" id="msg_%PostID%_quote" style="touch-action: pan-y;"> |
||||||
578 | <li id="post_modify"> |
||||||
579 | <a href="#postmodify" onclick="return insertQuoteFast(%PostID%);" class="quote_button"><span class="main_icons quote"></span>' . $txt['quote'] . '</a> |
||||||
580 | </li> |
||||||
581 | </ul>'; |
||||||
582 | |||||||
583 | $newPostsHTML .= ' |
||||||
584 | <br class="clear"> |
||||||
585 | <div id="msg_%PostID%_ignored_prompt" class="smalltext" style="display: none;">' . $txt['ignoring_user'] . '<a href="#" id="msg_%PostID%_ignored_link" style="%IgnoredStyle%">' . $txt['show_ignore_user_post'] . '</a></div> |
||||||
586 | <div class="list_posts smalltext" id="msg_%PostID%_body">%PostBody%</div> |
||||||
587 | </div>'; |
||||||
588 | |||||||
589 | // The functions used to preview a posts without loading a new page. |
||||||
590 | echo ' |
||||||
591 | var oPreviewPost = new smc_preview_post({ |
||||||
592 | sPreviewSectionContainerID: "preview_section", |
||||||
593 | sPreviewSubjectContainerID: "preview_subject", |
||||||
594 | sPreviewBodyContainerID: "preview_body", |
||||||
595 | sErrorsContainerID: "errors", |
||||||
596 | sErrorsSeriousContainerID: "error_serious", |
||||||
597 | sErrorsListContainerID: "error_list", |
||||||
598 | sCaptionContainerID: "caption_%ID%", |
||||||
599 | sNewImageContainerID: "image_new_%ID%", |
||||||
600 | sPostBoxContainerID: ', JavaScriptEscape($context['post_box_name']), ', |
||||||
601 | bMakePoll: ', $context['make_poll'] ? 'true' : 'false', ', |
||||||
602 | sTxtPreviewTitle: ', JavaScriptEscape($txt['preview_title']), ', |
||||||
603 | sTxtPreviewFetch: ', JavaScriptEscape($txt['preview_fetch']), ', |
||||||
604 | sSessionVar: ', JavaScriptEscape($context['session_var']), ', |
||||||
605 | newPostsTemplate:', JavaScriptEscape($newPostsHTML); |
||||||
606 | |||||||
607 | if (!empty($context['current_board'])) |
||||||
608 | echo ', |
||||||
609 | iCurrentBoard: ', $context['current_board'], ''; |
||||||
610 | |||||||
611 | echo ' |
||||||
612 | });'; |
||||||
613 | |||||||
614 | // Code for showing and hiding additional options. |
||||||
615 | if (!empty($modSettings['additional_options_collapsable'])) |
||||||
616 | echo ' |
||||||
617 | var oSwapAdditionalOptions = new smc_Toggle({ |
||||||
618 | bToggleEnabled: true, |
||||||
619 | bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ', |
||||||
620 | funcOnBeforeCollapse: function () { |
||||||
621 | document.getElementById(\'additional_options\').value = \'0\'; |
||||||
622 | }, |
||||||
623 | funcOnBeforeExpand: function () { |
||||||
624 | document.getElementById(\'additional_options\').value = \'1\'; |
||||||
625 | }, |
||||||
626 | aSwappableContainers: [ |
||||||
627 | \'post_additional_options\', |
||||||
628 | ], |
||||||
629 | aSwapImages: [ |
||||||
630 | { |
||||||
631 | sId: \'postMoreExpandLink\', |
||||||
632 | altExpanded: \'-\', |
||||||
633 | altCollapsed: \'+\' |
||||||
634 | } |
||||||
635 | ], |
||||||
636 | aSwapLinks: [ |
||||||
637 | { |
||||||
638 | sId: \'postMoreExpandLink\', |
||||||
639 | msgExpanded: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ', |
||||||
640 | msgCollapsed: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ' |
||||||
641 | } |
||||||
642 | ] |
||||||
643 | });'; |
||||||
644 | |||||||
645 | // Code for showing and hiding drafts |
||||||
646 | if (!empty($context['drafts'])) |
||||||
647 | echo ' |
||||||
648 | var oSwapDraftOptions = new smc_Toggle({ |
||||||
649 | bToggleEnabled: true, |
||||||
650 | bCurrentlyCollapsed: true, |
||||||
651 | aSwappableContainers: [ |
||||||
652 | \'post_draft_options\', |
||||||
653 | ], |
||||||
654 | aSwapImages: [ |
||||||
655 | { |
||||||
656 | sId: \'postDraftExpand\', |
||||||
657 | altExpanded: \'-\', |
||||||
658 | altCollapsed: \'+\' |
||||||
659 | } |
||||||
660 | ], |
||||||
661 | aSwapLinks: [ |
||||||
662 | { |
||||||
663 | sId: \'postDraftExpandLink\', |
||||||
664 | msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ', |
||||||
665 | msgCollapsed: ', JavaScriptEscape($txt['drafts_show']), ' |
||||||
666 | } |
||||||
667 | ] |
||||||
668 | });'; |
||||||
669 | |||||||
670 | echo ' |
||||||
671 | var oEditorID = "', $context['post_box_name'], '"; |
||||||
672 | var oEditorObject = oEditorHandle_', $context['post_box_name'], '; |
||||||
673 | </script>'; |
||||||
674 | |||||||
675 | // If the user is replying to a topic show the previous posts. |
||||||
676 | if (isset($context['previous_posts']) && count($context['previous_posts']) > 0) |
||||||
677 | { |
||||||
678 | echo ' |
||||||
679 | <div id="recent" class="flow_hidden main_section"> |
||||||
680 | <div class="cat_bar"> |
||||||
681 | <h3 class="catbg">', $txt['topic_summary'], '</h3> |
||||||
682 | </div> |
||||||
683 | <span id="new_replies"></span>'; |
||||||
684 | |||||||
685 | $ignored_posts = array(); |
||||||
686 | foreach ($context['previous_posts'] as $post) |
||||||
687 | { |
||||||
688 | $ignoring = false; |
||||||
689 | if (!empty($post['is_ignored'])) |
||||||
690 | $ignored_posts[] = $ignoring = $post['id']; |
||||||
691 | |||||||
692 | echo ' |
||||||
693 | <div class="windowbg"> |
||||||
694 | <div id="msg', $post['id'], '"> |
||||||
695 | <h5 class="floatleft"> |
||||||
696 | <span>', $txt['posted_by'], '</span> ', $post['poster'], ' |
||||||
697 | </h5> |
||||||
698 | - ', $post['time']; |
||||||
699 | |||||||
700 | if ($context['can_quote']) |
||||||
701 | echo ' |
||||||
702 | <ul class="quickbuttons" id="msg_', $post['id'], '_quote"> |
||||||
703 | <li style="display:none;" id="quoteSelected_', $post['id'], '" data-msgid="', $post['id'], '"><a href="javascript:void(0)"><span class="main_icons quote_selected"></span>', $txt['quote_selected_action'], '</a></li> |
||||||
704 | <li id="post_modify"><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');"><span class="main_icons quote"></span>', $txt['quote'], '</a></li> |
||||||
705 | </ul>'; |
||||||
706 | |||||||
707 | echo ' |
||||||
708 | <br class="clear">'; |
||||||
709 | |||||||
710 | if ($ignoring) |
||||||
711 | echo ' |
||||||
712 | <div id="msg_', $post['id'], '_ignored_prompt" class="smalltext"> |
||||||
713 | ', $txt['ignoring_user'], ' |
||||||
714 | <a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a> |
||||||
715 | </div>'; |
||||||
716 | |||||||
717 | echo ' |
||||||
718 | <div class="list_posts smalltext" id="msg_', $post['id'], '_body" data-msgid="', $post['id'], '">', $post['message'], '</div> |
||||||
719 | </div><!-- #msg[id] --> |
||||||
720 | </div><!-- .windowbg -->'; |
||||||
721 | } |
||||||
722 | |||||||
723 | echo ' |
||||||
724 | </div><!-- #recent --> |
||||||
725 | <script> |
||||||
726 | var aIgnoreToggles = new Array();'; |
||||||
727 | |||||||
728 | foreach ($ignored_posts as $post_id) |
||||||
729 | { |
||||||
730 | echo ' |
||||||
731 | aIgnoreToggles[', $post_id, '] = new smc_Toggle({ |
||||||
732 | bToggleEnabled: true, |
||||||
733 | bCurrentlyCollapsed: true, |
||||||
734 | aSwappableContainers: [ |
||||||
735 | \'msg_', $post_id, '_body\', |
||||||
736 | \'msg_', $post_id, '_quote\', |
||||||
737 | ], |
||||||
738 | aSwapLinks: [ |
||||||
739 | { |
||||||
740 | sId: \'msg_', $post_id, '_ignored_link\', |
||||||
741 | msgExpanded: \'\', |
||||||
742 | msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), ' |
||||||
743 | } |
||||||
744 | ] |
||||||
745 | });'; |
||||||
746 | } |
||||||
747 | |||||||
748 | echo ' |
||||||
749 | function insertQuoteFast(messageid) |
||||||
750 | { |
||||||
751 | var e = document.getElementById("', $context['post_box_name'], '"); |
||||||
752 | sceditor.instance(e).insertQuoteFast(messageid); |
||||||
753 | |||||||
754 | return true; |
||||||
755 | } |
||||||
756 | function onReceiveOpener(text) |
||||||
757 | { |
||||||
758 | var e = document.getElementById("', $context['post_box_name'], '"); |
||||||
759 | sceditor.instance(e).insert(text); |
||||||
760 | } |
||||||
761 | </script>'; |
||||||
762 | } |
||||||
763 | } |
||||||
764 | |||||||
765 | /** |
||||||
766 | * The template for the spellchecker. |
||||||
767 | */ |
||||||
768 | function template_spellcheck() |
||||||
769 | { |
||||||
770 | global $context, $settings, $txt, $modSettings; |
||||||
771 | |||||||
772 | // The style information that makes the spellchecker look... like the forum hopefully! |
||||||
773 | echo '<!DOCTYPE html> |
||||||
774 | <html', $context['right_to_left'] ? ' dir="rtl"' : '', '> |
||||||
775 | <head> |
||||||
776 | <meta charset="', $context['character_set'], '"> |
||||||
777 | <title>', $txt['spell_check'], '</title> |
||||||
778 | <link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $context['browser_cache'], '"> |
||||||
779 | <style> |
||||||
780 | body, td { |
||||||
781 | font-size: small; |
||||||
782 | margin: 0; |
||||||
783 | background: #f0f0f0; |
||||||
784 | color: #000; |
||||||
785 | padding: 10px; |
||||||
786 | } |
||||||
787 | .highlight { |
||||||
788 | color: red; |
||||||
789 | font-weight: bold; |
||||||
790 | } |
||||||
791 | #spellview { |
||||||
792 | border-style: outset; |
||||||
793 | border: 1px solid black; |
||||||
794 | padding: 5px; |
||||||
795 | width: 95%; |
||||||
796 | height: 314px; |
||||||
797 | overflow: auto; |
||||||
798 | background: #ffffff; |
||||||
799 | }'; |
||||||
800 | |||||||
801 | // As you may expect - we need a lot of javascript for this... load it from the separate files. |
||||||
802 | echo ' |
||||||
803 | </style> |
||||||
804 | <script> |
||||||
805 | var spell_formname = window.opener.spell_formname; |
||||||
806 | var spell_fieldname = window.opener.spell_fieldname; |
||||||
807 | </script> |
||||||
808 | <script src="', $settings['default_theme_url'], '/scripts/spellcheck.js', $context['browser_cache'], '"></script> |
||||||
809 | <script src="', $settings['default_theme_url'], '/scripts/script.js', $context['browser_cache'], '"></script> |
||||||
810 | <script> |
||||||
811 | ', $context['spell_js'], ' |
||||||
812 | </script> |
||||||
813 | </head> |
||||||
814 | <body onload="nextWord(false);"> |
||||||
815 | <form action="#" method="post" accept-charset="', $context['character_set'], '" name="spellingForm" id="spellingForm" onsubmit="return false;"> |
||||||
816 | <div id="spellview"> </div> |
||||||
817 | <table width="100%"> |
||||||
818 | <tr class="windowbg"> |
||||||
819 | <td style="width: 50%; vertical-align: top"> |
||||||
820 | ', $txt['spellcheck_change_to'], '<br> |
||||||
821 | <input type="text" name="changeto" style="width: 98%;"> |
||||||
822 | </td> |
||||||
823 | <td style="width: 50%"> |
||||||
824 | ', $txt['spellcheck_suggest'], '<br> |
||||||
825 | <select name="suggestions" style="width: 98%;" size="5" onclick="if (this.selectedIndex != -1) this.form.changeto.value = this.options[this.selectedIndex].text;" ondblclick="replaceWord();"> |
||||||
826 | </select> |
||||||
827 | </td> |
||||||
828 | </tr> |
||||||
829 | </table> |
||||||
830 | <div class="righttext" style="padding: 4px;"> |
||||||
831 | <input type="button" name="change" value="', $txt['spellcheck_change'], '" onclick="replaceWord();" class="button"> |
||||||
832 | <input type="button" name="changeall" value="', $txt['spellcheck_change_all'], '" onclick="replaceAll();" class="button"> |
||||||
833 | <input type="button" name="ignore" value="', $txt['spellcheck_ignore'], '" onclick="nextWord(false);" class="button"> |
||||||
834 | <input type="button" name="ignoreall" value="', $txt['spellcheck_ignore_all'], '" onclick="nextWord(true);" class="button"> |
||||||
835 | </div> |
||||||
836 | </form> |
||||||
837 | </body> |
||||||
838 | </html>'; |
||||||
839 | } |
||||||
840 | |||||||
841 | /** |
||||||
842 | * The template for the AJAX quote feature |
||||||
843 | */ |
||||||
844 | function template_quotefast() |
||||||
845 | { |
||||||
846 | global $context, $settings, $txt, $modSettings; |
||||||
847 | |||||||
848 | echo '<!DOCTYPE html> |
||||||
849 | <html', $context['right_to_left'] ? ' dir="rtl"' : '', '> |
||||||
850 | <head> |
||||||
851 | <meta charset="', $context['character_set'], '"> |
||||||
852 | <title>', $txt['retrieving_quote'], '</title> |
||||||
853 | <script src="', $settings['default_theme_url'], '/scripts/script.js', $context['browser_cache'], '"></script> |
||||||
854 | </head> |
||||||
855 | <body> |
||||||
856 | ', $txt['retrieving_quote'], ' |
||||||
857 | <div id="temporary_posting_area" style="display: none;"></div> |
||||||
858 | <script>'; |
||||||
859 | |||||||
860 | if ($context['close_window']) |
||||||
861 | echo ' |
||||||
862 | window.close();'; |
||||||
863 | else |
||||||
864 | { |
||||||
865 | // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;) |
||||||
866 | echo ' |
||||||
867 | var quote = \'', $context['quote']['text'], '\'; |
||||||
868 | var stage = \'createElement\' in document ? document.createElement("DIV") : document.getElementById("temporary_posting_area"); |
||||||
869 | |||||||
870 | if (\'DOMParser\' in window && !(\'opera\' in window)) |
||||||
871 | { |
||||||
872 | var xmldoc = new DOMParser().parseFromString("<temp>" + \'', $context['quote']['mozilla'], '\'.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_") + "</temp>", "text/xml"); |
||||||
873 | quote = xmldoc.childNodes[0].textContent.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t"); |
||||||
874 | } |
||||||
875 | else if (\'innerText\' in stage) |
||||||
876 | { |
||||||
877 | setInnerHTML(stage, quote.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_").replace(/</g, "<").replace(/>/g, ">")); |
||||||
878 | quote = stage.innerText.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t"); |
||||||
879 | } |
||||||
880 | |||||||
881 | if (\'opera\' in window) |
||||||
882 | quote = quote.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, \'"\').replace(/&/g, "&"); |
||||||
883 | |||||||
884 | window.opener.onReceiveOpener(quote); |
||||||
885 | |||||||
886 | window.focus(); |
||||||
887 | setTimeout("window.close();", 400);'; |
||||||
888 | } |
||||||
889 | echo ' |
||||||
890 | </script> |
||||||
891 | </body> |
||||||
892 | </html>'; |
||||||
893 | } |
||||||
894 | |||||||
895 | /** |
||||||
896 | * The form for sending out an announcement |
||||||
897 | */ |
||||||
898 | function template_announce() |
||||||
899 | { |
||||||
900 | global $context, $txt, $scripturl; |
||||||
901 | |||||||
902 | echo ' |
||||||
903 | <div id="announcement"> |
||||||
904 | <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '"> |
||||||
905 | <div class="cat_bar"> |
||||||
906 | <h3 class="catbg">', $txt['announce_title'], '</h3> |
||||||
907 | </div> |
||||||
908 | <div class="information"> |
||||||
909 | ', $txt['announce_desc'], ' |
||||||
910 | </div> |
||||||
911 | <div class="windowbg"> |
||||||
912 | <p> |
||||||
913 | ', $txt['announce_this_topic'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0">', $context['topic_subject'], '</a> |
||||||
914 | </p> |
||||||
915 | <ul>'; |
||||||
916 | |||||||
917 | foreach ($context['groups'] as $group) |
||||||
918 | echo ' |
||||||
919 | <li> |
||||||
920 | <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em> |
||||||
921 | </li>'; |
||||||
922 | |||||||
923 | echo ' |
||||||
924 | <li> |
||||||
925 | <label for="checkall"><input type="checkbox" id="checkall" onclick="invertAll(this, this.form);" checked> <em>', $txt['check_all'], '</em></label> |
||||||
926 | </li> |
||||||
927 | </ul> |
||||||
928 | <hr> |
||||||
929 | <div id="confirm_buttons"> |
||||||
930 | <input type="submit" value="', $txt['post'], '" class="button"> |
||||||
931 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||||||
932 | <input type="hidden" name="topic" value="', $context['current_topic'], '"> |
||||||
933 | <input type="hidden" name="move" value="', $context['move'], '"> |
||||||
934 | <input type="hidden" name="goback" value="', $context['go_back'], '"> |
||||||
935 | </div> |
||||||
936 | <br class="clear_right"> |
||||||
937 | </div><!-- .windowbg --> |
||||||
938 | </form> |
||||||
939 | </div><!-- #announcement --> |
||||||
940 | <br>'; |
||||||
941 | } |
||||||
942 | |||||||
943 | /** |
||||||
944 | * The confirmation/progress page, displayed after the admin has clicked the button to send the announcement. |
||||||
945 | */ |
||||||
946 | function template_announcement_send() |
||||||
947 | { |
||||||
948 | global $context, $txt, $scripturl; |
||||||
949 | |||||||
950 | echo ' |
||||||
951 | <div id="announcement"> |
||||||
952 | <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit"> |
||||||
953 | <div class="windowbg"> |
||||||
954 | <p> |
||||||
955 | ', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank" rel="noopener">', $context['topic_subject'], '</a> |
||||||
956 | </p> |
||||||
957 | <div class="progress_bar"> |
||||||
958 | <span>', $context['percentage_done'], '% ', $txt['announce_done'], '</span> |
||||||
959 | <div class="bar" style="width: ', $context['percentage_done'], '%;"></div> |
||||||
960 | </div> |
||||||
961 | <hr> |
||||||
962 | <div id="confirm_buttons"> |
||||||
963 | <input type="submit" name="b" value="', $txt['announce_continue'], '" class="button"> |
||||||
964 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||||||
965 | <input type="hidden" name="topic" value="', $context['current_topic'], '"> |
||||||
966 | <input type="hidden" name="move" value="', $context['move'], '"> |
||||||
967 | <input type="hidden" name="goback" value="', $context['go_back'], '"> |
||||||
968 | <input type="hidden" name="start" value="', $context['start'], '"> |
||||||
969 | <input type="hidden" name="membergroups" value="', $context['membergroups'], '"> |
||||||
970 | </div> |
||||||
971 | <br class="clear_right"> |
||||||
972 | </div><!-- .windowbg --> |
||||||
973 | </form> |
||||||
974 | </div><!-- #announcement --> |
||||||
975 | <br> |
||||||
976 | <script> |
||||||
977 | var countdown = 2; |
||||||
978 | doAutoSubmit(); |
||||||
979 | |||||||
980 | function doAutoSubmit() |
||||||
981 | { |
||||||
982 | if (countdown == 0) |
||||||
983 | document.forms.autoSubmit.submit(); |
||||||
984 | else if (countdown == -1) |
||||||
985 | return; |
||||||
986 | |||||||
987 | document.forms.autoSubmit.b.value = "', $txt['announce_continue'], ' (" + countdown + ")"; |
||||||
988 | countdown--; |
||||||
989 | |||||||
990 | setTimeout("doAutoSubmit();", 1000); |
||||||
991 | } |
||||||
992 | </script>'; |
||||||
993 | } |
||||||
994 | |||||||
995 | /** |
||||||
996 | * Prints the input fields in the form's header (subject, message icon, guest name & email, etc.) |
||||||
997 | * |
||||||
998 | * Mod authors can use the 'integrate_post_end' hook to modify or add to these (see Post.php). |
||||||
999 | * |
||||||
1000 | * Theme authors can customize the output in a couple different ways: |
||||||
1001 | * 1. Change specific values in the $context['posting_fields'] array. |
||||||
1002 | * 2. Add an 'html' element to the 'label' and/or 'input' elements of the field they want to |
||||||
1003 | * change. This should contain the literal HTML string to be printed. |
||||||
1004 | * |
||||||
1005 | * See the documentation in Post.php for more info on the $context['posting_fields'] array. |
||||||
1006 | */ |
||||||
1007 | function template_post_header() |
||||||
1008 | { |
||||||
1009 | global $context, $txt; |
||||||
1010 | |||||||
1011 | // Sanity check: submitting the form won't work without at least a subject field |
||||||
1012 | if (empty($context['posting_fields']['subject']) || !is_array($context['posting_fields']['subject'])) |
||||||
1013 | { |
||||||
1014 | $context['posting_fields']['subject'] = array( |
||||||
1015 | 'label' => array('html' => '<label for="subject" id="caption_subject">' . $txt['subject'] . '</label>'), |
||||||
1016 | 'input' => array('html' => '<input type="text" id="subject" name="subject" value="' . $context['subject'] . '" size="80" maxlength="80" required>') |
||||||
1017 | ); |
||||||
1018 | } |
||||||
1019 | |||||||
1020 | // THEME AUTHORS: Above this line is a great place to make customizations to the posting_fields array |
||||||
1021 | |||||||
1022 | // Start printing the header |
||||||
1023 | echo ' |
||||||
1024 | <dl id="post_header">'; |
||||||
1025 | |||||||
1026 | foreach ($context['posting_fields'] as $pfid => $pf) |
||||||
1027 | { |
||||||
1028 | // We need both a label and an input |
||||||
1029 | if (empty($pf['label']) || empty($pf['input'])) |
||||||
1030 | continue; |
||||||
1031 | |||||||
1032 | // The labels are pretty simple... |
||||||
1033 | echo ' |
||||||
1034 | <dt class="clear pf_', $pfid, '">'; |
||||||
1035 | |||||||
1036 | // Any leading HTML before the label |
||||||
1037 | if (!empty($pf['label']['before'])) |
||||||
1038 | echo ' |
||||||
1039 | ', $pf['label']['before']; |
||||||
1040 | |||||||
1041 | if (!empty($pf['label']['html'])) |
||||||
1042 | echo $pf['label']['html']; |
||||||
1043 | else |
||||||
1044 | echo ' |
||||||
1045 | <label', ($pf['input']['type'] === 'radio_select' ? '' : ' for="' . (!empty($pf['input']['attributes']['id']) ? $pf['input']['attributes']['id'] : $pfid) . '"'), ' id="caption_', $pfid, '"', !empty($pf['label']['class']) ? ' class="' . $pf['label']['class'] . '"' : '', '>', $pf['label']['text'], '</label>'; |
||||||
1046 | |||||||
1047 | // Any trailing HTML after the label |
||||||
1048 | if (!empty($pf['label']['after'])) |
||||||
1049 | echo ' |
||||||
1050 | ', $pf['label']['after']; |
||||||
1051 | |||||||
1052 | echo ' |
||||||
1053 | </dt>'; |
||||||
1054 | |||||||
1055 | // Here's where the fun begins... |
||||||
1056 | echo ' |
||||||
1057 | <dd class="pf_', $pfid, '">'; |
||||||
1058 | |||||||
1059 | // Any leading HTML before the main input |
||||||
1060 | if (!empty($pf['input']['before'])) |
||||||
1061 | echo ' |
||||||
1062 | ', $pf['input']['before']; |
||||||
1063 | |||||||
1064 | // If there is a literal HTML string already defined, just print it. |
||||||
1065 | if (!empty($pf['input']['html'])) |
||||||
1066 | { |
||||||
1067 | echo $pf['input']['html']; |
||||||
1068 | } |
||||||
1069 | // Simple text inputs and checkboxes |
||||||
1070 | elseif (in_array($pf['input']['type'], array('text', 'password', 'color', 'date', 'datetime-local', 'email', 'month', 'number', 'range', 'tel', 'time', 'url', 'week', 'checkbox'))) |
||||||
1071 | { |
||||||
1072 | echo ' |
||||||
1073 | <input type="', $pf['input']['type'], '"'; |
||||||
1074 | |||||||
1075 | if (empty($pf['input']['attributes']['id'])) |
||||||
1076 | echo ' id="', $pfid, '"'; |
||||||
1077 | |||||||
1078 | if (empty($pf['input']['attributes']['name'])) |
||||||
1079 | echo ' name="', $pfid, '"'; |
||||||
1080 | |||||||
1081 | if (!empty($pf['input']['attributes']) && is_array($pf['input']['attributes'])) |
||||||
1082 | { |
||||||
1083 | foreach ($pf['input']['attributes'] as $attribute => $value) |
||||||
1084 | { |
||||||
1085 | if (is_bool($value)) |
||||||
1086 | echo $value ? ' ' . $attribute : ''; |
||||||
1087 | else |
||||||
1088 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1089 | } |
||||||
1090 | } |
||||||
1091 | |||||||
1092 | echo ' tabindex="', $context['tabindex']++, '">'; |
||||||
1093 | } |
||||||
1094 | // textarea |
||||||
1095 | elseif ($pf['input']['type'] === 'textarea') |
||||||
1096 | { |
||||||
1097 | echo ' |
||||||
1098 | <textarea'; |
||||||
1099 | |||||||
1100 | if (empty($pf['input']['attributes']['id'])) |
||||||
1101 | echo ' id="', $pfid, '"'; |
||||||
1102 | |||||||
1103 | if (empty($pf['input']['attributes']['name'])) |
||||||
1104 | echo ' name="', $pfid, '"'; |
||||||
1105 | |||||||
1106 | if (!empty($pf['input']['attributes']) && is_array($pf['input']['attributes'])) |
||||||
1107 | { |
||||||
1108 | foreach ($pf['input']['attributes'] as $attribute => $value) |
||||||
1109 | { |
||||||
1110 | if ($attribute === 'value') |
||||||
1111 | continue; |
||||||
1112 | elseif (is_bool($value)) |
||||||
1113 | echo $value ? ' ' . $attribute : ''; |
||||||
1114 | else |
||||||
1115 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1116 | } |
||||||
1117 | } |
||||||
1118 | |||||||
1119 | echo ' tabindex="', $context['tabindex']++, '">', !empty($pf['input']['attributes']['value']) ? $pf['input']['attributes']['value'] : '', '</textarea>'; |
||||||
1120 | } |
||||||
1121 | // Select menus are more complicated |
||||||
1122 | elseif ($pf['input']['type'] === 'select' && is_array($pf['input']['options'])) |
||||||
1123 | { |
||||||
1124 | // The select element itself |
||||||
1125 | echo ' |
||||||
1126 | <select'; |
||||||
1127 | |||||||
1128 | if (empty($pf['input']['attributes']['id'])) |
||||||
1129 | echo ' id="', $pfid, '"'; |
||||||
1130 | |||||||
1131 | if (empty($pf['input']['attributes']['name'])) |
||||||
1132 | echo ' name="', $pfid, '"'; |
||||||
1133 | |||||||
1134 | if (!empty($pf['input']['attributes']) && is_array($pf['input']['attributes'])) |
||||||
1135 | { |
||||||
1136 | foreach ($pf['input']['attributes'] as $attribute => $value) |
||||||
1137 | { |
||||||
1138 | if (is_bool($value)) |
||||||
1139 | echo $value ? ' ' . $attribute : ''; |
||||||
1140 | else |
||||||
1141 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1142 | } |
||||||
1143 | } |
||||||
1144 | |||||||
1145 | echo ' tabindex="', $context['tabindex']++, '">'; |
||||||
1146 | |||||||
1147 | // The options |
||||||
1148 | foreach ($pf['input']['options'] as $optlabel => $option) |
||||||
1149 | { |
||||||
1150 | // An option containing options is an optgroup |
||||||
1151 | if (!empty($option['options']) && is_array($option['options'])) |
||||||
1152 | { |
||||||
1153 | echo ' |
||||||
1154 | <optgroup'; |
||||||
1155 | |||||||
1156 | if (empty($option['label'])) |
||||||
1157 | echo ' label="', $optlabel, '"'; |
||||||
1158 | |||||||
1159 | if (!empty($option) && is_array($option)) |
||||||
1160 | { |
||||||
1161 | foreach ($option as $attribute => $value) |
||||||
1162 | { |
||||||
1163 | if ($attribute === 'options') |
||||||
1164 | continue; |
||||||
1165 | elseif (is_bool($value)) |
||||||
1166 | echo $value ? ' ' . $attribute : ''; |
||||||
1167 | else |
||||||
1168 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1169 | } |
||||||
1170 | } |
||||||
1171 | |||||||
1172 | echo '>'; |
||||||
1173 | |||||||
1174 | foreach ($option['options'] as $grouped_optlabel => $grouped_option) |
||||||
1175 | { |
||||||
1176 | echo ' |
||||||
1177 | <option'; |
||||||
1178 | |||||||
1179 | foreach ($grouped_option as $attribute => $value) |
||||||
1180 | { |
||||||
1181 | if (is_bool($value)) |
||||||
1182 | echo $value ? ' ' . $attribute : ''; |
||||||
1183 | else |
||||||
1184 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1185 | } |
||||||
1186 | |||||||
1187 | echo '>', $grouped_option['label'], '</option>'; |
||||||
1188 | |||||||
1189 | } |
||||||
1190 | |||||||
1191 | echo ' |
||||||
1192 | </optgroup>'; |
||||||
1193 | } |
||||||
1194 | // Simple option |
||||||
1195 | else |
||||||
1196 | { |
||||||
1197 | echo ' |
||||||
1198 | <option'; |
||||||
1199 | |||||||
1200 | foreach ($option as $attribute => $value) |
||||||
1201 | { |
||||||
1202 | if (is_bool($value)) |
||||||
1203 | echo $value ? ' ' . $attribute : ''; |
||||||
1204 | else |
||||||
1205 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1206 | } |
||||||
1207 | |||||||
1208 | echo '>', $optlabel, '</option>'; |
||||||
1209 | } |
||||||
1210 | } |
||||||
1211 | |||||||
1212 | // Close the select element |
||||||
1213 | echo ' |
||||||
1214 | </select>'; |
||||||
1215 | } |
||||||
1216 | // Radio_select makes a div with some radio buttons in it |
||||||
1217 | elseif ($pf['input']['type'] === 'radio_select' && is_array($pf['input']['options'])) |
||||||
1218 | { |
||||||
1219 | echo ' |
||||||
1220 | <div'; |
||||||
1221 | |||||||
1222 | if (!empty($pf['input']['attributes']) && is_array($pf['input']['attributes'])) |
||||||
1223 | { |
||||||
1224 | foreach ($pf['input']['attributes'] as $attribute => $value) |
||||||
1225 | { |
||||||
1226 | if ($attribute === 'name') |
||||||
1227 | continue; |
||||||
1228 | elseif (is_bool($value)) |
||||||
1229 | echo $value ? ' ' . $attribute : ''; |
||||||
1230 | else |
||||||
1231 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1232 | } |
||||||
1233 | } |
||||||
1234 | |||||||
1235 | echo '>'; |
||||||
1236 | |||||||
1237 | foreach ($pf['input']['options'] as $optlabel => $option) |
||||||
1238 | { |
||||||
1239 | echo ' |
||||||
1240 | <label style="margin-right:2ch"><input type="radio" name="', !empty($pf['input']['attributes']['name']) ? $pf['input']['attributes']['name'] : $pfid, '"'; |
||||||
1241 | |||||||
1242 | foreach ($option as $attribute => $value) |
||||||
1243 | { |
||||||
1244 | if ($attribute === 'label') |
||||||
1245 | continue; |
||||||
1246 | elseif (is_bool($value)) |
||||||
1247 | echo $value ? ' ' . ($attribute === 'selected' ? 'checked' : $attribute) : ''; |
||||||
1248 | else |
||||||
1249 | echo ' ', $attribute, '="', $value, '"'; |
||||||
1250 | } |
||||||
1251 | |||||||
1252 | echo ' tabindex="', $context['tabindex']++, '"> ', isset($option['label']) ? $option['label'] : $optlabel, '</label>'; |
||||||
1253 | } |
||||||
1254 | |||||||
1255 | echo ' |
||||||
1256 | </div>'; |
||||||
1257 | } |
||||||
1258 | |||||||
1259 | // Any trailing HTML after the main input |
||||||
1260 | if (!empty($pf['input']['after'])) |
||||||
1261 | echo ' |
||||||
1262 | ', $pf['input']['after']; |
||||||
1263 | |||||||
1264 | echo ' |
||||||
1265 | </dd>'; |
||||||
1266 | } |
||||||
1267 | |||||||
1268 | echo ' |
||||||
1269 | </dl>'; |
||||||
1270 | } |
||||||
1271 | |||||||
1272 | ?> |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.