1 | <?php |
||
2 | /** |
||
3 | * Simple Machines Forum (SMF) |
||
4 | * |
||
5 | * @package SMF |
||
6 | * @author Simple Machines https://www.simplemachines.org |
||
7 | * @copyright 2023 Simple Machines and individual contributors |
||
8 | * @license https://www.simplemachines.org/about/smf/license.php BSD |
||
9 | * |
||
10 | * @version 2.1.4 |
||
11 | */ |
||
12 | |||
13 | /** |
||
14 | * The main moderation center. |
||
15 | */ |
||
16 | function template_moderation_center() |
||
17 | { |
||
18 | global $context; |
||
19 | |||
20 | // Show moderators notes. |
||
21 | template_notes(); |
||
22 | |||
23 | // Show a welcome message to the user. |
||
24 | echo ' |
||
25 | <div id="modcenter">'; |
||
26 | |||
27 | // Show all the blocks they want to see. |
||
28 | foreach ($context['mod_blocks'] as $block) |
||
29 | { |
||
30 | $block_function = 'template_' . $block; |
||
31 | |||
32 | echo ' |
||
33 | <div class="half_content">', function_exists($block_function) ? $block_function() : '', '</div>'; |
||
34 | } |
||
35 | |||
36 | echo ' |
||
37 | </div><!-- #modcenter -->'; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Show all the group requests the user can see. |
||
42 | */ |
||
43 | function template_group_requests_block() |
||
44 | { |
||
45 | global $context, $txt, $scripturl; |
||
46 | |||
47 | echo ' |
||
48 | <div class="cat_bar"> |
||
49 | <h3 class="catbg"> |
||
50 | <span id="group_requests_toggle" class="', !empty($context['admin_prefs']['mcgr']) ? 'toggle_down' : 'toggle_up', ' floatright" title="', empty($context['admin_prefs']['mcgr']) ? $txt['hide'] : $txt['show'], '" style="display: none;"></span> |
||
51 | <a href="', $scripturl, '?action=groups;sa=requests" id="group_requests_link">', $txt['mc_group_requests'], '</a> |
||
52 | </h3> |
||
53 | </div> |
||
54 | <div class="windowbg" id="group_requests_panel"> |
||
55 | <ul>'; |
||
56 | |||
57 | foreach ($context['group_requests'] as $request) |
||
58 | echo ' |
||
59 | <li class="smalltext"> |
||
60 | <a href="', $request['request_href'], '">', $request['group']['name'], '</a> ', $txt['mc_groupr_by'], ' ', $request['member']['link'], ' |
||
61 | </li>'; |
||
62 | |||
63 | // Don't have any watched users right now? |
||
64 | if (empty($context['group_requests'])) |
||
65 | echo ' |
||
66 | <li> |
||
67 | <strong class="smalltext">', $txt['mc_group_requests_none'], '</strong> |
||
68 | </li>'; |
||
69 | |||
70 | echo ' |
||
71 | </ul> |
||
72 | </div><!-- #group_requests_panel --> |
||
73 | |||
74 | <script> |
||
75 | var oGroupRequestsPanelToggle = new smc_Toggle({ |
||
76 | bToggleEnabled: true, |
||
77 | bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcgr']) ? 'true' : 'false', ', |
||
78 | aSwappableContainers: [ |
||
79 | \'group_requests_panel\' |
||
80 | ], |
||
81 | aSwapImages: [ |
||
82 | { |
||
83 | sId: \'group_requests_toggle\', |
||
84 | altExpanded: ', JavaScriptEscape($txt['hide']), ', |
||
85 | altCollapsed: ', JavaScriptEscape($txt['show']), ' |
||
86 | } |
||
87 | ], |
||
88 | aSwapLinks: [ |
||
89 | { |
||
90 | sId: \'group_requests_link\', |
||
91 | msgExpanded: ', JavaScriptEscape($txt['mc_group_requests']), ', |
||
92 | msgCollapsed: ', JavaScriptEscape($txt['mc_group_requests']), ' |
||
93 | } |
||
94 | ], |
||
95 | oThemeOptions: { |
||
96 | bUseThemeSettings: true, |
||
97 | sOptionName: \'admin_preferences\', |
||
98 | sSessionVar: smf_session_var, |
||
99 | sSessionId: smf_session_id, |
||
100 | sThemeId: \'1\', |
||
101 | sAdditionalVars: \';admin_key=mcgr\' |
||
102 | } |
||
103 | }); |
||
104 | </script>'; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * A list of watched users |
||
109 | */ |
||
110 | function template_watched_users() |
||
111 | { |
||
112 | global $context, $txt, $scripturl; |
||
113 | |||
114 | echo ' |
||
115 | <div class="cat_bar"> |
||
116 | <h3 class="catbg"> |
||
117 | <span id="watched_users_toggle" class="', !empty($context['admin_prefs']['mcwu']) ? 'toggle_down' : 'toggle_up', ' floatright" title="', empty($context['admin_prefs']['mcwu']) ? $txt['hide'] : $txt['show'], '" style="display: none;"></span> |
||
118 | <a href="', $scripturl, '?action=moderate;area=userwatch" id="watched_users_link">', $txt['mc_watched_users'], '</a> |
||
119 | </h3> |
||
120 | </div> |
||
121 | <div class="windowbg" id="watched_users_panel"> |
||
122 | <ul>'; |
||
123 | |||
124 | foreach ($context['watched_users'] as $user) |
||
125 | echo ' |
||
126 | <li> |
||
127 | <span class="smalltext">', sprintf(!empty($user['last_login']) ? $txt['mc_seen'] : $txt['mc_seen_never'], $user['link'], $user['last_login']), '</span> |
||
128 | </li>'; |
||
129 | |||
130 | // Don't have any watched users right now? |
||
131 | if (empty($context['watched_users'])) |
||
132 | echo ' |
||
133 | <li> |
||
134 | <strong class="smalltext">', $txt['mc_watched_users_none'], '</strong> |
||
135 | </li>'; |
||
136 | |||
137 | echo ' |
||
138 | </ul> |
||
139 | </div><!-- #watched_users_panel --> |
||
140 | |||
141 | <script> |
||
142 | var oWatchedUsersToggle = new smc_Toggle({ |
||
143 | bToggleEnabled: true, |
||
144 | bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcwu']) ? 'true' : 'false', ', |
||
145 | aSwappableContainers: [ |
||
146 | \'watched_users_panel\' |
||
147 | ], |
||
148 | aSwapImages: [ |
||
149 | { |
||
150 | sId: \'watched_users_toggle\', |
||
151 | altExpanded: ', JavaScriptEscape($txt['hide']), ', |
||
152 | altCollapsed: ', JavaScriptEscape($txt['show']), ' |
||
153 | } |
||
154 | ], |
||
155 | aSwapLinks: [ |
||
156 | { |
||
157 | sId: \'watched_users_link\', |
||
158 | msgExpanded: ', JavaScriptEscape($txt['mc_watched_users']), ', |
||
159 | msgCollapsed: ', JavaScriptEscape($txt['mc_watched_users']), ' |
||
160 | } |
||
161 | ], |
||
162 | oThemeOptions: { |
||
163 | bUseThemeSettings: true, |
||
164 | sOptionName: \'admin_preferences\', |
||
165 | sSessionVar: smf_session_var, |
||
166 | sSessionId: smf_session_id, |
||
167 | sThemeId: \'1\', |
||
168 | sAdditionalVars: \';admin_key=mcwu\' |
||
169 | } |
||
170 | }); |
||
171 | </script>'; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * A list of reported posts |
||
176 | */ |
||
177 | function template_reported_posts_block() |
||
178 | { |
||
179 | global $context, $txt, $scripturl; |
||
180 | |||
181 | echo ' |
||
182 | <div class="cat_bar"> |
||
183 | <h3 class="catbg"> |
||
184 | <span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" title="', empty($context['admin_prefs']['mcrp']) ? $txt['hide'] : $txt['show'], '" style="display: none;"></span> |
||
185 | <a href="', $scripturl, '?action=moderate;area=reportedposts" id="reported_posts_link">', $txt['mc_recent_reports'], '</a> |
||
186 | </h3> |
||
187 | </div> |
||
188 | <div class="windowbg" id="reported_posts_panel"> |
||
189 | <ul>'; |
||
190 | |||
191 | foreach ($context['reported_posts'] as $post) |
||
192 | echo ' |
||
193 | <li> |
||
194 | <span class="smalltext">', sprintf($txt['mc_post_report'], $post['report_link'], $post['author']['link']), '</span> |
||
195 | </li>'; |
||
196 | |||
197 | // Don't have any watched users right now? |
||
198 | if (empty($context['reported_posts'])) |
||
199 | echo ' |
||
200 | <li> |
||
201 | <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong> |
||
202 | </li>'; |
||
203 | |||
204 | echo ' |
||
205 | </ul> |
||
206 | </div><!-- #reported_posts_panel --> |
||
207 | |||
208 | <script> |
||
209 | var oWatchedUsersToggle = new smc_Toggle({ |
||
210 | bToggleEnabled: true, |
||
211 | bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ', |
||
212 | aSwappableContainers: [ |
||
213 | \'reported_posts_panel\' |
||
214 | ], |
||
215 | aSwapImages: [ |
||
216 | { |
||
217 | sId: \'reported_posts_toggle\', |
||
218 | altExpanded: ', JavaScriptEscape($txt['hide']), ', |
||
219 | altCollapsed: ', JavaScriptEscape($txt['show']), ' |
||
220 | } |
||
221 | ], |
||
222 | aSwapLinks: [ |
||
223 | { |
||
224 | sId: \'reported_posts_link\', |
||
225 | msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ', |
||
226 | msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), ' |
||
227 | } |
||
228 | ], |
||
229 | oThemeOptions: { |
||
230 | bUseThemeSettings: true, |
||
231 | sOptionName: \'admin_preferences\', |
||
232 | sSessionVar: smf_session_var, |
||
233 | sSessionId: smf_session_id, |
||
234 | sThemeId: \'1\', |
||
235 | sAdditionalVars: \';admin_key=mcrp\' |
||
236 | } |
||
237 | }); |
||
238 | </script>'; |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * A list of reported users |
||
243 | */ |
||
244 | function template_reported_users_block() |
||
245 | { |
||
246 | global $context, $txt, $scripturl; |
||
247 | |||
248 | echo ' |
||
249 | <div class="cat_bar"> |
||
250 | <h3 class="catbg"> |
||
251 | <span id="reported_users_toggle" class="', !empty($context['admin_prefs']['mcur']) ? 'toggle_down' : 'toggle_up', ' floatright" title="', empty($context['admin_prefs']['mcur']) ? $txt['hide'] : $txt['show'], '" style="display: none;"></span> |
||
252 | <a href="', $scripturl, '?action=moderate;area=userwatch" id="reported_users_link">', $txt['mc_recent_user_reports'], '</a> |
||
253 | </h3> |
||
254 | </div> |
||
255 | <div class="windowbg" id="reported_users_panel"> |
||
256 | <ul>'; |
||
257 | |||
258 | foreach ($context['reported_users'] as $user) |
||
259 | echo ' |
||
260 | <li> |
||
261 | <span class="smalltext">', $user['user']['link'], '</span> |
||
262 | </li>'; |
||
263 | |||
264 | // Don't have any watched users right now? |
||
265 | if (empty($context['reported_users'])) |
||
266 | echo ' |
||
267 | <li> |
||
268 | <strong class="smalltext">', $txt['mc_reported_users_none'], '</strong> |
||
269 | </li>'; |
||
270 | |||
271 | echo ' |
||
272 | </ul> |
||
273 | </div><!-- #reported_users_panel --> |
||
274 | |||
275 | <script> |
||
276 | var oWatchedUsersToggle = new smc_Toggle({ |
||
277 | bToggleEnabled: true, |
||
278 | bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcur']) ? 'true' : 'false', ', |
||
279 | aSwappableContainers: [ |
||
280 | \'reported_users_panel\' |
||
281 | ], |
||
282 | aSwapImages: [ |
||
283 | { |
||
284 | sId: \'reported_users_toggle\', |
||
285 | altExpanded: ', JavaScriptEscape($txt['hide']), ', |
||
286 | altCollapsed: ', JavaScriptEscape($txt['show']), ' |
||
287 | } |
||
288 | ], |
||
289 | aSwapLinks: [ |
||
290 | { |
||
291 | sId: \'reported_users_link\', |
||
292 | msgExpanded: ', JavaScriptEscape($txt['mc_recent_user_reports']), ', |
||
293 | msgCollapsed: ', JavaScriptEscape($txt['mc_recent_user_reports']), ' |
||
294 | } |
||
295 | ], |
||
296 | oThemeOptions: { |
||
297 | bUseThemeSettings: true, |
||
298 | sOptionName: \'admin_preferences\', |
||
299 | sSessionVar: smf_session_var, |
||
300 | sSessionId: smf_session_id, |
||
301 | sThemeId: \'1\', |
||
302 | sAdditionalVars: \';admin_key=mcur\' |
||
303 | } |
||
304 | }); |
||
305 | </script>'; |
||
306 | } |
||
307 | |||
308 | /** |
||
309 | * Little section for making... notes. |
||
310 | */ |
||
311 | function template_notes() |
||
312 | { |
||
313 | global $context, $txt, $scripturl; |
||
314 | |||
315 | // Let them know the action was a success. |
||
316 | if (!empty($context['report_post_action'])) |
||
317 | echo ' |
||
318 | <div class="infobox"> |
||
319 | ', $txt['report_action_' . $context['report_post_action']], ' |
||
320 | </div>'; |
||
321 | |||
322 | echo ' |
||
323 | <div id="modnotes"> |
||
324 | <form action="', $scripturl, '?action=moderate;area=index;modnote" method="post"> |
||
325 | <div class="cat_bar"> |
||
326 | <h3 class="catbg">', $txt['mc_notes'], '</h3> |
||
327 | </div> |
||
328 | <div class="windowbg">'; |
||
329 | |||
330 | if (!empty($context['notes'])) |
||
331 | { |
||
332 | echo ' |
||
333 | <ul class="moderation_notes">'; |
||
334 | |||
335 | // Cycle through the notes. |
||
336 | foreach ($context['notes'] as $note) |
||
337 | echo ' |
||
338 | <li class="smalltext"> |
||
339 | ', ($note['can_delete'] ? '<a href="' . $note['delete_href'] . ';' . $context['mod-modnote-del_token_var'] . '=' . $context['mod-modnote-del_token'] . '" data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '" class="you_sure"><span class="main_icons delete"></span></a>' : ''), $note['time'], ' <strong>', $note['author']['link'], ':</strong> ', $note['text'], ' |
||
340 | </li>'; |
||
341 | |||
342 | echo ' |
||
343 | </ul> |
||
344 | <div class="pagesection notes"> |
||
345 | <div class="pagelinks">', $context['page_index'], '</div> |
||
346 | </div>'; |
||
347 | } |
||
348 | |||
349 | echo ' |
||
350 | <div class="floatleft post_note"> |
||
351 | <input type="text" name="new_note" placeholder="', $txt['mc_click_add_note'], '"> |
||
352 | </div> |
||
353 | <input type="hidden" name="', $context['mod-modnote-add_token_var'], '" value="', $context['mod-modnote-add_token'], '"> |
||
354 | <input type="submit" name="makenote" value="', $txt['mc_add_note'], '" class="button"> |
||
355 | </div><!-- .windowbg --> |
||
356 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
357 | </form> |
||
358 | </div><!-- #modnotes -->'; |
||
359 | } |
||
360 | |||
361 | /** |
||
362 | * Show a list of all the unapproved posts |
||
363 | */ |
||
364 | function template_unapproved_posts() |
||
365 | { |
||
366 | global $options, $context, $txt, $scripturl; |
||
367 | |||
368 | // Just a big table of it all really... |
||
369 | echo ' |
||
370 | <div id="modcenter"> |
||
371 | <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="', $context['character_set'], '"> |
||
372 | <div class="cat_bar', !empty($context['unapproved_items']) ? ' cat_bar_round' : '', '"> |
||
373 | <h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3> |
||
374 | </div>'; |
||
375 | |||
376 | // No posts? |
||
377 | if (empty($context['unapproved_items'])) |
||
378 | { |
||
379 | echo ' |
||
380 | <div class="windowbg"> |
||
381 | <p class="centertext"> |
||
382 | ', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], ' |
||
383 | </p> |
||
384 | </div>'; |
||
385 | } |
||
386 | else |
||
387 | { |
||
388 | echo ' |
||
389 | <div class="pagesection">'; |
||
390 | |||
391 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
||
392 | echo ' |
||
393 | <ul class="buttonlist floatright"> |
||
394 | <li class="inline_mod_check"> |
||
395 | <input type="checkbox" onclick="invertAll(this, this.form, \'item[]\');" checked> |
||
396 | </li> |
||
397 | </ul>'; |
||
398 | |||
399 | echo ' |
||
400 | <div class="pagelinks">', $context['page_index'], '</div> |
||
401 | </div>'; |
||
402 | |||
403 | } |
||
404 | |||
405 | foreach ($context['unapproved_items'] as $item) |
||
406 | { |
||
407 | // The buttons |
||
408 | $quickbuttons = array( |
||
409 | 'approve' => array( |
||
410 | 'label' => $txt['approve'], |
||
411 | 'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';approve='.$item['id'], |
||
412 | 'icon' => 'approve', |
||
413 | ), |
||
414 | 'delete' => array( |
||
415 | 'label' => $txt['remove'], |
||
416 | 'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';delete='.$item['id'], |
||
417 | 'icon' => 'remove_button', |
||
418 | 'show' => $item['can_delete'] |
||
419 | ), |
||
420 | 'quickmod' => array( |
||
421 | 'class' => 'inline_mod_check', |
||
422 | 'content' => '<input type="checkbox" name="item[]" value="'.$item['id'].'" checked>', |
||
423 | 'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 |
||
424 | ), |
||
425 | ); |
||
426 | echo ' |
||
427 | <div class="windowbg clear"> |
||
428 | <div class="page_number floatright"> #', $item['counter'], '</div> |
||
429 | <div class="topic_details"> |
||
430 | <h5> |
||
431 | <strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong> |
||
432 | </h5> |
||
433 | <span class="smalltext">', sprintf(str_replace('<br>', ' ', $txt['last_post_topic']), $item['time'], '<strong>' . $item['poster']['link'] . '</strong>'), '</span> |
||
434 | </div> |
||
435 | <div class="list_posts"> |
||
436 | <div class="post">', $item['body'], '</div> |
||
437 | </div> |
||
438 | ', template_quickbuttons($quickbuttons, 'unapproved_posts'), ' |
||
439 | </div><!-- .windowbg -->'; |
||
440 | } |
||
441 | |||
442 | echo ' |
||
443 | <div class="pagesection">'; |
||
444 | |||
445 | if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) |
||
446 | echo ' |
||
447 | <div class="floatright"> |
||
448 | <select name="do" onchange="if (this.value != 0 && confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();"> |
||
449 | <option value="0">', $txt['with_selected'], ':</option> |
||
450 | <option value="0" disabled>-------------------</option> |
||
451 | <option value="approve"> -- ', $txt['approve'], '</option> |
||
452 | <option value="delete"> -- ', $txt['delete'], '</option> |
||
453 | </select> |
||
454 | <noscript> |
||
455 | <input type="submit" name="mc_go" value="', $txt['go'], '" class="button"> |
||
456 | </noscript> |
||
457 | </div>'; |
||
458 | |||
459 | if (!empty($context['unapproved_items'])) |
||
460 | echo ' |
||
461 | <div class="pagelinks">', $context['page_index'], '</div>'; |
||
462 | |||
463 | echo ' |
||
464 | </div><!-- .pagesection --> |
||
465 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
466 | </form> |
||
467 | </div><!-- #modcenter -->'; |
||
468 | } |
||
469 | |||
470 | /** |
||
471 | * Callback function for showing a watched users post in the table. |
||
472 | * |
||
473 | * @param array $post An array of data about the post. |
||
474 | * @return string An array of HTML for showing the post info. |
||
475 | */ |
||
476 | function template_user_watch_post_callback($post) |
||
477 | { |
||
478 | global $scripturl, $context, $txt, $delete_button; |
||
479 | |||
480 | // We'll have a delete and a checkbox please bob. |
||
481 | // @todo Discuss this with the team and rewrite if required. |
||
482 | $quickbuttons = array( |
||
483 | 'delete' => array( |
||
484 | 'label' => $txt['remove_message'], |
||
485 | 'href' => $scripturl.'?action=moderate;area=userwatch;sa=post;delete='.$post['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'], |
||
486 | 'javascript' => 'data-confirm="' . $txt['mc_watched_users_delete_post'] . '"', |
||
487 | 'class' => 'you_sure', |
||
488 | 'icon' => 'remove_button', |
||
489 | 'show' => $post['can_delete'] |
||
490 | ), |
||
491 | 'quickmod' => array( |
||
492 | 'class' => 'inline_mod_check', |
||
493 | 'content' => '<input type="checkbox" name="delete[]" value="' . $post['id'] . '">', |
||
494 | 'show' => $post['can_delete'] |
||
495 | ) |
||
496 | ); |
||
497 | |||
498 | $output_html = ' |
||
499 | <div> |
||
500 | <div class="floatleft"> |
||
501 | <strong><a href="' . $scripturl . '?topic=' . $post['id_topic'] . '.' . $post['id'] . '#msg' . $post['id'] . '">' . $post['subject'] . '</a></strong> ' . $txt['mc_reportedp_by'] . ' <strong>' . $post['author_link'] . '</strong> |
||
502 | </div> |
||
503 | </div> |
||
504 | <br> |
||
505 | <div class="smalltext"> |
||
506 | ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' |
||
507 | </div> |
||
508 | <div class="list_posts"> |
||
509 | ' . $post['body'] . ' |
||
510 | </div>'; |
||
511 | |||
512 | $output_html .= template_quickbuttons($quickbuttons, 'user_watch_post', 'return'); |
||
513 | |||
514 | return $output_html; |
||
515 | } |
||
516 | |||
517 | /** |
||
518 | * The moderation settings page. |
||
519 | */ |
||
520 | function template_moderation_settings() |
||
521 | { |
||
522 | global $context, $txt, $scripturl; |
||
523 | |||
524 | echo ' |
||
525 | <div id="modcenter">'; |
||
526 | |||
527 | echo ' |
||
528 | <div class="windowbg"> |
||
529 | <div class="centertext">', $txt['mc_no_settings'], '</div> |
||
530 | </div>'; |
||
531 | |||
532 | echo ' |
||
533 | </div><!-- #modcenter -->'; |
||
534 | } |
||
535 | |||
536 | /** |
||
537 | * Show a notice sent to a user. |
||
538 | */ |
||
539 | function template_show_notice() |
||
540 | { |
||
541 | global $txt, $settings, $context, $modSettings; |
||
542 | |||
543 | // We do all the HTML for this one! |
||
544 | echo '<!DOCTYPE html> |
||
545 | <html', $context['right_to_left'] ? ' dir="rtl"' : '', '> |
||
546 | <head> |
||
547 | <meta charset="', $context['character_set'], '"> |
||
548 | <title>', $context['page_title'], '</title> |
||
549 | ', template_css(), ' |
||
0 ignored issues
–
show
|
|||
550 | </head> |
||
551 | <body> |
||
552 | <div class="cat_bar"> |
||
553 | <h3 class="catbg">', $txt['show_notice'], '</h3> |
||
554 | </div> |
||
555 | <div class="title_bar"> |
||
556 | <h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3> |
||
557 | </div> |
||
558 | <div class="windowbg"> |
||
559 | <dl> |
||
560 | <dt> |
||
561 | <strong>', $txt['show_notice_text'], ':</strong> |
||
562 | </dt> |
||
563 | <dd> |
||
564 | ', $context['notice_body'], ' |
||
565 | </dd> |
||
566 | </dl> |
||
567 | </div> |
||
568 | </body> |
||
569 | </html>'; |
||
570 | |||
571 | } |
||
572 | |||
573 | /** |
||
574 | * Add or edit a warning template. |
||
575 | */ |
||
576 | function template_warn_template() |
||
577 | { |
||
578 | global $context, $txt, $scripturl; |
||
579 | |||
580 | echo ' |
||
581 | <div id="modcenter"> |
||
582 | <form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '"> |
||
583 | <div class="cat_bar"> |
||
584 | <h3 class="catbg">', $context['page_title'], '</h3> |
||
585 | </div> |
||
586 | <div class="information"> |
||
587 | ', $txt['mc_warning_template_desc'], ' |
||
588 | </div> |
||
589 | <div class="windowbg"> |
||
590 | <div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors"> |
||
591 | <dl> |
||
592 | <dt> |
||
593 | <strong id="error_serious">', $txt['error_while_submitting'], '</strong> |
||
594 | </dt> |
||
595 | <dd class="error" id="error_list"> |
||
596 | ', empty($context['warning_errors']) ? '' : implode('<br>', $context['warning_errors']), ' |
||
597 | </dd> |
||
598 | </dl> |
||
599 | </div> |
||
600 | <div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '> |
||
601 | <dl class="settings"> |
||
602 | <dt> |
||
603 | <strong>', $txt['preview'], '</strong> |
||
604 | </dt> |
||
605 | <dd id="template_preview"> |
||
606 | ', !empty($context['template_preview']) ? $context['template_preview'] : '', ' |
||
607 | </dd> |
||
608 | </dl> |
||
609 | </div> |
||
610 | <dl class="settings"> |
||
611 | <dt> |
||
612 | <strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong> |
||
613 | </dt> |
||
614 | <dd> |
||
615 | <input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30"> |
||
616 | </dd> |
||
617 | <dt> |
||
618 | <strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br> |
||
619 | <span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span> |
||
620 | </dt> |
||
621 | <dd> |
||
622 | <textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea> |
||
623 | </dd> |
||
624 | </dl>'; |
||
625 | |||
626 | if ($context['template_data']['can_edit_personal']) |
||
627 | echo ' |
||
628 | <input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', '> |
||
629 | <label for="make_personal"> |
||
630 | <strong>', $txt['mc_warning_template_personal'], '</strong> |
||
631 | </label> |
||
632 | <p class="smalltext">', $txt['mc_warning_template_personal_desc'], '</p>'; |
||
633 | |||
634 | echo ' |
||
635 | <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button"> |
||
636 | <input type="submit" name="save" value="', $context['page_title'], '" class="button"> |
||
637 | </div><!-- .windowbg --> |
||
638 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
||
639 | <input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '"> |
||
640 | </form> |
||
641 | </div><!-- #modcenter --> |
||
642 | |||
643 | <script> |
||
644 | $(document).ready(function() { |
||
645 | $("#preview_button").click(function() { |
||
646 | return ajax_getTemplatePreview(); |
||
647 | }); |
||
648 | }); |
||
649 | |||
650 | function ajax_getTemplatePreview () |
||
651 | { |
||
652 | $.ajax({ |
||
653 | type: "POST", |
||
654 | headers: { |
||
655 | "X-SMF-AJAX": 1 |
||
656 | }, |
||
657 | xhrFields: { |
||
658 | withCredentials: typeof allow_xhjr_credentials !== "undefined" ? allow_xhjr_credentials : false |
||
659 | }, |
||
660 | url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml", |
||
661 | data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")}, |
||
662 | context: document.body, |
||
663 | success: function(request){ |
||
664 | $("#box_preview").css({display:""}); |
||
665 | $("#template_preview").html($(request).find(\'body\').text()); |
||
666 | if ($(request).find("error").text() != \'\') |
||
667 | { |
||
668 | $("#errors").css({display:""}); |
||
669 | var errors_html = \'\'; |
||
670 | var errors = $(request).find(\'error\').each(function() { |
||
671 | errors_html += $(this).text() + \'<br>\'; |
||
672 | }); |
||
673 | |||
674 | $(document).find("#error_list").html(errors_html); |
||
675 | } |
||
676 | else |
||
677 | { |
||
678 | $("#errors").css({display:"none"}); |
||
679 | $("#error_list").html(\'\'); |
||
680 | } |
||
681 | return false; |
||
682 | }, |
||
683 | }); |
||
684 | return false; |
||
685 | } |
||
686 | </script>'; |
||
687 | } |
||
688 | |||
689 | ?> |
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.