本文整理匯總了PHP中PMA_rangeOfUsers函數的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_rangeOfUsers函數的具體用法?PHP PMA_rangeOfUsers怎麽用?PHP PMA_rangeOfUsers使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PMA_rangeOfUsers函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testPMARangeOfUsers
/**
* Test for PMA_rangeOfUsers
*
* @return void
*/
public function testPMARangeOfUsers()
{
$ret = PMA_rangeOfUsers("INIT");
$this->assertEquals(" WHERE `User` LIKE 'INIT%' OR `User` LIKE 'init%'", $ret);
$ret = PMA_rangeOfUsers();
$this->assertEquals('', $ret);
}
示例3: PMA_DBI_fetch_result
. ' to solve this problem!';
PMA_Message::rawError($raw)->display();
}
} else {
// we also want users not in table `user` but in other table
$tables = PMA_DBI_fetch_result('SHOW TABLES FROM `mysql`;');
$tables_to_search_for_users = array(
'user', 'db', 'tables_priv', 'columns_priv', 'procs_priv',
);
$db_rights_sqls = array();
foreach ($tables_to_search_for_users as $table_search_in) {
if (in_array($table_search_in, $tables)) {
$db_rights_sqls[] = 'SELECT DISTINCT `User`, `Host` FROM `mysql`.`' . $table_search_in . '` ' . (isset($initial) ? PMA_rangeOfUsers($initial) : '');
}
}
$user_defaults = array(
'User' => '',
'Host' => '%',
'Password' => '?',
'Grant_priv' => 'N',
'privs' => array('USAGE'),
);
// for all initials, even non A-Z
$array_initials = array();
// for the rights
$db_rights = array();
示例4: PMA_getHtmlForDisplayUserOverviewPage
/**
* Get HTML snippet for display user overview page
*
* @param string $link_edit standard link to edit privileges
* @param string $pmaThemeImage a image source link
* @param string $text_dir text directory
* @param string $conditional_class if ajaxable 'Ajax' otherwise ''
* @param string $link_export standard link to export privileges
*
* @return string $html_output
*/
function PMA_getHtmlForDisplayUserOverviewPage($link_edit, $pmaThemeImage, $text_dir, $conditional_class, $link_export)
{
$html_output = '<h2>' . "\n" . PMA_Util::getIcon('b_usrlist.png') . __('Users overview') . "\n" . '</h2>' . "\n";
$sql_query = 'SELECT *,' . " IF(`Password` = _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;';
$res = PMA_DBI_try_query($sql_query, null, PMA_DBI_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
$sql_query = 'SELECT * FROM `mysql`.`user`';
$res = PMA_DBI_try_query($sql_query, null, PMA_DBI_QUERY_STORE);
if (!$res) {
$html_output .= PMA_Message::error(__('No Privileges'))->getDisplay();
PMA_DBI_free_result($res);
unset($res);
} 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();
}
} else {
$db_rights = PMA_getDbRightsForUserOverview();
// for all initials, even non A-Z
$array_initials = array();
/**
* Displays the initials
* Also not necassary if there is less than 20 privileges
*/
if (PMA_DBI_num_rows($res) > 20) {
$html_output .= PMA_getHtmlForDisplayTheInitials($array_initials, $conditional_class);
}
/**
* Display the user overview
* (if less than 50 users, display them immediately)
*/
if (isset($_REQUEST['initial']) || isset($_REQUEST['showall']) || PMA_DBI_num_rows($res) < 50) {
$html_output .= PMA_getUsersOverview($res, $db_rights, $link_edit, $pmaThemeImage, $text_dir, $conditional_class, $link_export);
} else {
$html_output .= PMA_getAddUserHtmlFieldset($conditional_class);
}
// 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?' . $GLOBALS['url_query'] . '&' . 'flush_privileges=1" id="reload_privileges_anchor" ' . 'class="' . $conditional_class . '">';
$flushnote->addParam($flushLink, false);
$flushnote->addParam('</a>', false);
$html_output .= $flushnote->getDisplay();
}
return $html_output;
}
}