Skip to content

Commit

Permalink
Adhere to coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
kasunchathuranga committed Sep 6, 2013
1 parent f0585a2 commit c9268f8
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions libraries/server_privileges.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ function PMA_extractPrivInfo($row = '', $enableHTML = false, $tablePrivs = false
return $privs;
} // end of the 'PMA_extractPrivInfo()' function

/**
* Returns an array of table grants and their descriptions
*
* @return array array of table grants
*/
function PMA_getTableGrantsArray()
{
return array(
Expand Down Expand Up @@ -1929,8 +1934,7 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)

list($list_of_privileges, $list_of_compared_privileges)
= PMA_getListOfPrivilegesAndComparedPrivileges();
$sql_query =
"("
$sql_query = "("
. " SELECT " . $list_of_privileges . ", '*' AS `Db`"
. " FROM `mysql`.`user`"
. " WHERE NOT (" . $list_of_compared_privileges . ")"
Expand Down Expand Up @@ -1978,7 +1982,9 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
$privMap[$user][$host][] = $row;
}

$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table);
$html_output .= PMA_getHtmlTableBodyForSpecificDbOrTablePrivs(
$privMap, $db, $table
);
$html_output .= '</table>';
$html_output .= '</fieldset>';
$html_output .= '</form>';
Expand Down Expand Up @@ -2012,13 +2018,15 @@ function PMA_getHtmlForSpecificTablePrivileges($db, $table)
*
* @return string $html_output
*/
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null) {
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null)
{
$html_output = '<tbody>';
$odd_row = true;
if (! empty($privMap)) {
foreach ($privMap as $current_user => $val) {
foreach ($val as $current_host => $current_privileges) {
$html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html_output .= '<tr class="noclick '
. ($odd_row ? 'odd' : 'even') . '">';

// user
$html_output .= '<td';
Expand All @@ -2027,7 +2035,8 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = n
}
$html_output .= '>';
if (empty($current_user)) {
$html_output .= '<span style="color: #FF0000">' . __('Any') . '</span>';
$html_output .= '<span style="color: #FF0000">'
. __('Any') . '</span>';
} else {
$html_output .= htmlspecialchars($current_user);
}
Expand Down Expand Up @@ -2059,7 +2068,9 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = n
}
} else {
$html_output .= __('wildcard'). ': '
. '<code>' . htmlspecialchars($current['Db']) . '</code>';
. '<code>'
. htmlspecialchars($current['Db'])
. '</code>';
}
$html_output .= '</td>';

Expand All @@ -2069,7 +2080,7 @@ function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = n
$privList = explode(',', $current['Table_priv']);
$privs = array();
$grantsArr = PMA_getTableGrantsArray();
foreach($grantsArr as $grant) {
foreach ($grantsArr as $grant) {
$privs[$grant[0]] = 'N';
foreach ($privList as $priv) {
if ($grant[0] == $priv) {
Expand Down

0 comments on commit c9268f8

Please sign in to comment.