本文整理汇总了PHP中PMA_getUserLink函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getUserLink函数的具体用法?PHP PMA_getUserLink怎么用?PHP PMA_getUserLink使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getUserLink函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getHtmlTableBodyForUserRights
/**
* Get table body for 'tableuserrights' table in userform
*
* @param array $db_rights user's database rights array
*
* @return string HTML snippet
*/
function PMA_getHtmlTableBodyForUserRights($db_rights)
{
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['menuswork']) {
$users_table = PMA_Util::backquote($cfgRelation['db']) . "." . PMA_Util::backquote($cfgRelation['users']);
$sql_query = 'SELECT * FROM ' . $users_table;
$result = PMA_queryAsControlUser($sql_query, false);
$group_assignment = array();
if ($result) {
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$group_assignment[$row['username']] = $row['usergroup'];
}
}
$GLOBALS['dbi']->freeResult($result);
$user_group_count = PMA_getUserGroupCount();
}
$odd_row = true;
$index_checkbox = 0;
$html_output = '';
foreach ($db_rights as $user) {
ksort($user);
foreach ($user as $host) {
$index_checkbox++;
$html_output .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n";
$html_output .= '<td>' . '<input type="checkbox" class="checkall" name="selected_usr[]" ' . 'id="checkbox_sel_users_' . $index_checkbox . '" value="' . htmlspecialchars($host['User'] . '&#27;' . $host['Host']) . '"' . ' /></td>' . "\n";
$html_output .= '<td><label ' . 'for="checkbox_sel_users_' . $index_checkbox . '">' . (empty($host['User']) ? '<span style="color: #FF0000">' . __('Any') . '</span>' : htmlspecialchars($host['User'])) . '</label></td>' . "\n" . '<td>' . htmlspecialchars($host['Host']) . '</td>' . "\n";
$html_output .= '<td>';
switch ($host['Password']) {
case 'Y':
$html_output .= __('Yes');
break;
case 'N':
$html_output .= '<span style="color: #FF0000">' . __('No') . '</span>';
break;
// this happens if this is a definition not coming from mysql.user
// this happens if this is a definition not coming from mysql.user
default:
$html_output .= '--';
// in future version, replace by "not present"
break;
}
// end switch
$html_output .= '</td>' . "\n";
$html_output .= '<td><code>' . "\n" . '' . implode(',' . "\n" . ' ', $host['privs']) . "\n" . '</code></td>' . "\n";
if ($cfgRelation['menuswork']) {
$html_output .= '<td class="usrGroup">' . "\n" . (isset($group_assignment[$host['User']]) ? $group_assignment[$host['User']] : '') . '</td>' . "\n";
}
$html_output .= '<td>' . ($host['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . '</td>' . "\n";
if ($GLOBALS['is_grantuser']) {
$html_output .= '<td class="center">' . PMA_getUserLink('edit', $host['User'], $host['Host']) . '</td>';
}
if ($cfgRelation['menuswork'] && $user_group_count > 0) {
if (empty($host['User'])) {
$html_output .= '<td class="center"></td>';
} else {
$html_output .= '<td class="center">' . PMA_getUserGroupEditLink($host['User']) . '</td>';
}
}
$html_output .= '<td class="center">' . PMA_getUserLink('export', $host['User'], $host['Host'], '', '', isset($_GET['initial']) ? $_GET['initial'] : '') . '</td>';
$html_output .= '</tr>';
$odd_row = !$odd_row;
}
}
return $html_output;
}
示例2: testPMAGetUserLink
/**
* Test for PMA_getUserLink
*
* @return void
*/
public function testPMAGetUserLink()
{
$username = "pma_username";
$hostname = "pma_hostname";
$dbname = "pma_dbname";
$tablename = "pma_tablename";
$html = PMA_getUserLink('edit', $username, $hostname, $dbname, $tablename, '');
$url_html = PMA_URL_getCommon(array('username' => $username, 'hostname' => $hostname, 'dbname' => $dbname, 'tablename' => $tablename, 'routinename' => ''));
$this->assertContains($url_html, $html);
$this->assertContains(__('Edit privileges'), $html);
$html = PMA_getUserLink('revoke', $username, $hostname, $dbname, $tablename, '');
$url_html = PMA_URL_getCommon(array('username' => $username, 'hostname' => $hostname, 'dbname' => $dbname, 'tablename' => $tablename, 'routinename' => '', 'revokeall' => 1));
$this->assertContains($url_html, $html);
$this->assertContains(__('Revoke'), $html);
$html = PMA_getUserLink('export', $username, $hostname);
$url_html = PMA_URL_getCommon(array('username' => $username, 'hostname' => $hostname, 'initial' => "", 'export' => 1));
$this->assertContains($url_html, $html);
$this->assertContains(__('Export'), $html);
}