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


PHP PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn函数代码示例

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


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

示例1: PMA_getHtmlForTableSpecificPrivileges

/**
 * Get the HTML snippet for table specific privileges
 *
 * @param string $username username for database connection
 * @param string $hostname hostname for database connection
 * @param string $db       the database
 * @param string $table    the table
 * @param array  $columns  columns array
 * @param array  $row      current privileges row
 *
 * @return string $html_output
 */
function PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db, $table, $columns, $row)
{
    $res = $GLOBALS['dbi']->query('SELECT `Column_name`, `Column_priv`' . ' FROM `mysql`.`columns_priv`' . ' WHERE `User`' . ' = \'' . PMA_Util::sqlAddSlashes($username) . "'" . ' AND `Host`' . ' = \'' . PMA_Util::sqlAddSlashes($hostname) . "'" . ' AND `Db`' . ' = \'' . PMA_Util::sqlAddSlashes(PMA_Util::unescapeMysqlWildcards($db)) . "'" . ' AND `Table_name`' . ' = \'' . PMA_Util::sqlAddSlashes($table) . '\';');
    while ($row1 = $GLOBALS['dbi']->fetchRow($res)) {
        $row1[1] = explode(',', $row1[1]);
        foreach ($row1[1] as $current) {
            $columns[$row1[0]][$current] = true;
        }
    }
    $GLOBALS['dbi']->freeResult($res);
    unset($res, $row1, $current);
    $html_output = '<input type="hidden" name="grant_count" ' . 'value="' . count($row) . '" />' . "\n" . '<input type="hidden" name="column_count" ' . 'value="' . count($columns) . '" />' . "\n" . '<fieldset id="fieldset_user_priv">' . "\n" . '<legend data-submenu-label="Table">' . __('Table-specific privileges') . PMA_Util::showHint(__('Note: MySQL privilege names are expressed in English.')) . '</legend>' . "\n";
    // privs that are attached to a specific column
    $html_output .= PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn($columns, $row);
    // privs that are not attached to a specific column
    $html_output .= '<div class="item">' . "\n" . PMA_getHtmlForNotAttachedPrivilegesToTableSpecificColumn($row) . '</div>' . "\n";
    // for Safari 2.0.2
    $html_output .= '<div class="clearfloat"></div>' . "\n";
    return $html_output;
}
开发者ID:siddhantsomani,项目名称:phpmyadmin,代码行数:32,代码来源:server_privileges.lib.php

示例2: testPMAGetHtmlForTableSpecificPrivileges

 /**
  * Test for PMA_getHtmlForTableSpecificPrivileges
  *
  * @return void
  */
 public function testPMAGetHtmlForTableSpecificPrivileges()
 {
     $GLOBALS['strPrivDescCreate_viewTbl'] = "strPrivDescCreate_viewTbl";
     $GLOBALS['strPrivDescShowViewTbl'] = "strPrivDescShowViewTbl";
     $username = "PMA_username";
     $hostname = "PMA_hostname";
     $db = "PMA_db";
     $table = "PMA_table";
     $columns = array('row1' => 'name1');
     $row = array('Select_priv' => 'Y', 'Insert_priv' => 'Y', 'Update_priv' => 'Y', 'References_priv' => 'Y', 'Create_view_priv' => 'Y', 'ShowView_priv' => 'Y');
     $html = PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db, $table, $columns, $row);
     //validate 1: PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn
     $item = PMA_getHtmlForAttachedPrivilegesToTableSpecificColumn($columns, $row);
     $this->assertContains($item, $html);
     $this->assertContains(__('Allows reading data.'), $html);
     $this->assertContains(__('Allows inserting and replacing data'), $html);
     $this->assertContains(__('Allows changing data.'), $html);
     $this->assertContains(__('Has no effect in this MySQL version.'), $html);
     //validate 2: PMA_getHtmlForNotAttachedPrivilegesToTableSpecificColumn
     $item = PMA_getHtmlForNotAttachedPrivilegesToTableSpecificColumn($row);
     $this->assertContains($item, $html);
     $this->assertContains('Create_view_priv', $html);
     $this->assertContains('ShowView_priv', $html);
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:29,代码来源:PMA_server_privileges_test.php


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