本文整理汇总了PHP中PMA_getHtmlForSpecificTablePrivileges函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getHtmlForSpecificTablePrivileges函数的具体用法?PHP PMA_getHtmlForSpecificTablePrivileges怎么用?PHP PMA_getHtmlForSpecificTablePrivileges使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getHtmlForSpecificTablePrivileges函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPMAGetHtmlForSpecificTablePrivileges
/**
* Test for PMA_getHtmlForSpecificTablePrivileges
*
* @return void
*/
public function testPMAGetHtmlForSpecificTablePrivileges()
{
$dbi_old = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$fields_info = array(array('COLUMN_NAME' => 'Host', 'CHARACTER_MAXIMUM_LENGTH' => 80), array('COLUMN_NAME' => 'User', 'CHARACTER_MAXIMUM_LENGTH' => 40));
$dbi->expects($this->any())->method('fetchResult')->will($this->returnValue($fields_info));
$GLOBALS['dbi'] = $dbi;
$db = "pma_dbname";
$table = "pma_table";
$html = PMA_getHtmlForSpecificTablePrivileges($db, $table);
//validate 1: $db, $table
$this->assertContains(htmlspecialchars($db) . '.' . htmlspecialchars($table), $html);
//validate 2: PMA_URL_getCommon
$item = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
$this->assertContains($item, $html);
//validate 3: items
$this->assertContains(__('User'), $html);
$this->assertContains(__('Host'), $html);
$this->assertContains(__('Type'), $html);
$this->assertContains(__('Privileges'), $html);
$this->assertContains(__('Grant'), $html);
$this->assertContains(__('Action'), $html);
//_pgettext('Create new user', 'New')
$this->assertContains(_pgettext('Create new user', 'New'), $html);
$this->assertContains(PMA_URL_getCommon(array('checkprivsdb' => $db, 'checkprivstable' => $table)), $html);
$GLOBALS['dbi'] = $dbi_old;
}
示例2: PMA_getHtmlForAddUser
} else {
$response->addHTML("<h2>$title</h2>$export");
}
}
if (isset($_REQUEST['adduser'])) {
// Add user
$response->addHTML(
PMA_getHtmlForAddUser((isset($dbname) ? $dbname : ''))
);
} elseif (isset($_REQUEST['checkprivsdb'])) {
if (isset($_REQUEST['checkprivstable'])) {
// check the privileges for a particular table.
$response->addHTML(
PMA_getHtmlForSpecificTablePrivileges(
$_REQUEST['checkprivsdb'], $_REQUEST['checkprivstable']
)
);
} else {
// check the privileges for a particular database.
$response->addHTML(
PMA_getHtmlForSpecificDbPrivileges($_REQUEST['checkprivsdb'])
);
}
} else {
if (isset($dbname) && ! is_array($dbname)) {
$url_dbname = urlencode(
str_replace(
array('\_', '\%'),
array('_', '%'),
$_REQUEST['dbname']
示例3: elseif
$response = PMA_Response::getInstance();
if ($GLOBALS['is_ajax_request']) {
$response->addJSON('message', $export);
$response->addJSON('title', $title);
exit;
} else {
$response->addHTML("<h2>{$title}</h2>{$export}");
}
}
if (isset($_REQUEST['adduser'])) {
// Add user
$response->addHTML(PMA_getHtmlForAddUser(isset($dbname) ? $dbname : ''));
} elseif (isset($_REQUEST['checkprivsdb'])) {
if (isset($_REQUEST['checkprivstable'])) {
// check the privileges for a particular table.
$response->addHTML(PMA_getHtmlForSpecificTablePrivileges($_REQUEST['checkprivsdb'], $_REQUEST['checkprivstable']));
} else {
// check the privileges for a particular database.
$response->addHTML(PMA_getHtmlForSpecificDbPrivileges($_REQUEST['checkprivsdb']));
}
} else {
if (!isset($username)) {
// No username is given --> display the overview
$response->addHTML(PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir));
} else {
// A user was selected -> display the user's properties
// In an Ajax request, prevent cached values from showing
if ($GLOBALS['is_ajax_request'] == true) {
header('Cache-Control: no-cache');
}
if (isset($dbname) && !is_array($dbname)) {
示例4: testPMAGetHtmlForSpecificTablePrivileges
/**
* Test for PMA_getHtmlForSpecificTablePrivileges
*
* @return void
*/
public function testPMAGetHtmlForSpecificTablePrivileges()
{
$dbi_old = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$fields_info = array(
"Host" => array(
"Field" => "host",
"Type" => "char(60)",
"Null" => "NO",
)
);
$dbi->expects($this->any())->method('getColumns')
->will($this->returnValue($fields_info));
$GLOBALS['dbi'] = $dbi;
$db = "pma_dbname";
$table = "pma_table";
$html = PMA_getHtmlForSpecificTablePrivileges($db, $table);
//validate 1: $db, $table
$this->assertContains(
htmlspecialchars($db) . '.' . htmlspecialchars($table),
$html
);
//validate 2: PMA_URL_getCommon
$item = PMA_URL_getCommon(
array(
'db' => $db,
'table' => $table,
)
);
$this->assertContains(
$item,
$html
);
//validate 3: items
$this->assertContains(
__('User'),
$html
);
$this->assertContains(
__('Host'),
$html
);
$this->assertContains(
__('Type'),
$html
);
$this->assertContains(
__('Privileges'),
$html
);
$this->assertContains(
__('Grant'),
$html
);
$this->assertContains(
__('Action'),
$html
);
//_pgettext('Create new user', 'New')
$this->assertContains(
_pgettext('Create new user', 'New'),
$html
);
$this->assertContains(
PMA_URL_getCommon(
array('checkprivsdb' => $db, 'checkprivstable' => $table)
),
$html
);
$GLOBALS['dbi'] = $dbi_old;
}