本文整理匯總了PHP中PMA_updatePrivileges函數的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_updatePrivileges函數的具體用法?PHP PMA_updatePrivileges怎麽用?PHP PMA_updatePrivileges使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PMA_updatePrivileges函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser
* Changes / copies a user, part III
*/
if (isset($_REQUEST['change_copy'])) {
$queries = PMA_getDbSpecificPrivsQueriesForChangeOrCopyUser($queries, $username, $hostname);
}
/**
* Updates privileges
*/
if (!empty($_POST['update_privs'])) {
if (is_array($dbname)) {
foreach ($dbname as $key => $db_name) {
list($sql_query[$key], $message) = PMA_updatePrivileges(isset($username) ? $username : '', isset($hostname) ? $hostname : '', isset($tablename) ? $tablename : '', isset($db_name) ? $db_name : '');
}
$sql_query = implode("\n", $sql_query);
} else {
list($sql_query, $message) = PMA_updatePrivileges(isset($username) ? $username : '', isset($hostname) ? $hostname : '', isset($tablename) ? $tablename : '', isset($dbname) ? $dbname : '');
}
}
/**
* Assign users to user groups
*/
if (!empty($_REQUEST['changeUserGroup']) && $cfgRelation['menuswork'] && $GLOBALS['is_superuser'] && $GLOBALS['is_createuser']) {
PMA_setUserGroup($username, $_REQUEST['userGroup']);
$message = PMA_Message::success();
}
/**
* Revokes Privileges
*/
if (isset($_REQUEST['revokeall'])) {
list($message, $sql_query) = PMA_getMessageAndSqlQueryForPrivilegesRevoke(isset($dbname) ? $dbname : '', isset($tablename) ? $tablename : '', $username, $hostname);
}
示例2: testPMAUpdatePrivileges
/**
* Test for PMA_updatePrivileges
*
* @return void
*/
public function testPMAUpdatePrivileges()
{
$dbname = 'pma_dbname';
$username = 'pma_username';
$hostname = 'pma_hostname';
$tablename = 'pma_tablename';
$_REQUEST['adduser_submit'] = true;
$_POST['pred_username'] = 'any';
$_POST['pred_hostname'] = 'localhost';
$_REQUEST['createdb-3'] = true;
$_POST['Grant_priv'] = 'Y';
$_POST['max_questions'] = 1000;
list($sql_query, $message) = PMA_updatePrivileges($username, $hostname, $tablename, $dbname, '');
$this->assertEquals("You have updated the privileges for 'pma_username'@'pma_hostname'.", $message->getMessage());
$this->assertEquals("REVOKE ALL PRIVILEGES ON `pma_dbname`.`pma_tablename` " . "FROM 'pma_username'@'pma_hostname'; ", $sql_query);
}
示例3: PMA_getRoutineType
}
$itemType = '';
if (!empty($routinename)) {
$itemType = PMA_getRoutineType($dbname, $routinename);
}
/**
* Updates privileges
*/
if (!empty($_POST['update_privs'])) {
if (is_array($dbname)) {
foreach ($dbname as $key => $db_name) {
list($sql_query[$key], $message) = PMA_updatePrivileges(isset($username) ? $username : '', isset($hostname) ? $hostname : '', isset($tablename) ? $tablename : (isset($routinename) ? $routinename : ''), isset($db_name) ? $db_name : '', $itemType);
}
$sql_query = implode("\n", $sql_query);
} else {
list($sql_query, $message) = PMA_updatePrivileges(isset($username) ? $username : '', isset($hostname) ? $hostname : '', isset($tablename) ? $tablename : (isset($routinename) ? $routinename : ''), isset($dbname) ? $dbname : '', $itemType);
}
}
/**
* Assign users to user groups
*/
if (!empty($_REQUEST['changeUserGroup']) && $cfgRelation['menuswork'] && $GLOBALS['is_superuser'] && $GLOBALS['is_createuser']) {
PMA_setUserGroup($username, $_REQUEST['userGroup']);
$message = PMA\libraries\Message::success();
}
/**
* Revokes Privileges
*/
if (isset($_REQUEST['revokeall'])) {
list($message, $sql_query) = PMA_getMessageAndSqlQueryForPrivilegesRevoke(isset($dbname) ? $dbname : '', isset($tablename) ? $tablename : (isset($routinename) ? $routinename : ''), $username, $hostname, $itemType);
}