本文整理汇总了PHP中PMA_getHtmlForInitials函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getHtmlForInitials函数的具体用法?PHP PMA_getHtmlForInitials怎么用?PHP PMA_getHtmlForInitials使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_getHtmlForInitials函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getHtmlForUserOverview
/**
* Get HTML snippet for display user overview page
*
* @param string $pmaThemeImage a image source link
* @param string $text_dir text directory
*
* @return string $html_output
*/
function PMA_getHtmlForUserOverview($pmaThemeImage, $text_dir)
{
$html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usrlist.png') . __('Users overview') . "\n" . '</h2>' . "\n";
$password_column = 'Password';
if (PMA_Util::getServerType() == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50706) {
$password_column = 'authentication_string';
}
// $sql_query is for the initial-filtered,
// $sql_query_all is for counting the total no. of users
$sql_query = $sql_query_all = 'SELECT *,' . " IF(`" . $password_column . "` = _latin1 '', 'N', 'Y') AS 'Password'" . ' FROM `mysql`.`user`';
$sql_query .= isset($_REQUEST['initial']) ? PMA_rangeOfUsers($_REQUEST['initial']) : '';
$sql_query .= ' ORDER BY `User` ASC, `Host` ASC;';
$sql_query_all .= ' ;';
$res = $GLOBALS['dbi']->tryQuery($sql_query, null, PMA_DatabaseInterface::QUERY_STORE);
$res_all = $GLOBALS['dbi']->tryQuery($sql_query_all, null, PMA_DatabaseInterface::QUERY_STORE);
if (!$res) {
// the query failed! This may have two reasons:
// - the user does not have enough privileges
// - the privilege tables use a structure of an earlier version.
// so let's try a more simple query
$GLOBALS['dbi']->freeResult($res);
$GLOBALS['dbi']->freeResult($res_all);
$sql_query = 'SELECT * FROM `mysql`.`user`';
$res = $GLOBALS['dbi']->tryQuery($sql_query, null, PMA_DatabaseInterface::QUERY_STORE);
if (!$res) {
$html_output .= PMA_getHtmlForViewUsersError();
$html_output .= PMA_getAddUserHtmlFieldset();
} else {
// This message is hardcoded because I will replace it by
// a automatic repair feature soon.
$raw = 'Your privilege table structure seems to be older than' . ' this MySQL version!<br />' . 'Please run the <code>mysql_upgrade</code> command' . '(<code>mysql_fix_privilege_tables</code> on older systems)' . ' that should be included in your MySQL server distribution' . ' to solve this problem!';
$html_output .= PMA_Message::rawError($raw)->getDisplay();
}
$GLOBALS['dbi']->freeResult($res);
} else {
$db_rights = PMA_getDbRightsForUserOverview();
// for all initials, even non A-Z
$array_initials = array();
/**
* Displays the initials
* Also not necessary if there is less than 20 privileges
*/
if ($GLOBALS['dbi']->numRows($res_all) > 20) {
$html_output .= PMA_getHtmlForInitials($array_initials);
}
/**
* Display the user overview
* (if less than 50 users, display them immediately)
*/
if (isset($_REQUEST['initial']) || isset($_REQUEST['showall']) || $GLOBALS['dbi']->numRows($res) < 50) {
$html_output .= PMA_getUsersOverview($res, $db_rights, $pmaThemeImage, $text_dir);
} else {
$html_output .= PMA_getAddUserHtmlFieldset();
}
// end if (display overview)
if (!$GLOBALS['is_ajax_request'] || !empty($_REQUEST['ajax_page_request'])) {
$flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly ' . 'from MySQL\'s privilege tables. The content of these tables ' . 'may differ from the privileges the server uses, ' . 'if they have been changed manually. In this case, ' . 'you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE);
$flushLink = '<a href="server_privileges.php' . PMA_URL_getCommon(array('flush_privileges' => 1)) . '" id="reload_privileges_anchor">';
$flushnote->addParam($flushLink, false);
$flushnote->addParam('</a>', false);
$html_output .= $flushnote->getDisplay();
}
}
return $html_output;
}
示例2: testPMAGetHtmlForInitials
/**
* Tests for PMA_getHtmlForInitials
*
* @return void
*/
function testPMAGetHtmlForInitials()
{
// Setup for the test
$GLOBALS['dbi']->expects($this->any())->method('fetchRow')->will($this->onConsecutiveCalls(array('-')));
$actual = PMA_getHtmlForInitials(array('"' => true));
$this->assertContains('<td>A</td>', $actual);
$this->assertContains('<td>Z</td>', $actual);
$this->assertContains('<td><a class="ajax" href="server_privileges.php?initial=-&' . 'server=1&lang=en&collation_connection=' . 'collation_connection&token=token">-</a></td>', $actual);
$this->assertContains('<td><a class="ajax" href="server_privileges.php?initial=%22&' . 'server=1&lang=en&collation_connection=' . 'collation_connection&token=token">"</a>', $actual);
$this->assertContains('Show all', $actual);
}