template_notes()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 46
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 19
nop 0
dl 0
loc 46
rs 9.3222
c 0
b 0
f 0
nc 4
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines http://www.simplemachines.org
7
 * @copyright 2019 Simple Machines and individual contributors
8
 * @license http://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 RC2
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" 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" 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" 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" 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
						<span class="smalltext">', $context['page_index'], '</span>
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">
373
				<h3 class="catbg">', $txt['mc_unapproved_posts'], '</h3>
374
			</div>';
375
376
	// No posts?
377
	if (empty($context['unapproved_items']))
378
		echo '
379
			<div class="windowbg">
380
				<p class="centertext">
381
					', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '
382
				</p>
383
			</div>';
384
	else
385
		echo '
386
			<div class="pagesection floatleft">
387
				', $context['page_index'], '
388
			</div>';
389
390
	foreach ($context['unapproved_items'] as $item)
391
	{
392
		// The buttons
393
		$quickbuttons = array(
394
			'approve' => array(
395
				'label' => $txt['approve'],
396
				'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';approve='.$item['id'],
397
				'icon' => 'approve',
398
			),
399
			'delete' => array(
400
				'label' => $txt['remove'],
401
				'href' => $scripturl.'?action=moderate;area=postmod;sa='.$context['current_view'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';delete='.$item['id'],
402
				'icon' => 'remove_button',
403
				'show' => $item['can_delete']
404
			),
405
			'quickmod' => array(
406
				'content' => '<input type="checkbox" name="item[]" value="'.$item['id'].'" checked>',
407
				'show' => !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1
408
			),
409
		);
410
		echo '
411
			<div class="windowbg clear">
412
				<div class="counter">', $item['counter'], '</div>
413
				<div class="topic_details">
414
					<h5>
415
						<strong>', $item['category']['link'], ' / ', $item['board']['link'], ' / ', $item['link'], '</strong>
416
					</h5>
417
					<span class="smalltext"><strong>', $txt['mc_unapproved_by'], ' ', $item['poster']['link'], ' ', $txt['on'], ':</strong> ', $item['time'], '</span>
418
				</div>
419
				<div class="list_posts">
420
					<div class="post">', $item['body'], '</div>
421
				</div>
422
				', template_quickbuttons($quickbuttons, 'unapproved_posts'), '
0 ignored issues
show
Bug introduced by
Are you sure the usage of template_quickbuttons($q...ns, 'unapproved_posts') 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 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.

Loading history...
423
			</div><!-- .windowbg -->';
424
	}
425
426
	echo '
427
			<div class="pagesection">';
428
429
	if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1)
430
		echo '
431
				<div class="floatright">
432
					<select name="do" onchange="if (this.value != 0 &amp;&amp; confirm(\'', $txt['mc_unapproved_sure'], '\')) submit();">
433
						<option value="0">', $txt['with_selected'], ':</option>
434
						<option value="0" disabled>-------------------</option>
435
						<option value="approve">&nbsp;--&nbsp;', $txt['approve'], '</option>
436
						<option value="delete">&nbsp;--&nbsp;', $txt['delete'], '</option>
437
					</select>
438
					<noscript>
439
						<input type="submit" name="mc_go" value="', $txt['go'], '" class="button">
440
					</noscript>
441
				</div>';
442
443
	if (!empty($context['unapproved_items']))
444
		echo '
445
				<div class="floatleft">
446
					<div class="pagelinks">', $context['page_index'], '</div>
447
				</div>';
448
449
	echo '
450
			</div><!-- .pagesection -->
451
		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
452
		</form>
453
	</div><!-- #modcenter -->';
454
}
455
456
/**
457
 * Callback function for showing a watched users post in the table.
458
 *
459
 * @param array $post An array of data about the post.
460
 * @return string An array of HTML for showing the post info.
461
 */
462
function template_user_watch_post_callback($post)
463
{
464
	global $scripturl, $context, $txt, $delete_button;
465
466
	// We'll have a delete and a checkbox please bob.
467
	// @todo Discuss this with the team and rewrite if required.
468
	$quickbuttons = array(
469
		'delete' => array(
470
			'label' => $txt['remove_message'],
471
			'href' => $scripturl.'?action=moderate;area=userwatch;sa=post;delete='.$post['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'],
472
			'javascript' => 'data-confirm="' . $txt['mc_watched_users_delete_post'] . '" class="you_sure"',
473
			'icon' => 'remove_button',
474
			'show' => $post['can_delete']
475
		),
476
		'quickmod' => array(
477
			'content' => '<input type="checkbox" name="delete[]" value="' . $post['id'] . '">',
478
			'show' => $post['can_delete']
479
		)
480
	);
481
482
	$output_html = '
483
					<div>
484
						<div class="floatleft">
485
							<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>
486
						</div>
487
						<div class="floatright">';
488
489
	$output_html .= template_quickbuttons($quickbuttons, 'user_watch_post', 'return');
490
491
	$output_html .= '
492
						</div>
493
					</div>
494
					<br>
495
					<div class="smalltext">
496
						&#171; ' . $txt['mc_watched_users_posted'] . ': ' . $post['poster_time'] . ' &#187;
497
					</div>
498
					<div class="list_posts double_height">
499
						' . $post['body'] . '
500
					</div>';
501
502
	return $output_html;
503
}
504
505
/**
506
 * The moderation settings page.
507
 */
