示例#1
0
function exploitscanner_draw_row($r)
{
    $class = !empty($r['class']) ? ' class="' . $r['class'] . '"' : '';
    $html = '<tr' . $class . '><td><strong>' . $r['loc'];
    if (!empty($r['line_no'])) {
        $html .= ':' . $r['line_no'] . '</strong>';
    } elseif (!empty($r['post_id'])) {
        $html .= '</strong> <a href="' . get_edit_post_link($r['post_id']) . '" title="Edit this item">Edit</a>';
    } elseif (!empty($r['comment_id'])) {
        $html .= '</strong> <a href="' . admin_url("comment.php?action=editcomment&amp;c={$r['comment_id']}") . '" title="Edit this comment">Edit</a>';
    } else {
        $html .= '</strong>';
    }
    $html .= '<br />' . $r['desc'] . '</td><td>';
    if (!empty($r['line'])) {
        $html .= '<code>' . exploitscanner_hilight($r['line']) . '</code>';
    }
    return $html . '</td></tr>';
}
/**
 * Draw a single result row.
 */
function exploitscanner_draw_row($r)
{
    $class = !empty($r['class']) ? ' class="' . $r['class'] . '"' : '';
    $html = '<tr' . $class . '><td><strong>' . esc_html($r['loc']);
    if (!empty($r['line_no'])) {
        $html .= ':' . $r['line_no'] . '</strong>';
    } elseif (!empty($r['post_id'])) {
        $html .= '</strong> <a href="' . get_edit_post_link($r['post_id']) . '" title="Edit this item">Edit</a>';
    } elseif (!empty($r['comment_id'])) {
        $html .= '</strong> <a href="' . admin_url("comment.php?action=editcomment&amp;c={$r['comment_id']}") . '" title="Edit this comment">Edit</a>';
    } else {
        $html .= '</strong>';
    }
    $html .= '<br />' . $r['desc'] . '</td><td>';
    if (!empty($r['line'])) {
        $html .= '<code>' . exploitscanner_hilight(esc_html($r['line'])) . '</code>';
    } else {
        if ('Modified core file' == $r['desc']) {
            $url = add_query_arg(array('view' => 'diff', 'file' => $r['loc']), menu_page_url('exploit-scanner', false));
            $url = wp_nonce_url($url, 'exploit-scanner_view_diff');
            $html .= '<a href="' . $url . '" id="' . esc_attr($r['loc']) . '" class="view-diff">See what has been modified</a>';
        } else {
            if (!empty($r['vuln'])) {
                $url = add_query_arg(array('action' => 'fix', 'vulnerability' => $r['vuln'], 'file' => $r['loc']), menu_page_url('exploit-scanner', false));
                $url = wp_nonce_url($url, 'exploit-scanner_fix_' . $r['vuln'] . '_' . $r['loc']);
                $html .= '<a href="' . esc_url($url) . '">Fix now</a>';
            }
        }
    }
    return $html . '</td></tr>';
}