Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f9ada30dba
@ -2210,7 +2210,8 @@ function PMA_getHtmlListOfPrivs(
|
||||
$specific_table = (isset($current['Table_name'])
|
||||
&& $current['Table_name'] != '*')
|
||||
? $current['Table_name'] : '';
|
||||
$html_output .= PMA_getUserEditLink(
|
||||
$html_output .= PMA_getUserLink(
|
||||
'edit',
|
||||
$current_user,
|
||||
$current_host,
|
||||
$specific_db,
|
||||
@ -2228,83 +2229,67 @@ function PMA_getHtmlListOfPrivs(
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns edit link for a user.
|
||||
* Returns edit, revoke or export link for a user.
|
||||
*
|
||||
* @param string $linktype The link type (edit | revoke | export)
|
||||
* @param string $username User name
|
||||
* @param string $hostname Host name
|
||||
* @param string $dbname Database name
|
||||
* @param string $tablename Table name
|
||||
* @param string $initial Initial value
|
||||
*
|
||||
* @return string HTML code with link
|
||||
*/
|
||||
function PMA_getUserEditLink($username, $hostname, $dbname = '', $tablename = '')
|
||||
{
|
||||
return '<a class="edit_user_anchor"'
|
||||
. ' href="server_privileges.php'
|
||||
. PMA_URL_getCommon(
|
||||
array(
|
||||
'username' => $username,
|
||||
'hostname' => $hostname,
|
||||
'dbname' => $dbname,
|
||||
'tablename' => $tablename,
|
||||
)
|
||||
)
|
||||
. '">'
|
||||
. PMA_Util::getIcon('b_usredit.png', __('Edit Privileges'))
|
||||
. '</a>';
|
||||
}
|
||||
function PMA_getUserLink(
|
||||
$linktype, $username, $hostname, $dbname = '', $tablename = '', $initial = ''
|
||||
) {
|
||||
$html = '<a';
|
||||
switch($linktype) {
|
||||
case 'edit':
|
||||
$html .= ' class="edit_user_anchor"';
|
||||
break;
|
||||
case 'export':
|
||||
$html .= ' class="export_user_anchor ajax"';
|
||||
break;
|
||||
}
|
||||
$params = array(
|
||||
'username' => $username,
|
||||
'hostname' => $hostname
|
||||
);
|
||||
switch($linktype) {
|
||||
case 'edit':
|
||||
$params['dbname'] = $dbname;
|
||||
$params['tablename'] = $tablename;
|
||||
break;
|
||||
case 'revoke':
|
||||
$params['dbname'] = $dbname;
|
||||
$params['tablename'] = $tablename;
|
||||
$params['revokeall'] = 1;
|
||||
break;
|
||||
case 'export':
|
||||
$params['initial'] = $initial;
|
||||
$params['export'] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns revoke link for a user.
|
||||
*
|
||||
* @param string $username User name
|
||||
* @param string $hostname Host name
|
||||
* @param string $dbname Database name
|
||||
* @param string $tablename Table name
|
||||
*
|
||||
* @return string HTML code with link
|
||||
*/
|
||||
function PMA_getUserRevokeLink($username, $hostname, $dbname = '', $tablename = '')
|
||||
{
|
||||
return '<a href="server_privileges.php'
|
||||
. PMA_URL_getCommon(
|
||||
array(
|
||||
'username' => $username,
|
||||
'hostname' => $hostname,
|
||||
'dbname' => $dbname,
|
||||
'tablename' => $tablename,
|
||||
'revokeall' => 1,
|
||||
)
|
||||
)
|
||||
. '">'
|
||||
. PMA_Util::getIcon('b_usrdrop.png', __('Revoke'))
|
||||
. '</a>';
|
||||
}
|
||||
$html .= ' href="server_privileges.php'
|
||||
. PMA_URL_getCommon($params)
|
||||
. '">';
|
||||
|
||||
/**
|
||||
* Returns export link for a user.
|
||||
*
|
||||
* @param string $username User name
|
||||
* @param string $hostname Host name
|
||||
* @param string $initial Initial value
|
||||
*
|
||||
* @return HTML code with link
|
||||
*/
|
||||
function PMA_getUserExportLink($username, $hostname, $initial = '')
|
||||
{
|
||||
return '<a class="export_user_anchor ajax"'
|
||||
. ' href="server_privileges.php'
|
||||
. PMA_URL_getCommon(
|
||||
array(
|
||||
'username' => $username,
|
||||
'hostname' => $hostname,
|
||||
'initial' => $initial,
|
||||
'export' => 1,
|
||||
)
|
||||
)
|
||||
. '">'
|
||||
. PMA_Util::getIcon('b_tblexport.png', __('Export'))
|
||||
. '</a>';
|
||||
switch($linktype) {
|
||||
case 'edit':
|
||||
$html .= PMA_Util::getIcon('b_usredit.png', __('Edit Privileges'));
|
||||
break;
|
||||
case 'revoke':
|
||||
$html .= PMA_Util::getIcon('b_usrdrop.png', __('Revoke'));
|
||||
break;
|
||||
case 'export':
|
||||
$html .= PMA_Util::getIcon('b_tblexport.png', __('Export'));
|
||||
break;
|
||||
}
|
||||
$html . '</a>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2426,7 +2411,7 @@ function PMA_getExtraDataForAjaxBehavior(
|
||||
$new_user_string .='</td>';
|
||||
|
||||
$new_user_string .= '<td>'
|
||||
. PMA_getUserEditLink($username, $hostname)
|
||||
. PMA_getUserLink('edit', $username, $hostname)
|
||||
. '</td>' . "\n";
|
||||
|
||||
if (isset($cfgRelation['menuswork']) && $user_group_count > 0) {
|
||||
@ -2436,9 +2421,12 @@ function PMA_getExtraDataForAjaxBehavior(
|
||||
}
|
||||
|
||||
$new_user_string .= '<td>'
|
||||
. PMA_getUserExportLink(
|
||||
. PMA_getUserLink(
|
||||
'export',
|
||||
$username,
|
||||
$hostname,
|
||||
'',
|
||||
'',
|
||||
isset($_GET['initial']) ? $_GET['initial'] : ''
|
||||
)
|
||||
. '</td>' . "\n";
|
||||
@ -2750,7 +2738,8 @@ function PMA_getHtmlForUserRights($db_rights, $dbname,
|
||||
}
|
||||
$html_output .= '</td>' . "\n"
|
||||
. '<td>';
|
||||
$html_output .= PMA_getUserEditLink(
|
||||
$html_output .= PMA_getUserLink(
|
||||
'edit',
|
||||
$username,
|
||||
$hostname,
|
||||
(!$pmaString->strlen($dbname)) ? $row['Db'] : $dbname,
|
||||
@ -2762,7 +2751,8 @@ function PMA_getHtmlForUserRights($db_rights, $dbname,
|
||||
|| isset($row['Table_name'])
|
||||
&& $pmaString->strlen($row['Table_name'])
|
||||
) {
|
||||
$html_output .= PMA_getUserRevokeLink(
|
||||
$html_output .= PMA_getUserLink(
|
||||
'revoke',
|
||||
$username,
|
||||
$hostname,
|
||||
(! $pmaString->strlen($dbname)) ? $row['Db'] : $dbname,
|
||||
@ -3114,7 +3104,8 @@ function PMA_getHtmlTableBodyForUserRights($db_rights)
|
||||
. '</td>' . "\n";
|
||||
|
||||
$html_output .= '<td class="center">'
|
||||
. PMA_getUserEditLink(
|
||||
. PMA_getUserLink(
|
||||
'edit',
|
||||
$host['User'],
|
||||
$host['Host']
|
||||
)
|
||||
@ -3129,9 +3120,12 @@ function PMA_getHtmlTableBodyForUserRights($db_rights)
|
||||
}
|
||||
}
|
||||
$html_output .= '<td class="center">'
|
||||
. PMA_getUserExportLink(
|
||||
. PMA_getUserLink(
|
||||
'export',
|
||||
$host['User'],
|
||||
$host['Host'],
|
||||
'',
|
||||
'',
|
||||
isset($_GET['initial']) ? $_GET['initial'] : ''
|
||||
)
|
||||
. '</td>';
|
||||
|
||||
@ -1453,19 +1453,20 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getUserEditLink
|
||||
* Test for PMA_getUserLink
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMAGetUserEditLink()
|
||||
public function testPMAGetUserLink()
|
||||
{
|
||||
$username = "pma_username";
|
||||
$hostname = "pma_hostname";
|
||||
$dbname = "pma_dbname";
|
||||
$tablename = "pma_tablename";
|
||||
|
||||
//PMA_getUserEditLink
|
||||
$html = PMA_getUserEditLink($username, $hostname, $dbname, $tablename);
|
||||
$html = PMA_getUserLink(
|
||||
'edit', $username, $hostname, $dbname, $tablename
|
||||
);
|
||||
|
||||
$url_html = PMA_URL_getCommon(
|
||||
array(
|
||||
@ -1484,8 +1485,9 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$html
|
||||
);
|
||||
|
||||
//PMA_getUserRevokeLink
|
||||
$html = PMA_getUserRevokeLink($username, $hostname, $dbname, $tablename);
|
||||
$html = PMA_getUserLink(
|
||||
'revoke', $username, $hostname, $dbname, $tablename
|
||||
);
|
||||
|
||||
$url_html = PMA_URL_getCommon(
|
||||
array(
|
||||
@ -1505,8 +1507,7 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$html
|
||||
);
|
||||
|
||||
//PMA_getUserExportLink
|
||||
$html = PMA_getUserExportLink($username, $hostname);
|
||||
$html = PMA_getUserLink('export', $username, $hostname);
|
||||
|
||||
$url_html = PMA_URL_getCommon(
|
||||
array(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user