本文整理汇总了PHP中PMA_Util::currentUserHasPrivilege方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::currentUserHasPrivilege方法的具体用法?PHP PMA_Util::currentUserHasPrivilege怎么用?PHP PMA_Util::currentUserHasPrivilege使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::currentUserHasPrivilege方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_RTE_getFooterLinks
/**
* Creates a fieldset for adding a new item, if the user has the privileges.
*
* @param string $docu String used to create a link to the MySQL docs
* @param string $priv Privilege to check for adding a new item
* @param string $name MySQL name of the item
*
* @return string An HTML snippet with the link to add a new item
*/
function PMA_RTE_getFooterLinks($docu, $priv, $name)
{
global $db, $url_query, $ajax_class;
$icon = 'b_' . strtolower($name) . '_add.png';
$retval = "";
$retval .= "<!-- ADD " . $name . " FORM START -->\n";
$retval .= "<fieldset class='left'>\n";
$retval .= "<legend>" . _pgettext('Create new procedure', 'New') . "</legend>\n";
$retval .= " <div class='wrap'>\n";
if (PMA_Util::currentUserHasPrivilege($priv, $db)) {
$retval .= " <a {$ajax_class['add']} ";
$retval .= "href='db_" . strtolower($name) . "s.php";
$retval .= "?{$url_query}&add_item=1' onclick='\$.datepicker.initialized = false;'>";
$retval .= PMA_Util::getIcon($icon);
$retval .= PMA_RTE_getWord('add') . "</a>\n";
} else {
$retval .= " " . PMA_Util::getIcon($icon);
$retval .= PMA_RTE_getWord('no_create') . "\n";
}
$retval .= " " . PMA_Util::showMySQLDocu($docu) . "\n";
$retval .= " </div>\n";
$retval .= "</fieldset>\n";
$retval .= "<!-- ADD " . $name . " FORM END -->\n\n";
return $retval;
}
示例2: _getDbTabs
/**
* Returns the db tabs as an array
*
* @return array Data for generating db tabs
*/
private function _getDbTabs()
{
$db_is_system_schema = $GLOBALS['dbi']->isSystemSchema($this->_db);
$num_tables = count($GLOBALS['dbi']->getTables($this->_db));
$is_superuser = $GLOBALS['dbi']->isSuperuser();
$isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant') || $GLOBALS['dbi']->isUserType('create');
/**
* Gets the relation settings
*/
$cfgRelation = PMA_getRelationsParam();
$tabs = array();
$tabs['structure']['link'] = 'db_structure.php';
$tabs['structure']['text'] = __('Structure');
$tabs['structure']['icon'] = 'b_props.png';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['icon'] = 'b_search.png';
$tabs['search']['link'] = 'db_search.php';
if ($num_tables == 0) {
$tabs['search']['warning'] = __('Database seems to be empty!');
}
$tabs['qbe']['text'] = __('Query');
$tabs['qbe']['icon'] = 's_db.png';
$tabs['qbe']['link'] = 'db_qbe.php';
if ($num_tables == 0) {
$tabs['qbe']['warning'] = __('Database seems to be empty!');
}
$tabs['export']['text'] = __('Export');
$tabs['export']['icon'] = 'b_export.png';
$tabs['export']['link'] = 'db_export.php';
if ($num_tables == 0) {
$tabs['export']['warning'] = __('Database seems to be empty!');
}
if (!$db_is_system_schema) {
$tabs['import']['link'] = 'db_import.php';
$tabs['import']['text'] = __('Import');
$tabs['import']['icon'] = 'b_import.png';
$tabs['operation']['link'] = 'db_operations.php';
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';
if (($is_superuser || $isCreateOrGrantUser) && !PMA_DRIZZLE) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (!PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
}
}
if (PMA_Tracker::isActive()) {
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['icon'] = 'eye.png';
$tabs['tracking']['link'] = 'db_tracking.php';
}
if (!$db_is_system_schema) {
$tabs['designer']['text'] = __('Designer');
$tabs['designer']['icon'] = 'b_relations.png';
$tabs['designer']['link'] = 'db_designer.php';
$tabs['designer']['id'] = 'designer_tab';
}
if (!$db_is_system_schema && isset($cfgRelation['central_columnswork']) && $cfgRelation['central_columnswork']) {
$tabs['central_columns']['text'] = __('Central columns');
$tabs['central_columns']['icon'] = 'centralColumns.png';
$tabs['central_columns']['link'] = 'db_central_columns.php';
}
return $tabs;
}
示例3: _getDbTabs
/**
* Returns the db tabs as an array
*
* @return array Data for generating db tabs
*/
private function _getDbTabs()
{
$db_is_information_schema = PMA_is_system_schema($this->_db);
$num_tables = count(PMA_DBI_get_tables($this->_db));
$is_superuser = PMA_isSuperuser();
/**
* Gets the relation settings
*/
$cfgRelation = PMA_getRelationsParam();
$tabs = array();
$tabs['structure']['link'] = 'db_structure.php';
$tabs['structure']['text'] = __('Structure');
$tabs['structure']['icon'] = 'b_props.png';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['args']['db_query_force'] = 1;
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql.png';
$tabs['search']['text'] = __('Search');
$tabs['search']['icon'] = 'b_search.png';
$tabs['search']['link'] = 'db_search.php';
if ($num_tables == 0) {
$tabs['search']['warning'] = __('Database seems to be empty!');
}
$tabs['qbe']['text'] = __('Query');
$tabs['qbe']['icon'] = 's_db.png';
$tabs['qbe']['link'] = 'db_qbe.php';
if ($num_tables == 0) {
$tabs['qbe']['warning'] = __('Database seems to be empty!');
}
$tabs['export']['text'] = __('Export');
$tabs['export']['icon'] = 'b_export.png';
$tabs['export']['link'] = 'db_export.php';
if ($num_tables == 0) {
$tabs['export']['warning'] = __('Database seems to be empty!');
}
if (!$db_is_information_schema) {
$tabs['import']['link'] = 'db_import.php';
$tabs['import']['text'] = __('Import');
$tabs['import']['icon'] = 'b_import.png';
$tabs['operation']['link'] = 'db_operations.php';
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';
if ($is_superuser && !PMA_DRIZZLE) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivs'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (!PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (PMA_MYSQL_INT_VERSION >= 50106 && !PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (!PMA_DRIZZLE && PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
}
}
if (PMA_Tracker::isActive()) {
$tabs['tracking']['text'] = __('Tracking');
$tabs['tracking']['icon'] = 'eye.png';
$tabs['tracking']['link'] = 'db_tracking.php';
}
if (!$db_is_information_schema && $cfgRelation['designerwork']) {
$tabs['designer']['text'] = __('Designer');
$tabs['designer']['icon'] = 'b_relations.png';
$tabs['designer']['link'] = 'pmd_general.php';
}
return $tabs;
}
示例4: PMA_EVN_getRowForList
/**
* Creates the contents for a row in the list of events
*
* @param array $event An array of routine data
* @param string $rowclass Empty or one of ['even'|'odd']
*
* @return string HTML code of a cell for the list of events
*/
function PMA_EVN_getRowForList($event, $rowclass = '')
{
global $ajax_class, $url_query, $db, $titles;
$sql_drop = sprintf('DROP EVENT IF EXISTS %s', PMA_Util::backquote($event['name']));
$retval = " <tr class='{$rowclass}'>\n";
$retval .= " <td>\n";
$retval .= ' <input type="checkbox"' . ' class="checkall" name="item_name[]"' . ' value="' . htmlspecialchars($event['name']) . '" />';
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= " <span class='drop_sql hide'>" . htmlspecialchars($sql_drop) . "</span>\n";
$retval .= " <strong>\n";
$retval .= " " . htmlspecialchars($event['name']) . "\n";
$retval .= " </strong>\n";
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= " {$event['status']}\n";
$retval .= " </td>\n";
$retval .= " <td>\n";
if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) {
$retval .= ' <a ' . $ajax_class['edit'] . ' href="db_events.php' . $url_query . '&edit_item=1' . '&item_name=' . urlencode($event['name']) . '">' . $titles['Edit'] . "</a>\n";
} else {
$retval .= " {$titles['NoEdit']}\n";
}
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= ' <a ' . $ajax_class['export'] . ' href="db_events.php' . $url_query . '&export_item=1' . '&item_name=' . urlencode($event['name']) . '">' . $titles['Export'] . "</a>\n";
$retval .= " </td>\n";
$retval .= " <td>\n";
if (PMA_Util::currentUserHasPrivilege('EVENT', $db)) {
$retval .= ' <a ' . $ajax_class['drop'] . ' href="sql.php' . $url_query . '&sql_query=' . urlencode($sql_drop) . '&goto=db_events.php' . urlencode("?db={$db}") . '" >' . $titles['Drop'] . "</a>\n";
} else {
$retval .= " {$titles['NoDrop']}\n";
}
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= " {$event['type']}\n";
$retval .= " </td>\n";
$retval .= " </tr>\n";
return $retval;
}