508
function template_moderation_settings()
509
{
510
	global $context, $txt, $scripturl;
511
512
	echo '
513
	<div id="modcenter">';
514
515
	echo '
516
		<div class="windowbg">
517
			<div class="centertext">', $txt['mc_no_settings'], '</div>
518
		</div>';
519
520
	echo '
521
	</div><!-- #modcenter -->';
522
}
523
524
/**
525
 * Show a notice sent to a user.
526
 */
527
function template_show_notice()
528
{
529
	global $txt, $settings, $context, $modSettings;
530
531
	// We do all the HTML for this one!
532
	echo '<!DOCTYPE html>
533
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
534
	<head>
535
		<meta charset="', $context['character_set'], '">
536
		<title>', $context['page_title'], '</title>
537
		<link rel="stylesheet" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css', $context['browser_cache'], '">
538
	</head>
539
	<body>
540
		<div class="cat_bar">
541
			<h3 class="catbg">', $txt['show_notice'], '</h3>
542
		</div>
543
		<div class="title_bar">
544
			<h3 class="titlebg">', $txt['show_notice_subject'], ': ', $context['notice_subject'], '</h3>
545
		</div>
546
		<div class="windowbg">
547
			<dl>
548
				<dt>
549
					<strong>', $txt['show_notice_text'], ':</strong>
550
				</dt>
551
				<dd>
552
					', $context['notice_body'], '
553
				</dd>
554
			</dl>
555
		</div>
556
	</body>
557
</html>';
558
559
}
560
561
/**
562
 * Add or edit a warning template.
563
 */
564
function template_warn_template()
565
{
566
	global $context, $txt, $scripturl;
567
568
	echo '
569
	<div id="modcenter">
570
		<form action="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=', $context['id_template'], '" method="post" accept-charset="', $context['character_set'], '">
571
			<div class="cat_bar">
572
				<h3 class="catbg">', $context['page_title'], '</h3>
573
			</div>
574
			<div class="information">
575
				', $txt['mc_warning_template_desc'], '
576
			</div>
577
			<div class="windowbg">
578
				<div class="errorbox"', empty($context['warning_errors']) ? ' style="display: none"' : '', ' id="errors">
579
					<dl>
580
						<dt>
581
							<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
582
						</dt>
583
						<dd class="error" id="error_list">
584
							', empty($context['warning_errors']) ? '' : implode('<br>', $context['warning_errors']), '
585
						</dd>
586
					</dl>
587
				</div>
588
				<div id="box_preview"', !empty($context['template_preview']) ? '' : ' style="display:none"', '>
589
					<dl class="settings">
590
						<dt>
591
							<strong>', $txt['preview'], '</strong>
592
						</dt>
593
						<dd id="template_preview">
594
							', !empty($context['template_preview']) ? $context['template_preview'] : '', '
595
						</dd>
596
					</dl>
597
				</div>
598
				<dl class="settings">
599
					<dt>
600
						<strong><label for="template_title">', $txt['mc_warning_template_title'], '</label>:</strong>
601
					</dt>
602
					<dd>
603
						<input type="text" id="template_title" name="template_title" value="', $context['template_data']['title'], '" size="30">
604
					</dd>
605
					<dt>
606
						<strong><label for="template_body">', $txt['profile_warning_notify_body'], '</label>:</strong><br>
607
						<span class="smalltext">', $txt['mc_warning_template_body_desc'], '</span>
608
					</dt>
609
					<dd>
610
						<textarea id="template_body" name="template_body" rows="10" cols="45" class="smalltext">', $context['template_data']['body'], '</textarea>
611
					</dd>
612
				</dl>';
613
614
	if ($context['template_data']['can_edit_personal'])
615
		echo '
616
				<input type="checkbox" name="make_personal" id="make_personal"', $context['template_data']['personal'] ? ' checked' : '', '>
617
					<label for="make_personal">
618
						<strong>', $txt['mc_warning_template_personal'], '</strong>
619
					</label>
620
					<p class="smalltext">', $txt['mc_warning_template_personal_desc'], '</p>';
621
622
	echo '
623
				<input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button">
624
				<input type="submit" name="save" value="', $context['page_title'], '" class="button">
625
			</div><!-- .windowbg -->
626
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
627
			<input type="hidden" name="', $context['mod-wt_token_var'], '" value="', $context['mod-wt_token'], '">
628
		</form>
629
	</div><!-- #modcenter -->
630
631
	<script>
632
		$(document).ready(function() {
633
			$("#preview_button").click(function() {
634
				return ajax_getTemplatePreview();
635
			});
636
		});
637
638
		function ajax_getTemplatePreview ()
639
		{
640
			$.ajax({
641
				type: "POST",
642
				url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
643
				data: {item: "warning_preview", title: $("#template_title").val(), body: $("#template_body").val(), user: $(\'input[name="u"]\').attr("value")},
644
				context: document.body,
645
				success: function(request){
646
					$("#box_preview").css({display:""});
647
					$("#template_preview").html($(request).find(\'body\').text());
648
					if ($(request).find("error").text() != \'\')
649
					{
650
						$("#errors").css({display:""});
651
						var errors_html = \'\';
652
						var errors = $(request).find(\'error\').each(function() {
653
							errors_html += $(this).text() + \'<br>\';
654
						});
655
656
						$(document).find("#error_list").html(errors_html);
657
					}
658
					else
659
					{
660
						$("#errors").css({display:"none"});
661
						$("#error_list").html(\'\');
662
					}
663
				return false;
664
				},
665
			});
666
			return false;
667
		}
668
	</script>';
669
}
670
671
?>