コード例 #1
0
/**
 * Get HTML snippet for table body of specific database or table privileges
 *
 * @param array  $privMap privilege map
 * @param string $db      database
 *
 * @return string $html_output
 */
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db)
{
    $html_output = '<tbody>';
    $index_checkbox = 0;
    $odd_row = true;
    if (empty($privMap)) {
        $html_output .= '<tr class="odd">' . '<td colspan="6">' . __('No user found.') . '</td>' . '</tr>' . '</tbody>';
        return $html_output;
    }
    foreach ($privMap as $current_user => $val) {
        foreach ($val as $current_host => $current_privileges) {
            $nbPrivileges = count($current_privileges);
            $html_output .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
            $value = htmlspecialchars($current_user . '&amp;#27;' . $current_host);
            $html_output .= '<td';
            if ($nbPrivileges > 1) {
                $html_output .= ' rowspan="' . $nbPrivileges . '"';
            }
            $html_output .= '>';
            $html_output .= '<input type="checkbox" class="checkall" name="selected_usr[]" ' . 'id="checkbox_sel_users_' . $index_checkbox++ . '" ' . 'value="' . $value . '" /></td>' . "\n";
            // user
            $html_output .= '<td';
            if ($nbPrivileges > 1) {
                $html_output .= ' rowspan="' . $nbPrivileges . '"';
            }
            $html_output .= '>';
            if (empty($current_user)) {
                $html_output .= '<span style="color: #FF0000">' . __('Any') . '</span>';
            } else {
                $html_output .= htmlspecialchars($current_user);
            }
            $html_output .= '</td>';
            // host
            $html_output .= '<td';
            if ($nbPrivileges > 1) {
                $html_output .= ' rowspan="' . $nbPrivileges . '"';
            }
            $html_output .= '>';
            $html_output .= htmlspecialchars($current_host);
            $html_output .= '</td>';
            $html_output .= PMA_getHtmlListOfPrivs($db, $current_privileges, $current_user, $current_host, $odd_row);
            $odd_row = !$odd_row;
        }
    }
    $html_output .= '</tbody>';
    return $html_output;
}
コード例 #2
0
/**
 * Get HTML snippet for table body of specific database or table privileges
 *
 * @param array  $privMap privilege map
 * @param string $db      database
 *
 * @return string $html_output
 */
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db)
{
    $html_output = '<tbody>';
    $odd_row = true;
    if (empty($privMap)) {
        $html_output .= '<tr class="odd">' . '<td colspan="6">' . __('No user found.') . '</td>' . '</tr>' . '</tbody>';
        return $html_output;
    }
    foreach ($privMap as $current_user => $val) {
        foreach ($val as $current_host => $current_privileges) {
            $nbPrivileges = count($current_privileges);
            $html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
            // user
            $html_output .= '<td';
            if ($nbPrivileges > 1) {
                $html_output .= ' rowspan="' . $nbPrivileges . '"';
            }
            $html_output .= '>';
            if (empty($current_user)) {
                $html_output .= '<span style="color: #FF0000">' . __('Any') . '</span>';
            } else {
                $html_output .= htmlspecialchars($current_user);
            }
            $html_output .= '</td>';
            // host
            $html_output .= '<td';
            if ($nbPrivileges > 1) {
                $html_output .= ' rowspan="' . $nbPrivileges . '"';
            }
            $html_output .= '>';
            $html_output .= htmlspecialchars($current_host);
            $html_output .= '</td>';
            $html_output .= PMA_getHtmlListOfPrivs($db, $current_privileges, $current_user, $current_host, $odd_row);
            $odd_row = !$odd_row;
        }
    }
    $html_output .= '</tbody>';
    return $html_output;
}