当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_getTableGrantsArray函数代码示例

本文整理汇总了PHP中PMA_getTableGrantsArray函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_getTableGrantsArray函数的具体用法?PHP PMA_getTableGrantsArray怎么用?PHP PMA_getTableGrantsArray使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_getTableGrantsArray函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testPMAGetTableGrantsArray

 /**
  * Test for PMA_getTableGrantsArray
  *
  * @return void
  */
 public function testPMAGetTableGrantsArray()
 {
     $GLOBALS['strPrivDescDelete'] = "strPrivDescDelete";
     $GLOBALS['strPrivDescCreateTbl'] = "strPrivDescCreateTbl";
     $GLOBALS['strPrivDescDropTbl'] = "strPrivDescDropTbl";
     $GLOBALS['strPrivDescIndex'] = "strPrivDescIndex";
     $GLOBALS['strPrivDescAlter'] = "strPrivDescAlter";
     $GLOBALS['strPrivDescCreateView'] = "strPrivDescCreateView";
     $GLOBALS['strPrivDescShowView'] = "strPrivDescShowView";
     $GLOBALS['strPrivDescTrigger'] = "strPrivDescTrigger";
     $ret = PMA_getTableGrantsArray();
     $this->assertEquals(array('Delete', 'DELETE', $GLOBALS['strPrivDescDelete']), $ret[0]);
     $this->assertEquals(array('Create', 'CREATE', $GLOBALS['strPrivDescCreateTbl']), $ret[1]);
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:19,代码来源:PMA_server_privileges_test.php

示例2: PMA_getHtmlListOfPrivs

/**
 * Get HTML to display privileges
 *
 * @param string  $db                 Database name
 * @param array   $current_privileges List of privileges
 * @param string  $current_user       Current user
 * @param string  $current_host       Current host
 * @param boolean $odd_row            Current row is odd
 *
 * @return string HTML to display privileges
 */
function PMA_getHtmlListOfPrivs($db, $current_privileges, $current_user, $current_host, $odd_row)
{
    $nbPrivileges = count($current_privileges);
    $html_output = null;
    for ($i = 0; $i < $nbPrivileges; $i++) {
        $current = $current_privileges[$i];
        // type
        $html_output .= '<td>';
        if ($current['Type'] == 'g') {
            $html_output .= __('global');
        } elseif ($current['Type'] == 'd') {
            if ($current['Db'] == PMA_Util::escapeMysqlWildcards($db)) {
                $html_output .= __('database-specific');
            } else {
                $html_output .= __('wildcard') . ': ' . '<code>' . htmlspecialchars($current['Db']) . '</code>';
            }
        } elseif ($current['Type'] == 't') {
            $html_output .= __('table-specific');
        }
        $html_output .= '</td>';
        // privileges
        $html_output .= '<td>';
        if (isset($current['Table_name'])) {
            $privList = explode(',', $current['Table_priv']);
            $privs = array();
            $grantsArr = PMA_getTableGrantsArray();
            foreach ($grantsArr as $grant) {
                $privs[$grant[0]] = 'N';
                foreach ($privList as $priv) {
                    if ($grant[0] == $priv) {
                        $privs[$grant[0]] = 'Y';
                    }
                }
            }
            $html_output .= '<code>' . join(',', PMA_extractPrivInfo($privs, true, true)) . '</code>';
        } else {
            $html_output .= '<code>' . join(',', PMA_extractPrivInfo($current, true, false)) . '</code>';
        }
        $html_output .= '</td>';
        // grant
        $html_output .= '<td>';
        $containsGrant = false;
        if (isset($current['Table_name'])) {
            $privList = explode(',', $current['Table_priv']);
            foreach ($privList as $priv) {
                if ($priv == 'Grant') {
                    $containsGrant = true;
                }
            }
        } else {
            $containsGrant = $current['Grant_priv'] == 'Y';
        }
        $html_output .= $containsGrant ? __('Yes') : __('No');
        $html_output .= '</td>';
        // action
        $html_output .= '<td>';
        if ($GLOBALS['is_grantuser']) {
            $specific_db = isset($current['Db']) && $current['Db'] != '*' ? $current['Db'] : '';
            $specific_table = isset($current['Table_name']) && $current['Table_name'] != '*' ? $current['Table_name'] : '';
            $html_output .= PMA_getUserLink('edit', $current_user, $current_host, $specific_db, $specific_table);
        }
        $html_output .= '</td>';
        $html_output .= '</tr>';
        if ($i + 1 < $nbPrivileges) {
            $html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
        }
    }
    return $html_output;
}
开发者ID:siddhantsomani,项目名称:phpmyadmin,代码行数:80,代码来源:server_privileges.lib.php

示例3: PMA_getHtmlTableBodyForSpecificDbOrTablePrivs

/**
 * Get HTML snippet for table body of specific database or table privileges
 *
 * @param array   $privMap priviledge map
 * @param boolean $db      database
 * @param boolean $table   table
 *
 * @return string $html_output
 */
function PMA_getHtmlTableBodyForSpecificDbOrTablePrivs($privMap, $db, $table = null)
{
    $html_output = '<tbody>';
    $odd_row = true;
    if (!empty($privMap)) {
        foreach ($privMap as $current_user => $val) {
            foreach ($val as $current_host => $current_privileges) {
                $html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
                // user
                $html_output .= '<td';
                if (count($current_privileges) > 1) {
                    $html_output .= ' rowspan="' . count($current_privileges) . '"';
                }
                $html_output .= '>';
                if (empty($current_user)) {
                    $html_output .= '<span style="color: #FF0000">' . __('Any') . '</span>';
                } else {
                    $html_output .= htmlspecialchars($current_user);
                }
                $html_output .= '</td>';
                // host
                $html_output .= '<td';
                if (count($current_privileges) > 1) {
                    $html_output .= ' rowspan="' . count($current_privileges) . '"';
                }
                $html_output .= '>';
                $html_output .= htmlspecialchars($current_host);
                $html_output .= '</td>';
                for ($i = 0; $i < count($current_privileges); $i++) {
                    $current = $current_privileges[$i];
                    // type
                    $html_output .= '<td>';
                    if ($current['Type'] == 'g') {
                        $html_output .= __('global');
                    } elseif ($current['Type'] == 'd') {
                        if ($current['Db'] == PMA_Util::escapeMysqlWildcards($db)) {
                            $html_output .= __('database-specific');
                        } else {
                            $html_output .= __('wildcard') . ': ' . '<code>' . htmlspecialchars($current['Db']) . '</code>';
                        }
                    } elseif ($current['Type'] == 't') {
                        $html_output .= __('table-specific');
                    }
                    $html_output .= '</td>';
                    // privileges
                    $html_output .= '<td>';
                    if (isset($current['Table_name'])) {
                        $privList = explode(',', $current['Table_priv']);
                        $privs = array();
                        $grantsArr = PMA_getTableGrantsArray();
                        foreach ($grantsArr as $grant) {
                            $privs[$grant[0]] = 'N';
                            foreach ($privList as $priv) {
                                if ($grant[0] == $priv) {
                                    $privs[$grant[0]] = 'Y';
                                }
                            }
                        }
                        $html_output .= '<code>' . join(',', PMA_extractPrivInfo($privs, true, true)) . '</code>';
                    } else {
                        $html_output .= '<code>' . join(',', PMA_extractPrivInfo($current, true, false)) . '</code>';
                    }
                    $html_output .= '</td>';
                    // grant
                    $html_output .= '<td>';
                    $containsGrant = false;
                    if (isset($current['Table_name'])) {
                        $privList = explode(',', $current['Table_priv']);
                        foreach ($privList as $priv) {
                            if ($priv == 'Grant') {
                                $containsGrant = true;
                            }
                        }
                    } else {
                        $containsGrant = $current['Grant_priv'] == 'Y';
                    }
                    $html_output .= $containsGrant ? __('Yes') : __('No');
                    $html_output .= '</td>';
                    // action
                    $html_output .= '<td>';
                    $specific_db = isset($current['Db']) && $current['Db'] != '*' ? $current['Db'] : '';
                    $specific_table = isset($current['Table_name']) && $current['Table_name'] != '*' ? $current['Table_name'] : '';
                    $html_output .= PMA_getUserEditLink($current_user, $current_host, $specific_db, $specific_table);
                    $html_output .= '</td>';
                    $html_output .= '</tr>';
                    if ($i + 1 < count($current_privileges)) {
                        $html_output .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
                    }
                }
                $odd_row = !$odd_row;
            }
//.........这里部分代码省略.........
开发者ID:lcylp,项目名称:wamp,代码行数:101,代码来源:server_privileges.lib.php


注:本文中的PMA_getTableGrantsArray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。