1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 
<?php
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2019 Simple Machines and individual contributors
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 RC1
 */

/**
 * Displays all reported posts.
 */
function template_reported_posts()
{
    global $context, $txt, $scripturl;

    // Let them know the action was a success.
    if (!empty($context['report_post_action']))
        echo '
    <div class="infobox">
        ', $txt['report_action_' . $context['report_post_action']], '
    </div>';

    echo '
    <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'], '">
        <div class="cat_bar">
            <h3 class="catbg">
                ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
            </h3>
        </div>';

    // Make the buttons.
    $close_button = create_button($context['view_closed'] ? 'folder' : 'close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
    $details_button = create_button('details', 'mc_reportedp_details', 'mc_reportedp_details');
    $ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
    $unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
    $ban_button = create_button('error', 'mc_reportedp_ban', 'mc_reportedp_ban');
    $delete_button = create_button('delete', 'mc_reportedp_delete', 'mc_reportedp_delete');

    foreach ($context['reports'] as $report)
    {
        echo '
        <div class="windowbg">
            <h5>
                <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>
            </h5>
            <div class="smalltext">
                ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';

        // Prepare the comments...
        $comments = array();
        foreach ($report['comments'] as $comment)
            $comments[$comment['member']['id']] = $comment['member']['link'];

        echo '
                ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
            </div>
            <hr>
            ', $report['body'], '
            <br>
            <ul class="quickbuttons">
                <li>
                    <a href="', $report['report_href'], '">', $details_button, '</a>
                </li>
                <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>
                <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>';

        // Delete message button.
        if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
            echo '
                <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>';

        // Ban this user button.
        if (!$report['closed'] && !empty($context['report_manage_bans']))
            echo '
                <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>';

        if (!$context['view_closed'])
            echo '
                <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';

        echo '
            </ul>
        </div><!-- .windowbg -->';
    }

    // Were none found?
    if (empty($context['reports']))
        echo '
        <div class="windowbg">
            <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
        </div>';

    echo '
        <div class="pagesection">';

    if (!empty($context['total_reports']) && $context['total_reports'] >= $context['reports_how_many'])
        echo '
            <div class="pagelinks floatleft">' . $context['page_index'] . '</div>';

    echo '
            <div class="floatright">', !$context['view_closed'] ? '
                <input type="hidden" name="' . $context['mod-report-close-all_token_var'] . '" value="' . $context['mod-report-close-all_token'] . '">
                <input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button">' : '', '
            </div>
        </div>
        <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
    </form>';
}

/**
 * A block to show the current top reported posts.
 */
function template_reported_posts_block()
{
    global $context, $txt, $scripturl;

    echo '
        <div class="cat_bar">
            <h3 class="catbg">
                <span id="reported_posts_toggle" class="', !empty($context['admin_prefs']['mcrp']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
                <a href="', $scripturl, '?action=moderate;area=reportedposts" id="reported_posts_link">', $txt['mc_recent_reports'], '</a>
            </h3>
        </div>
        <div class="windowbg" id="reported_posts_panel">
            <div class="modbox">
                <ul>';

    foreach ($context['reported_posts'] as $report)
        echo '
                    <li class="smalltext">
                        <a href="', $report['report_href'], '">', $report['subject'], '</a> ', $txt['mc_reportedp_by'], ' ', $report['author']['link'], '
                    </li>';

    // Don't have any watched users right now?
    if (empty($context['reported_posts']))
        echo '
                    <li>
                        <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
                    </li>';

    echo '
                </ul>
            </div><!-- .modbox -->
        </div><!-- #reported_posts_panel -->

        <script>
            var oReportedPostsPanelToggle = new smc_Toggle({
                bToggleEnabled: true,
                bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrp']) ? 'true' : 'false', ',
                aSwappableContainers: [
                    \'reported_posts_panel\'
                ],
                aSwapImages: [
                    {
                        sId: \'reported_posts_toggle\',
                        altExpanded: ', JavaScriptEscape($txt['hide']), ',
                        altCollapsed: ', JavaScriptEscape($txt['show']), '
                    }
                ],
                aSwapLinks: [
                    {
                        sId: \'reported_posts_link\',
                        msgExpanded: ', JavaScriptEscape($txt['mc_recent_reports']), ',
                        msgCollapsed: ', JavaScriptEscape($txt['mc_recent_reports']), '
                    }
                ],
                oThemeOptions: {
                    bUseThemeSettings: true,
                    sOptionName: \'admin_preferences\',
                    sSessionVar: smf_session_var,
                    sSessionId: smf_session_id,
                    sThemeId: \'1\',
                    sAdditionalVars: \';admin_key=mcrp\'
                }
            });
        </script>';
}

/**
 * Handles viewing details of and managing a specific report
 */
function template_viewmodreport()
{
    global $context, $scripturl, $txt;

    // Let them know the action was a success.
    if (!empty($context['report_post_action']))
        echo '
    <div class="infobox">
        ', $txt['report_action_' . $context['report_post_action']], '
    </div>';

    echo '
    <div id="modcenter">
        <form action="', $scripturl, '?action=moderate;area=reportedposts;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
            <div class="cat_bar">
                <h3 class="catbg">
                    ', sprintf($txt['mc_viewmodreport'], $context['report']['message_link'], $context['report']['author']['link']), '
                </h3>
            </div>
            <div class="title_bar">
                <h3 class="titlebg">
                    <span class="floatleft">
                        ', sprintf($txt['mc_modreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
                    </span>
                    <span class="floatright">';

    // Make the buttons.
    $close_button = create_button('close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
    $ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
    $unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');

    echo '
                        <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>
                        <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>
                    </span>
                </h3>
            </div><!-- .title_bar -->
            <div class="windowbg">
                ', $context['report']['body'], '
            </div>
            <br>
            <div class="cat_bar">
                <h3 class="catbg">', $txt['mc_modreport_whoreported_title'], '</h3>
            </div>';

    foreach ($context['report']['comments'] as $comment)
        echo '
            <div class="windowbg">
                <p class="smalltext">
                    ', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
                </p>
                <p>', $comment['message'], '</p>
            </div>';

    echo '
            <br>
            <div class="cat_bar">
                <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
            </div>
            <div>';

    if (empty($context['report']['mod_comments']))
        echo '
                <div class="information">
                    <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
                </div>';

    foreach ($context['report']['mod_comments'] as $comment)
    {
        echo '
                <div class="title_bar">
                    <h3 class="titlebg">
                        ', $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>' : ''), '
                    </h3>
                </div>';

        echo '
                <div class="windowbg">
                    <p>', $comment['message'], '</p>
                </div>';
    }

    echo '
                <div class="cat_bar">
                    <h3 class="catbg">
                        <span class="floatleft">
                            ', $txt['mc_reportedp_new_comment'], '
                        </span>
                    </h3>
                </div>
                <textarea rows="2" cols="60" style="width: 60%;" name="mod_comment"></textarea>
                <div class="padding">
                    <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button">
                    <input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
                </div>
            </div>
            <br>';

    template_show_list('moderation_actions_list');

    echo '
            <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
        </form>
    </div><!-- #modcenter -->';
}

/**
 * Template for editing a mod comment.
 */
function template_edit_comment()
{
    global $context, $scripturl, $txt;

    echo '
    <div id="modcenter">
        <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'], '">
            <br>
            <div class="cat_bar">
                <h3 class="catbg">', $txt['mc_modreport_edit_mod_comment'], '</h3>
            </div>
            <div class="windowbg">
                <textarea rows="6" cols="60" style="width: 60%;" name="mod_comment">', $context['comment']['body'], '</textarea>
                <div>
                    <input type="submit" name="edit_comment" value="', $txt['mc_modreport_edit_mod_comment'], '" class="button">
                </div>
            </div>
            <br>
            <input type="hidden" name="', $context['mod-reportC-edit_token_var'], '" value="', $context['mod-reportC-edit_token'], '">
            <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
        </form>
    </div><!-- #modcenter -->';
}

/**
 * A block to show the current top reported member profiles.
 */
function template_reported_members_block()
{
    global $context, $txt, $scripturl;

    echo '
        <div class="cat_bar">
            <h3 class="catbg">
                <span id="reported_members_toggle" class="', !empty($context['admin_prefs']['mcru']) ? 'toggle_down' : 'toggle_up', ' floatright" style="display: none;"></span>
                <a href="', $scripturl, '?action=moderate;area=reportedmembers" id="reported_members_link">', $txt['mc_recent_member_reports'], '</a>
            </h3>
        </div>
        <div class="windowbg" id="reported_users_panel">
            <div class="modbox">
                <ul>';

    foreach ($context['reported_members'] as $report)
        echo '
                    <li class="smalltext">
                        <a href="', $report['report_href'], '">', $report['user_name'], '</a>
                    </li>';

    // Don't have any reported members right now?
    if (empty($context['reported_members']))
        echo '
                    <li>
                        <strong class="smalltext">', $txt['mc_recent_reports_none'], '</strong>
                    </li>';

    echo '
                </ul>
            </div><!-- .modbox -->
        </div><!-- #reported_users_panel -->

        <script>
            var oReportedPostsPanelToggle = new smc_Toggle({
                bToggleEnabled: true,
                bCurrentlyCollapsed: ', !empty($context['admin_prefs']['mcrm']) ? 'true' : 'false', ',
                aSwappableContainers: [
                    \'reported_members_panel\'
                ],
                aSwapImages: [
                    {
                        sId: \'reported_members_toggle\',
                        altExpanded: ', JavaScriptEscape($txt['hide']), ',
                        altCollapsed: ', JavaScriptEscape($txt['show']), '
                    }
                ],
                aSwapLinks: [
                    {
                        sId: \'reported_members_link\',
                        msgExpanded: ', JavaScriptEscape($txt['mc_recent_member_reports']), ',
                        msgCollapsed: ', JavaScriptEscape($txt['mc_recent_member_reports']), '
                    }
                ],
                oThemeOptions: {
                    bUseThemeSettings: true,
                    sOptionName: \'admin_preferences\',
                    sSessionVar: smf_session_var,
                    sSessionId: smf_session_id,
                    sThemeId: \'1\',
                    sAdditionalVars: \';admin_key=mcrm\'
                }
            });
        </script>';
}

/**
 * Lists all reported members
 */
function template_reported_members()
{
    global $context, $txt, $scripturl;

    // Let them know the action was a success.
    if (!empty($context['report_post_action']) && !empty($txt['report_action_' . $context['report_post_action']]))
        echo '
    <div class="infobox">
        ', $txt['report_action_' . $context['report_post_action']], '
    </div>';

    echo '
    <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'], '">
        <div class="cat_bar">
            <h3 class="catbg">
                ', $context['view_closed'] ? $txt['mc_reportedp_closed'] : $txt['mc_reportedp_active'], '
            </h3>
        </div>
        <div class="pagesection">
            <div class="pagelinks">', $context['page_index'], '</div>
        </div>';

    // Make the buttons.
    $close_button = create_button('close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['view_closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
    $details_button = create_button('details', 'mc_reportedp_details', 'mc_reportedp_details');
    $ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
    $unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');
    $ban_button = create_button('close', 'mc_reportedp_ban', 'mc_reportedp_ban');

    foreach ($context['reports'] as $report)
    {
        echo '
        <div class="generic_list_wrapper windowbg">
            <h5>
                <strong><a href="', $report['user']['href'], '">', $report['user']['name'], '</a></strong>
            </h5>
            <div class="smalltext">
                ', $txt['mc_reportedp_last_reported'], ': ', $report['last_updated'], '&nbsp;-&nbsp;';

        // Prepare the comments...
        $comments = array();
        foreach ($report['comments'] as $comment)
            $comments[$comment['member']['id']] = $comment['member']['link'];

        echo '
                ', $txt['mc_reportedp_reported_by'], ': ', implode(', ', $comments), '
            </div>
            <hr>
            <ul class="quickbuttons">
                <li><a href="', $report['report_href'], '">', $details_button, '</a></li>
                <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>
                <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>';

        // Ban this user button.
        if (!$report['closed'] && !empty($context['report_manage_bans']) && !empty($report['user']['id']))
            echo '
                <li><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $report['user']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $ban_button, '</a></li>';

        if (!$context['view_closed'])
            echo '
                <li><input type="checkbox" name="close[]" value="' . $report['id'] . '"></li>';

        echo '
            </ul>
        </div><!-- .generic_list_wrapper -->';
    }

    // Were none found?
    if (empty($context['reports']))
        echo '
        <div class="windowbg">
            <p class="centertext">', $txt['mc_reportedp_none_found'], '</p>
        </div>';

    echo '
        <div class="pagesection">
            <div class="pagelinks floatleft">', $context['page_index'], '</div>
            <div class="floatright">
                ', !$context['view_closed'] ? '<input type="submit" name="close_selected" value="' . $txt['mc_reportedp_close_selected'] . '" class="button">' : '', '
            </div>
        </div>
        <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
    </form>';
}

/**
 * Template for viewing and managing a specific report about a user's profile
 */
function template_viewmemberreport()
{
    global $context, $scripturl, $txt;

    // Let them know the action was a success.
    if (!empty($context['report_post_action']))
        echo '
    <div class="infobox">
        ', $txt['report_action_' . $context['report_post_action']], '
    </div>';

    echo '
    <div id="modcenter">
        <form action="', $scripturl, '?action=moderate;area=reportedmembers;sa=handlecomment;rid=', $context['report']['id'], '" method="post" accept-charset="', $context['character_set'], '">
            <div class="cat_bar">
                <h3 class="catbg">
                    ', sprintf($txt['mc_viewmemberreport'], $context['report']['user']['link']), '
                </h3>
            </div>
            <div class="title_bar">
                <h3 class="titlebg">
                    <span class="floatleft">
                        ', sprintf($txt['mc_memberreport_summary'], $context['report']['num_reports'], $context['report']['last_updated']), '
                    </span>
                    <span class="floatright">';

    // Make the buttons.
    $close_button = create_button('close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close', $context['report']['closed'] ? 'mc_reportedp_open' : 'mc_reportedp_close');
    $ignore_button = create_button('ignore', 'mc_reportedp_ignore', 'mc_reportedp_ignore');
    $unignore_button = create_button('ignore', 'mc_reportedp_unignore', 'mc_reportedp_unignore');

    echo '
                        <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>
                        <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>
                    </span>
                </h3>
            </div>
            <br>
            <div class="cat_bar">
                <h3 class="catbg">', $txt['mc_memberreport_whoreported_title'], '</h3>
            </div>';

    foreach ($context['report']['comments'] as $comment)
        echo '
            <div class="windowbg">
                <p class="smalltext">
                    ', sprintf($txt['mc_modreport_whoreported_data'], $comment['member']['link'] . (empty($comment['member']['id']) && !empty($comment['member']['ip']) ? ' (' . $comment['member']['ip'] . ')' : ''), $comment['time']), '
                </p>
                <p>', $comment['message'], '</p>
            </div>';

    echo '
            <br>
            <div class="cat_bar">
                <h3 class="catbg">', $txt['mc_modreport_mod_comments'], '</h3>
            </div>
            <div>';

    if (empty($context['report']['mod_comments']))
        echo '
                <div class="information">
                    <p class="centertext">', $txt['mc_modreport_no_mod_comment'], '</p>
                </div>';

    foreach ($context['report']['mod_comments'] as $comment)
    {
        echo '
                <div class="title_bar">
                    <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>
                </div>';

        echo '
                <div class="windowbg">
                    <p>', $comment['message'], '</p>
                </div>';
    }

    echo '
                <div class="cat_bar">
                    <h3 class="catbg">
                        <span class="floatleft">
                            ', $txt['mc_reportedp_new_comment'], '
                        </span>
                    </h3>
                </div>
                <textarea rows="2" cols="60" style="width: 60%;" name="mod_comment"></textarea>
                <div class="padding">
                    <input type="submit" name="add_comment" value="', $txt['mc_modreport_add_mod_comment'], '" class="button">
                    <input type="hidden" name="', $context['mod-reportC-add_token_var'], '" value="', $context['mod-reportC-add_token'], '">
                </div>
            </div>
            <br>';

    template_show_list('moderation_actions_list');

    echo '
            <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
        </form>
    </div><!-- #modcenter -->';
}

?>