Completed
Push — release-2.1 ( e077db...35b3d8 )
by Colin
07:37
created

ReportedContent.template.php ➔ template_edit_comment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
1
<?php
2
/**
3
 * Simple Machines Forum (SMF)
4
 *
5
 * @package SMF
6
 * @author Simple Machines http://www.simplemachines.org
7
 * @copyright 2017 Simple Machines and individual contributors
8
 * @license http://www.simplemachines.org/about/smf/license.php BSD
9
 *
10
 * @version 2.1 Beta 4
11
 */
12
13
/**
14
 * Displays all reported posts.
15
 */
16
function template_reported_posts()
17
{
18
	global $context, $txt, $scripturl;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
19
20
	// Let them know the action was a success.
21 View Code Duplication
	if (!empty($context['report_post_action']))
22
		echo '
23
	<div class="infobox">
24
		', $txt['report_action_' . $context['report_post_action']], '
25
	</div>';
26
27
	echo '
28
	<form id="reported_posts" action="', $scripturl, '?action=moderate;area=reportedposts;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
29
		<div class="cat_bar">
30
			<h3 class="catbg">
31
				', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
32
			</h3>
33
		</div>';
34
35
	// Make the buttons.
36
	$close_button = create_button('close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
37
	$details_button = create_button('details', 'mc_reportedp_details', 'mc_reportedp_details');
38
	$ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
39
	$unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
40
	$ban_button = create_button('close', 'mc_reportedp_ban', 'mc_reportedp_ban');
41
	$delete_button = create_button('delete', 'mc_reportedp_delete', 'mc_reportedp_delete');
42
43
	foreach ($context['reports'] as $report)
44
	{
45
		echo '
46
		<div class="windowbg">
47
			<h5>
48
				<strong>', !empty($report['topic']['board_name']) ? '<a href="' . $scripturl . '?board=' . $report['topic']['id_board'] . '.0">' . $report['topic']['board_name'] . '</a>' : '??', ' / <a href="', $report['topic']['href'], '">', $report['subject'], '</a></strong> ', $txt['mc_reportedp_by'], ' <strong>', $report['author']['link'], '</strong>
49
			</h5>
50
			<div class="smalltext">
51
				', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
52
53
		// Prepare the comments...
54
		$comments = array();
55 View Code Duplication
		foreach ($report['comments'] as $comment)
56
			$comments[$comment['member']['id']] = $comment['member']['link'];
57
58
		echo '
59
				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
60
			</div>
61
			<hr>
62
			', $report['body'], '
63
			<br>
64
			<ul class="quickbuttons">
65
				<li>
66
					<a href="', $report['report_href'], '">', $details_button, '</a>
67
				</li>
68
				<li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" ', (!$report['ignore'] ? ' class="you_sure" data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : ''), '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
69
				<li><a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
70
71
		// Delete message button.
72
		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
73
			echo '
74
				<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'], '.0;msg=', $report['topic']['id_msg'], ';modcenter;', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['mc_reportedp_delete_confirm'], '" class="you_sure">', $delete_button, '</a></li>';
75
76
		// Ban this user button.
77
		if (!$report['closed'] && !empty($context['report_manage_bans']))
78
			echo '
79
				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add', (!empty($report['author']['id']) ? ';u=' . $report['author']['id'] : ';msg=' . $report['topic']['id_msg']), ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
80
81
		if (!$context['view_closed'])
82
			echo '
83
				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
84
85
		echo '
86
			</ul>
87
		</div><!-- .windowbg -->';
88
	}
89
90
	// Were none found?
91
	if (empty($context['reports']))
92
		echo '
93
		<div class="windowbg2">
94
			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
95
		</div>';
96
97
	echo '
98
		<div class="pagesection">';
99
	
100
	if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'])
101
		echo '
102
			<div class="pagelinks floatleft">' . $context['page_index'] . '</div>';
103
104
	echo '
105
			<div class="floatright">', !$context['view_closed'] ? '
106
				<input type="hidden" name="'. $context['mod-report-close-all_token_var'] . '" value="' . $context['mod-report-close-all_token'] . '">
107
				<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button">' : '', '
108
			</div>
109
		</div>
110
		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
111
	</form>';
112
}
113
114
115
/**
116
 * A block to show the current top reported posts.
117
 */
118
function template_reported_posts_block()
0 ignored issues
show
Best Practice introduced by
The function template_reported_posts_block() has been defined more than once; this definition is ignored, only the first definition in Themes/default/ModerationCenter.template.php (L181-245) is considered.

This check looks for functions that have already been defined in other files.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
119
{
120
	global $context, $txt, $scripturl;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
121
122
	echo '
123
		<div class="cat_bar">
124
			<h3 class="catbg">
125
				<span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
126
				<a href="', $scripturl, '?action=moderate;area=reportedposts" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
127
			</h3>
128
		</div>
129
		<div class="windowbg" id="reported_posts_panel">
130
			<div class="modbox">
131
				<ul>';
132
133
	foreach ($context['reported_posts'] as $report)
134
		echo '
135
					<li class="smalltext">
136
						<a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
137
					</li>';
138
139
	// Don't have any watched users right now?
140
	if (empty($context['reported_posts']))
141
		echo '
142
					<li>
143
						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
144
					</li>';
145
146
	echo '
147
				</ul>
148
			</div><!-- .modbox -->
149
		</div><!-- #reported_posts_panel -->
150
151
		<script>
152
			var oReportedPostsPanelToggle = new smc_Toggle({
153
				bToggleEnabled: true,
154
				bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
155
				aSwappableContainers: [
156
					\'reported_posts_panel\'
157
				],
158
				aSwapImages: [
159
					{
160
						sId: \'reported_posts_toggle\',
161
						altExpanded: ', JavaScriptEscape($txt['hide']), ',
162
						altCollapsed: ', JavaScriptEscape($txt['show']), '
163
					}
164
				],
165
				aSwapLinks: [
166
					{
167
						sId: \'reported_posts_link\',
168
						msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
169
						msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
170
					}
171
				],
172
				oThemeOptions: {
173
					bUseThemeSettings: true,
174
					sOptionName: \'admin_preferences\',
175
					sSessionVar: smf_session_var,
176
					sSessionId: smf_session_id,
177
					sThemeId: \'1\',
178
					sAdditionalVars: \';admin_key=mcrp\'
179
				}
180
			});
181
		</script>';
182
}
183
184
/**
185
 * Handles viewing details of and managing a specific report
186
 */
187
function template_viewmodreport()
188
{
189
	global $context, $scripturl, $txt;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
190
191
	// Let them know the action was a success.
192 View Code Duplication
	if (!empty($context['report_post_action']))
193
		echo '
194
	<div class="infobox">
195
		', $txt['report_action_' . $context['report_post_action']], '
196
	</div>';
197
198
	echo '
199
	<div id="modcenter">
200
		<form action="', $scripturl, '?action=moderate;area=reportedposts;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
201
			<div class="cat_bar">
202
				<h3 class="catbg">
203
					', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
204
				</h3>
205
			</div>
206
			<div class="title_bar">
207
				<h3 class="titlebg">
208
					<span class="floatleft">
209
						', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
210
					</span>
211
					<span class="floatright">';
212
213
	// Make the buttons.
214
	$close_button = create_button('close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
215
	$ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
216
	$unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
217
218
	echo '
219
						<a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="button', (!$context['report']['ignore'] ? ' you_sure' : ''), '"', (!$context['report']['ignore'] ? ' data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : ''), '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
220
						<a href="', $scripturl, '?action=moderate;area=reportedposts;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '"  class="button">', $close_button, '</a>
221
					</span>
222
				</h3>
223
			</div><!-- .title_bar -->
224
			<div class="windowbg2">
225
				', $context['report']['body'], '
226
			</div>
227
			<br>
228
			<div class="cat_bar">
229
				<h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
230
			</div>';
231
232 View Code Duplication
	foreach ($context['report']['comments'] as $comment)
233
		echo '
234
			<div class="windowbg">
235
				<p class="smalltext">
236
					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
237
				</p>
238
				<p>', $comment['message'], '</p>
239
			</div>';
240
241
	echo '
242
			<br>
243
			<div class="cat_bar">
244
				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
245
			</div>
246
			<div>';
247
248
	if (empty($context['report']['mod_comments']))
249
		echo '
250
				<div class="information">
251
					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
252
				</div>';
253
254
	foreach ($context['report']['mod_comments'] as $comment)
255
	{
256
		echo '
257
				<div class="title_bar">
258
					<h3 class="titlebg">
259
						', $comment['member']['link'], ':  <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=editcomment;rid=' . $context['report']['id'] . ';mid=' . $comment['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"  class="button">' . $txt['mc_reportedp_comment_edit'] . '</a><a href="' . $scripturl . '?action=moderate;area=reportedposts;sa=handlecomment;rid=' . $context['report']['id'] . ';mid=' . $comment['id'] . ';delete;' . $context['session_var'] . '=' . $context['session_id'] . ';' . $context['mod-reportC-delete_token_var'] . '=' . $context['mod-reportC-delete_token'] . '"  class="button">' . $txt['mc_reportedp_comment_delete'] . '</a></span>' : ''), '
260
					</h3>
261
				</div>';
262
263
		echo '
264
				<div class="windowbg2">
265
					<p>', $comment['message'], '</p>
266
				</div>';
267
	}
268
269
	echo '
270
				<div class="cat_bar">
271
					<h3 class="catbg">
272
						<span class="floatleft">
273
							', $txt['mc_reportedp_new_comment'], '
274
						</span>
275
					</h3>
276
				</div>
277
				<textarea rows="2" cols="60" style="width: 60%;" name="mod_comment"></textarea>
278
				<div class="padding">
279
					<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button">
280
					<input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
281
				</div>
282
			</div>
283
			<br>';
284
285
	template_show_list('moderation_actions_list');
286
287
	echo '
288
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
289
		</form>
290
	</div><!-- #modcenter -->';
291
}
292
293
/**
294
 * Template for editing a mod comment.
295
 */
296
function template_edit_comment()
297
{
298
	global $context, $scripturl, $txt;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
299
300
	echo '
301
	<div id="modcenter">
302
		<form action="', $scripturl, '?action=moderate;area=reported', $context['report_type'], ';sa=editcomment;mid=', $context['comment_id'], ';rid=', $context['report_id'], ';save" method="post" accept-charset="', $context['character_set'], '">
303
			<br>
304
			<div class="cat_bar">
305
				<h3 class="catbg">', $txt['mc_modreport_edit_mod_comment'], '</h3>
306
			</div>
307
			<div class="windowbg2">
308
				<textarea rows="6" cols="60" style="width: 60%;" name="mod_comment">', $context['comment']['body'], '</textarea>
309
				<div>
310
					<input type="submit" name="edit_comment" value="', $txt['mc_modreport_edit_mod_comment'], '" class="button">
311
				</div>
312
			</div>
313
			<br>
314
			<input type="hidden" name="', $context['mod-reportC-edit_token_var'], '" value="', $context['mod-reportC-edit_token'], '">
315
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
316
		</form>
317
	</div><!-- #modcenter -->';
318
}
319
320
/**
321
 * A block to show the current top reported member profiles.
322
 */
323 View Code Duplication
function template_reported_members_block()
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
324
{
325
	global $context, $txt, $scripturl;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
326
327
	echo '
328
		<div class="cat_bar">
329
			<h3 class="catbg">
330
				<span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
331
				<a href="', $scripturl, '?action=moderate;area=reportedmembers" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
332
			</h3>
333
		</div>
334
		<div class="windowbg" id="reported_users_panel">
335
			<div class="modbox">
336
				<ul>';
337
338
	foreach ($context['reported_members'] as $report)
339
		echo '
340
					<li class="smalltext">
341
						<a href="', $report['report_href'], '">', $report['user_name'], '</a>
342
					</li>';
343
344
	// Don't have any reported members right now?
345
	if (empty($context['reported_members']))
346
		echo '
347
					<li>
348
						<strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
349
					</li>';
350
351
	echo '
352
				</ul>
353
			</div><!-- .modbox -->
354
		</div><!-- #reported_users_panel -->
355
356
		<script>
357
			var oReportedPostsPanelToggle = new smc_Toggle({
358
				bToggleEnabled: true,
359
				bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
360
				aSwappableContainers: [
361
					\'reported_members_panel\'
362
				],
363
				aSwapImages: [
364
					{
365
						sId: \'reported_members_toggle\',
366
						altExpanded: ', JavaScriptEscape($txt['hide']), ',
367
						altCollapsed: ', JavaScriptEscape($txt['show']), '
368
					}
369
				],
370
				aSwapLinks: [
371
					{
372
						sId: \'reported_members_link\',
373
						msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
374
						msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
375
					}
376
				],
377
				oThemeOptions: {
378
					bUseThemeSettings: true,
379
					sOptionName: \'admin_preferences\',
380
					sSessionVar: smf_session_var,
381
					sSessionId: smf_session_id,
382
					sThemeId: \'1\',
383
					sAdditionalVars: \';admin_key=mcrm\'
384
				}
385
			});
386
		</script>';
387
}
388
389
/**
390
 * Lists all reported members
391
 */
392
function template_reported_members()
393
{
394
	global $context, $txt, $scripturl;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
395
396
	// Let them know the action was a success.
397
	if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']]))
398
		echo '
399
	<div class="infobox">
400
		', $txt['report_action_' . $context['report_post_action']], '
401
	</div>';
402
403
	echo '
404
	<form id="reported_members" action="', $scripturl, '?action=moderate;area=reportedmembers;sa=show', $context['view_closed'] ? ';closed' : '', ';start=', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
405
		<div class="cat_bar">
406
			<h3 class="catbg">
407
				', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
408
			</h3>
409
		</div>
410
		<div class="pagesection">
411
			<div class="pagelinks">', $context['page_index'], '</div>
412
		</div>';
413
414
	// Make the buttons.
415
	$close_button = create_button('close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
416
	$details_button = create_button('details', 'mc_reportedp_details', 'mc_reportedp_details');
417
	$ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
418
	$unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
419
	$ban_button = create_button('close', 'mc_reportedp_ban', 'mc_reportedp_ban');
420
421
	foreach ($context['reports'] as $report)
422
	{
423
		echo '
424
		<div class="generic_list_wrapper windowbg">
425
			<h5>
426
				<strong><a href="', $report['user']['href'], '">', $report['user']['name'], '</a></strong>
427
			</h5>
428
			<div class="smalltext">
429
				', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';
430
431
		// Prepare the comments...
432
		$comments = array();
433 View Code Duplication
		foreach ($report['comments'] as $comment)
434
			$comments[$comment['member']['id']] = $comment['member']['link'];
435
436
		echo '
437
				', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
438
			</div>
439
			<hr>
440
			<ul class="quickbuttons">
441
				<li><a href="', $report['report_href'], '">', $details_button, '</a></li>
442
				<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;ignore=', (int) !$report['ignore'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" ', (!$report['ignore'] ? ' class="you_sure"  data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : ''), '>', $report['ignore'] ? $unignore_button : $ignore_button, '</a></li>
443
				<li><a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$report['closed'], ';rid=', $report['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '">', $close_button, '</a></li>';
444
445
		// Ban this user button.
446
		if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
447
			echo '
448
				<li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';
449
450
		if (!$context['view_closed'])
451
			echo '
452
				<li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';
453
454
			echo '
455
			</ul>
456
		</div><!-- .generic_list_wrapper -->';
457
	}
458
459
	// Were none found?
460
	if (empty($context['reports']))
461
		echo '
462
		<div class="windowbg2">
463
			<p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
464
		</div>';
465
466
	echo '
467
		<div class="pagesection">
468
			<div class="pagelinks floatleft">', $context['page_index'], '</div>
469
			<div class="floatright">
470
				', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button">' : '', '
471
			</div>
472
		</div>
473
		<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
474
	</form>';
475
}
476
477
/**
478
 * Template for viewing and managing a specific report about a user's profile
479
 */
480
function template_viewmemberreport()
481
{
482
	global $context, $scripturl, $txt;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
483
484
	// Let them know the action was a success.
485 View Code Duplication
	if (!empty($context['report_post_action']))
486
		echo '
487
	<div class="infobox">
488
		', $txt['report_action_' . $context['report_post_action']], '
489
	</div>';
490
491
	echo '
492
	<div id="modcenter">
493
		<form action="', $scripturl, '?action=moderate;area=reportedmembers;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
494
			<div class="cat_bar">
495
				<h3 class="catbg">
496
					', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
497
				</h3>
498
			</div>
499
			<div class="title_bar">
500
				<h3 class="titlebg">
501
					<span class="floatleft">
502
						', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
503
					</span>
504
					<span class="floatright">';
505
506
	// Make the buttons.
507
	$close_button = create_button('close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
508
	$ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
509
	$unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
510
511
	echo '
512
						<a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;ignore=', (int) !$context['report']['ignore'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-ignore_token_var'], '=', $context['mod-report-ignore_token'], '" class="button', (!$context['report']['ignore'] ? ' you_sure' : ''), '"', (!$context['report']['ignore'] ? ' data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : ''), '>', $context['report']['ignore'] ? $unignore_button : $ignore_button, '</a>
513
						<a href="', $scripturl, '?action=moderate;area=reportedmembers;sa=handle;closed=', (int) !$context['report']['closed'], ';rid=', $context['report']['id'], ';', $context['session_var'], '=', $context['session_id'], ';', $context['mod-report-closed_token_var'], '=', $context['mod-report-closed_token'], '"  class="button">', $close_button, '</a>
514
					</span>
515
				</h3>
516
			</div>
517
			<br>
518
			<div class="cat_bar">
519
				<h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
520
			</div>';
521
522 View Code Duplication
	foreach ($context['report']['comments'] as $comment)
523
		echo '
524
			<div class="windowbg">
525
				<p class="smalltext">
526
					', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
527
				</p>
528
				<p>', $comment['message'], '</p>
529
			</div>';
530
531
	echo '
532
			<br>
533
			<div class="cat_bar">
534
				<h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
535
			</div>
536
			<div>';
537
538
	if (empty($context['report']['mod_comments']))
539
		echo '
540
				<div class="information">
541
					<p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
542
				</div>';
543
544
	foreach ($context['report']['mod_comments'] as $comment)
545
	{
546
		echo '
547
				<div class="title_bar">
548
					<h3 class="titlebg">', $comment['member']['link'], ':  <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '<span class="floatright"><a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=editcomment;rid=' . $context['report']['id'] . ';mid=' . $comment['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"  class="button">' . $txt['mc_reportedp_comment_edit'] . '</a> <a href="' . $scripturl . '?action=moderate;area=reportedmembers;sa=handlecomment;rid=' . $context['report']['id'] . ';mid=' . $comment['id'] . ';delete;' . $context['session_var'] . '=' . $context['session_id'] . ';' . $context['mod-reportC-delete_token_var'] . '=' . $context['mod-reportC-delete_token'] . '"  class="button you_sure" data-confirm="' . $txt['mc_reportedp_delete_confirm'] . '">' . $txt['mc_reportedp_comment_delete'] . '</a></span>' : ''), '</h3>
549
				</div>';
550
551
		echo '
552
				<div class="windowbg2">
553
					<p>', $comment['message'], '</p>
554
				</div>';
555
	}
556
557
	echo '
558
				<div class="cat_bar">
559
					<h3 class="catbg">
560
						<span class="floatleft">
561
							', $txt['mc_reportedp_new_comment'], '
562
						</span>
563
					</h3>
564
				</div>
565
				<textarea rows="2" cols="60" style="width: 60%;" name="mod_comment"></textarea>
566
				<div class="padding">
567
					<input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button">
568
					<input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
569
				</div>
570
			</div>
571
			<br>';
572
573
	template_show_list('moderation_actions_list');
574
575
	echo '
576
			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
577
		</form>
578
	</div><!-- #modcenter -->';
579
}
580
581
?>