Example #1
0
/**
 * Returns the html for the sub-page heading
 *
 * @param string $type     Sub page type
 * @param string $link     Link to the official MySQL documentation
 * @param bool   $is_image Display image or icon, true: image, false: icon
 *
 * @return string
 */
function PMA_getHtmlForSubPageHeader($type, $link = '', $is_image = true)
{
    //array contains Sub page icon and text
    $header = array();
    $header['variables']['image'] = 's_vars.png';
    $header['variables']['text'] = __('Server variables and settings');
    $header['engines']['image'] = 'b_engine.png';
    $header['engines']['text'] = __('Storage Engines');
    $header['plugins']['image'] = 'b_engine.png';
    $header['plugins']['text'] = __('Plugins');
    $header['binlog']['image'] = 's_tbl.png';
    $header['binlog']['text'] = __('Binary log');
    $header['collations']['image'] = 's_asci.png';
    $header['collations']['text'] = __('Character Sets and Collations');
    $header['replication']['image'] = 's_replication.png';
    $header['replication']['text'] = __('Replication');
    $header['database_statistics']['image'] = 's_db.png';
    $header['database_statistics']['text'] = __('Databases statistics');
    $header['databases']['image'] = 's_db.png';
    $header['databases']['text'] = __('Databases');
    $header['privileges']['image'] = 'b_usrlist.png';
    $header['privileges']['text'] = __('Privileges');
    if ($is_image) {
        $html = '<h2>' . "\n" . PMA\libraries\Util::getImage($header[$type]['image']) . '    ' . $header[$type]['text'] . "\n" . $link . '</h2>' . "\n";
    } else {
        $html = '<h2>' . "\n" . PMA\libraries\Util::getIcon($header[$type]['image']) . '    ' . $header[$type]['text'] . "\n" . $link . '</h2>' . "\n";
    }
    return $html;
}
Example #2
0
/**
 * 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, $table, $url_query, $ajax_class;
    $icon = mb_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\libraries\Util::currentUserHasPrivilege($priv, $db, $table)) {
        $retval .= "            <a {$ajax_class['add']} ";
        $retval .= "href='db_" . mb_strtolower($name) . "s.php";
        $retval .= "{$url_query}&amp;add_item=1' ";
        $retval .= "onclick='\$.datepicker.initialized = false;'>";
        $icon = 'b_' . $icon;
        $retval .= PMA\libraries\Util::getIcon($icon);
        $retval .= PMA_RTE_getWord('add') . "</a>\n";
    } else {
        $icon = 'bd_' . $icon;
        $retval .= PMA\libraries\Util::getIcon($icon);
        $retval .= PMA_RTE_getWord('add') . "\n";
    }
    $retval .= "            " . PMA\libraries\Util::showMySQLDocu($docu) . "\n";
    $retval .= "        </div>\n";
    $retval .= "</fieldset>\n";
    $retval .= "<!-- ADD " . $name . " FORM END -->\n\n";
    return $retval;
}
/**
 * Returns html with PMA\libraries\Advisor
 *
 * @return string
 */
function PMA_getHtmlForAdvisor()
{
    $output = '<a href="#openAdvisorInstructions">';
    $output .= PMA\libraries\Util::getIcon('b_help.png', __('Instructions'));
    $output .= '</a>';
    $output .= '<div id="statustabs_advisor"></div>';
    $output .= '<div id="advisorInstructionsDialog" style="display:none;">';
    $output .= '<p>';
    $output .= __('The Advisor system can provide recommendations ' . 'on server variables by analyzing the server status variables.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('Do note however that this system provides recommendations ' . 'based on simple calculations and by rule of thumb which may ' . 'not necessarily apply to your system.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('Prior to changing any of the configuration, be sure to know ' . 'what you are changing (by reading the documentation) and how ' . 'to undo the change. Wrong tuning can have a very negative ' . 'effect on performance.');
    $output .= '</p>';
    $output .= '<p>';
    $output .= __('The best way to tune your system would be to change only one ' . 'setting at a time, observe or benchmark your database, and undo ' . 'the change if there was no clearly measurable improvement.');
    $output .= '</p>';
    $output .= '</div>';
    $output .= '<div id="advisorData" style="display:none;">';
    $advisor = new PMA\libraries\Advisor();
    $output .= htmlspecialchars(json_encode($advisor->run()));
    $output .= '</div>';
    return $output;
}
 /**
  * Test for getIcon
  *
  * @return void
  */
 function testGetIconWithForceText()
 {
     $GLOBALS['cfg']['ActionLinksMode'] = 'icons';
     $alternate_text = 'alt_str';
     // Here we are checking for an icon embedded inside a span (i.e not a menu
     // bar icon
     $this->assertEquals('<span class="nowrap"><img src="themes/dot.gif" title="' . $alternate_text . '" alt="' . $alternate_text . '" class="icon ic_b_comment" />&nbsp;' . $alternate_text . '</span>', PMA\libraries\Util::getIcon('b_comment.png', $alternate_text, true, false));
 }
 /**
  * Test for buildActionTitles
  *
  * @return void
  */
 function testBuildActionTitles()
 {
     $titles = array();
     $titles['Browse'] = PMA\libraries\Util::getIcon('b_browse.png', __('Browse'));
     $titles['NoBrowse'] = PMA\libraries\Util::getIcon('bd_browse.png', __('Browse'));
     $titles['Search'] = PMA\libraries\Util::getIcon('b_select.png', __('Search'));
     $titles['NoSearch'] = PMA\libraries\Util::getIcon('bd_select.png', __('Search'));
     $titles['Insert'] = PMA\libraries\Util::getIcon('b_insrow.png', __('Insert'));
     $titles['NoInsert'] = PMA\libraries\Util::getIcon('bd_insrow.png', __('Insert'));
     $titles['Structure'] = PMA\libraries\Util::getIcon('b_props.png', __('Structure'));
     $titles['Drop'] = PMA\libraries\Util::getIcon('b_drop.png', __('Drop'));
     $titles['NoDrop'] = PMA\libraries\Util::getIcon('bd_drop.png', __('Drop'));
     $titles['Empty'] = PMA\libraries\Util::getIcon('b_empty.png', __('Empty'));
     $titles['NoEmpty'] = PMA\libraries\Util::getIcon('bd_empty.png', __('Empty'));
     $titles['Edit'] = PMA\libraries\Util::getIcon('b_edit.png', __('Edit'));
     $titles['NoEdit'] = PMA\libraries\Util::getIcon('bd_edit.png', __('Edit'));
     $titles['Export'] = PMA\libraries\Util::getIcon('b_export.png', __('Export'));
     $titles['NoExport'] = PMA\libraries\Util::getIcon('bd_export.png', __('Export'));
     $titles['Execute'] = PMA\libraries\Util::getIcon('b_nextpage.png', __('Execute'));
     $titles['NoExecute'] = PMA\libraries\Util::getIcon('bd_nextpage.png', __('Execute'));
     $titles['Favorite'] = PMA\libraries\Util::getIcon('b_favorite.png', '');
     $titles['NoFavorite'] = PMA\libraries\Util::getIcon('b_no_favorite.png', '');
     $this->assertEquals($titles, PMA\libraries\Util::buildActionTitles());
 }
 /**
  * Test for PMA_getAddUserHtmlFieldset
  *
  * @return void
  */
 public function testPMAGetAddUserHtmlFieldset()
 {
     $html = PMA_getAddUserHtmlFieldset();
     $this->assertContains(PMA_URL_getCommon(array('adduser' => 1)), $html);
     $this->assertContains(PMA\libraries\Util::getIcon('b_usradd.png'), $html);
     $this->assertContains(__('Add user'), $html);
 }
 /**
  * Test for _getHtmlForLinkTemplates()
  *
  * @return void
  */
 public function testGetHtmlForLinkTemplates()
 {
     $class = new ReflectionClass('\\PMA\\libraries\\controllers\\server\\ServerVariablesController');
     $method = $class->getMethod('_getHtmlForLinkTemplates');
     $method->setAccessible(true);
     $container = Container::getDefaultContainer();
     $container->factory('PMA\\libraries\\controllers\\server\\ServerVariablesController');
     $container->alias('ServerVariablesController', 'PMA\\libraries\\controllers\\server\\ServerVariablesController');
     $ctrl = $container->get('ServerVariablesController');
     //Call the test function
     $html = $method->invoke($ctrl);
     $url = 'server_variables.php' . URL::getCommon(array());
     //validate 1: URL
     $this->assertContains($url, $html);
     //validate 2: images
     $this->assertContains(PMA\libraries\Util::getIcon('b_save.png', __('Save')), $html);
     $this->assertContains(PMA\libraries\Util::getIcon('b_close.png', __('Cancel')), $html);
 }
/**
 * Get HTML for gis data types
 *
 * @return string an html snippet
 */
function PMA_getHTMLforGisDataTypes()
{
    $edit_str = PMA\libraries\Util::getIcon('b_edit.png', __('Edit/Insert'));
    return '<span class="open_gis_editor">' . PMA\libraries\Util::linkOrButton('#', $edit_str, array(), false, false, '_blank') . '</span>';
}
Example #9
0
/**
 * Function to get html for bookmark support if bookmarks are enabled. Else will
 * return null
 *
 * @param array  $displayParts   the parts to display
 * @param array  $cfgBookmark    configuration setting for bookmarking
 * @param string $sql_query      sql query
 * @param string $db             current database
 * @param string $table          current table
 * @param string $complete_query complete query
 * @param string $bkm_user       bookmarking user
 *
 * @return string $html
 */
function PMA_getHtmlForBookmark($displayParts, $cfgBookmark, $sql_query, $db, $table, $complete_query, $bkm_user)
{
    if ($displayParts['bkm_form'] == '1' && (!empty($cfgBookmark) && empty($_GET['id_bookmark'])) && !empty($sql_query)) {
        $goto = 'sql.php' . PMA_URL_getCommon(array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'id_bookmark' => 1));
        $bkm_sql_query = urlencode(isset($complete_query) ? $complete_query : $sql_query);
        $html = '<form action="sql.php" method="post"' . ' onsubmit="return ! emptyCheckTheField(this,' . '\'bkm_fields[bkm_label]\');"' . ' class="bookmarkQueryForm print_ignore">';
        $html .= PMA_URL_getHiddenInputs();
        $html .= '<input type="hidden" name="db"' . ' value="' . htmlspecialchars($db) . '" />';
        $html .= '<input type="hidden" name="goto" value="' . $goto . '" />';
        $html .= '<input type="hidden" name="bkm_fields[bkm_database]"' . ' value="' . htmlspecialchars($db) . '" />';
        $html .= '<input type="hidden" name="bkm_fields[bkm_user]"' . ' value="' . $bkm_user . '" />';
        $html .= '<input type="hidden" name="bkm_fields[bkm_sql_query]"' . ' value="' . $bkm_sql_query . '" />';
        $html .= '<fieldset>';
        $html .= '<legend>';
        $html .= PMA\libraries\Util::getIcon('b_bookmark.png', __('Bookmark this SQL query'), true);
        $html .= '</legend>';
        $html .= '<div class="formelement">';
        $html .= '<label>' . __('Label:');
        $html .= '<input type="text" name="bkm_fields[bkm_label]" value="" />' . '</label>';
        $html .= '</div>';
        $html .= '<div class="formelement">';
        $html .= '<label>' . '<input type="checkbox" name="bkm_all_users" value="true" />';
        $html .= __('Let every user access this bookmark') . '</label>';
        $html .= '</div>';
        $html .= '<div class="clearfloat"></div>';
        $html .= '</fieldset>';
        $html .= '<fieldset class="tblFooters">';
        $html .= '<input type="hidden" name="store_bkm" value="1" />';
        $html .= '<input type="submit"' . ' value="' . __('Bookmark this SQL query') . '" />';
        $html .= '</fieldset>';
        $html .= '</form>';
    } else {
        $html = null;
    }
    return $html;
}
/**
 * Returns HTML for the 'user groups' table
 *
 * @return string HTML for the 'user groups' table
 */
function PMA_getHtmlForUserGroupsTable()
{
    $html_output = '<h2>' . __('User groups') . '</h2>';
    $cfgRelation = PMA_getRelationsParam();
    $groupTable = PMA\libraries\Util::backquote($cfgRelation['db']) . "." . PMA\libraries\Util::backquote($cfgRelation['usergroups']);
    $sql_query = "SELECT * FROM " . $groupTable . " ORDER BY `usergroup` ASC";
    $result = PMA_queryAsControlUser($sql_query, false);
    if ($result && $GLOBALS['dbi']->numRows($result)) {
        $html_output .= '<form name="userGroupsForm" id="userGroupsForm"' . ' action="server_privileges.php" method="post">';
        $html_output .= PMA_URL_getHiddenInputs();
        $html_output .= '<table id="userGroupsTable">';
        $html_output .= '<thead><tr>';
        $html_output .= '<th style="white-space: nowrap">' . __('User group') . '</th>';
        $html_output .= '<th>' . __('Server level tabs') . '</th>';
        $html_output .= '<th>' . __('Database level tabs') . '</th>';
        $html_output .= '<th>' . __('Table level tabs') . '</th>';
        $html_output .= '<th>' . __('Action') . '</th>';
        $html_output .= '</tr></thead>';
        $html_output .= '<tbody>';
        $odd = true;
        $userGroups = array();
        while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
            $groupName = $row['usergroup'];
            if (!isset($userGroups[$groupName])) {
                $userGroups[$groupName] = array();
            }
            $userGroups[$groupName][$row['tab']] = $row['allowed'];
        }
        foreach ($userGroups as $groupName => $tabs) {
            $html_output .= '<tr class="' . ($odd ? 'odd' : 'even') . '">';
            $html_output .= '<td>' . htmlspecialchars($groupName) . '</td>';
            $html_output .= '<td>' . _getAllowedTabNames($tabs, 'server') . '</td>';
            $html_output .= '<td>' . _getAllowedTabNames($tabs, 'db') . '</td>';
            $html_output .= '<td>' . _getAllowedTabNames($tabs, 'table') . '</td>';
            $html_output .= '<td>';
            $html_output .= '<a class="" href="server_user_groups.php' . PMA_URL_getCommon(array('viewUsers' => 1, 'userGroup' => $groupName)) . '">' . PMA\libraries\Util::getIcon('b_usrlist.png', __('View users')) . '</a>';
            $html_output .= '&nbsp;&nbsp;';
            $html_output .= '<a class="" href="server_user_groups.php' . PMA_URL_getCommon(array('editUserGroup' => 1, 'userGroup' => $groupName)) . '">' . PMA\libraries\Util::getIcon('b_edit.png', __('Edit')) . '</a>';
            $html_output .= '&nbsp;&nbsp;';
            $html_output .= '<a class="deleteUserGroup ajax"' . ' href="server_user_groups.php' . PMA_URL_getCommon(array('deleteUserGroup' => 1, 'userGroup' => $groupName)) . '">' . PMA\libraries\Util::getIcon('b_drop.png', __('Delete')) . '</a>';
            $html_output .= '</td>';
            $html_output .= '</tr>';
            $odd = !$odd;
        }
        $html_output .= '</tbody>';
        $html_output .= '</table>';
        $html_output .= '</form>';
    }
    $GLOBALS['dbi']->freeResult($result);
    $html_output .= '<fieldset id="fieldset_add_user_group">';
    $html_output .= '<a href="server_user_groups.php' . PMA_URL_getCommon(array('addUserGroup' => 1)) . '">' . PMA\libraries\Util::getIcon('b_usradd.png') . __('Add user group') . '</a>';
    $html_output .= '</fieldset>';
    return $html_output;
}
Example #11
0
/**
 * Display tracked tables
 *
 * @param string $db                current database
 * @param object $all_tables_result result set of tracked tables
 * @param string $url_query         url query string
 * @param string $pmaThemeImage     path to theme's image folder
 * @param string $text_dir          text direction
 * @param array  $cfgRelation       configuration storage info
 *
 * @return void
 */
function PMA_displayTrackedTables($db, $all_tables_result, $url_query, $pmaThemeImage, $text_dir, $cfgRelation)
{
    ?>
    <div id="tracked_tables">
    <h3><?php 
    echo __('Tracked tables');
    ?>
</h3>

    <form method="post" action="db_tracking.php" name="trackedForm"
        id="trackedForm" class="ajax">
    <?php 
    echo URL::getHiddenInputs($db);
    ?>
    <table id="versions" class="data">
    <thead>
    <tr>
        <th></th>
        <th><?php 
    echo __('Table');
    ?>
</th>
        <th><?php 
    echo __('Last version');
    ?>
</th>
        <th><?php 
    echo __('Created');
    ?>
</th>
        <th><?php 
    echo __('Updated');
    ?>
</th>
        <th><?php 
    echo __('Status');
    ?>
</th>
        <th><?php 
    echo __('Action');
    ?>
</th>
        <th><?php 
    echo __('Show');
    ?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    // Print out information about versions
    $delete = PMA\libraries\Util::getIcon('b_drop.png', __('Delete tracking'));
    $versions = PMA\libraries\Util::getIcon('b_versions.png', __('Versions'));
    $report = PMA\libraries\Util::getIcon('b_report.png', __('Tracking report'));
    $structure = PMA\libraries\Util::getIcon('b_props.png', __('Structure snapshot'));
    $style = 'odd';
    while ($one_result = $GLOBALS['dbi']->fetchArray($all_tables_result)) {
        list($table_name, $version_number) = $one_result;
        $table_query = ' SELECT * FROM ' . PMA\libraries\Util::backquote($cfgRelation['db']) . '.' . PMA\libraries\Util::backquote($cfgRelation['tracking']) . ' WHERE `db_name` = \'' . PMA\libraries\Util::sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name`  = \'' . PMA\libraries\Util::sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
        $table_result = PMA_queryAsControlUser($table_query);
        $version_data = $GLOBALS['dbi']->fetchArray($table_result);
        $tbl_link = 'tbl_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']);
        $delete_link = 'db_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']) . '&amp;delete_tracking=true&amp';
        $checkbox_id = "selected_tbl_" . htmlspecialchars($version_data['table_name']);
        ?>
        <tr class="<?php 
        echo $style;
        ?>
">
            <td class="center">
                <input type="checkbox" name="selected_tbl[]"
                class="checkall" id="<?php 
        echo $checkbox_id;
        ?>
"
                value="<?php 
        echo htmlspecialchars($version_data['table_name']);
        ?>
"/>
            </td>
            <th>
                <label for="<?php 
        echo $checkbox_id;
        ?>
">
                    <?php 
        echo htmlspecialchars($version_data['table_name']);
        ?>
                </label>
            </th>
            <td class="right"><?php 
        echo $version_data['version'];
        ?>
</td>
            <td><?php 
        echo $version_data['date_created'];
        ?>
</td>
            <td><?php 
        echo $version_data['date_updated'];
        ?>
</td>
            <td>
            <?php 
        PMA_displayStatusButton($version_data, $tbl_link);
        ?>
            </td>
            <td>
            <a class="delete_tracking_anchor ajax"
               href="<?php 
        echo $delete_link;
        ?>
" >
            <?php 
        echo $delete;
        ?>
</a>
        <?php 
        echo '</td>', '<td>', '<a href="', $tbl_link, '">', $versions, '</a>', '&nbsp;&nbsp;', '<a href="', $tbl_link, '&amp;report=true&amp;version=', $version_data['version'], '">', $report, '</a>', '&nbsp;&nbsp;', '<a href="' . $tbl_link, '&amp;snapshot=true&amp;version=', $version_data['version'], '">', $structure, '</a>', '</td>', '</tr>';
        if ($style == 'even') {
            $style = 'odd';
        } else {
            $style = 'even';
        }
    }
    ?>
    </tbody>
    </table>
    <?php 
    echo PMA\libraries\Template::get('select_all')->render(array('pmaThemeImage' => $pmaThemeImage, 'text_dir' => $text_dir, 'formName' => 'trackedForm'));
    echo PMA\libraries\Util::getButtonOrImage('submit_mult', 'mult_submit', __('Delete tracking'), 'b_drop.png', 'delete_tracking');
    ?>
    </form>
    </div>
    <?php 
}
/**
 * Builds the HTML td elements for one database to display in the list
 * of databases from server_databases.php (which can be modified by
 * db_create.php)
 *
 * @param array   $current           current database
 * @param boolean $is_superuser      user status
 * @param string  $url_query         url query
 * @param array   $column_order      column order
 * @param array   $replication_types replication types
 * @param array   $replication_info  replication info
 *
 * @return array $column_order, $out
 */
function PMA_buildHtmlForDb($current, $is_superuser, $url_query, $column_order, $replication_types, $replication_info)
{
    $out = '';
    if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
        $out .= '<td class="tool">';
        $out .= '<input type="checkbox" name="selected_dbs[]" class="checkall" ' . 'title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ' . 'value="' . htmlspecialchars($current['SCHEMA_NAME']) . '"';
        if ($GLOBALS['dbi']->isSystemSchema($current['SCHEMA_NAME'], true)) {
            $out .= ' disabled="disabled"';
        }
        $out .= ' /></td>';
    }
    $out .= '<td class="name">' . '<a href="' . PMA\libraries\Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
    foreach ($column_order as $stat_name => $stat) {
        if (array_key_exists($stat_name, $current)) {
            $unit = '';
            if (is_numeric($stat['footer'])) {
                $column_order[$stat_name]['footer'] += $current[$stat_name];
            }
            if ($stat['format'] === 'byte') {
                list($value, $unit) = PMA\libraries\Util::formatByteDown($current[$stat_name], 3, 1);
            } elseif ($stat['format'] === 'number') {
                $value = PMA\libraries\Util::formatNumber($current[$stat_name], 0);
            } else {
                $value = htmlentities($current[$stat_name], 0);
            }
            $out .= '<td class="value">';
            if (isset($stat['description_function'])) {
                $out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
            }
            $out .= $value;
            if (isset($stat['description_function'])) {
                $out .= '</dfn>';
            }
            $out .= '</td>';
            if ($stat['format'] === 'byte') {
                $out .= '<td class="unit">' . $unit . '</td>';
            }
        }
    }
    foreach ($replication_types as $type) {
        if ($replication_info[$type]['status']) {
            $out .= '<td class="tool" style="text-align: center;">';
            $key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB']);
            if (mb_strlen($key) > 0) {
                $out .= PMA\libraries\Util::getIcon('s_cancel.png', __('Not replicated'));
            } else {
                $key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
                if (mb_strlen($key) > 0 || isset($replication_info[$type]['Do_DB'][0]) && $replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1) {
                    // if ($key != null) did not work for index "0"
                    $out .= PMA\libraries\Util::getIcon('s_success.png', __('Replicated'));
                }
            }
            $out .= '</td>';
        }
    }
    if ($is_superuser) {
        $out .= '<td class="tool">' . '<a onclick="' . 'PMA_commonActions.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="server_privileges.php' . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']) . '&amp;checkprivsdb=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA\libraries\Util::getIcon('s_rights.png', __('Check privileges')) . '</a></td>';
    }
    return array($column_order, $out);
}
/**
 * Prints Html for Server Variables Items
 *
 * @param Array $variable_doc_links documentation links
 * @param Array $serverVars         global variables
 * @param Array $serverVarsSession  session variables
 *
 * @return string
 */
function PMA_getHtmlForServerVariablesItems($variable_doc_links, $serverVars, $serverVarsSession)
{
    // list of static system variables
    $static_variables = PMA_getStaticSystemVariables();
    $output = '<tbody>';
    $odd_row = true;
    foreach ($serverVars as $name => $value) {
        $has_session_value = isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value;
        $row_class = ($odd_row ? ' odd' : ' even') . ($has_session_value ? ' diffSession' : '');
        $output .= '<tr class="var-row' . $row_class . '">';
        $output .= '<td class="var-action">';
        // Edit Link active only for Dynamic System variables
        if (!in_array(strtolower($name), $static_variables)) {
            $output .= '<a href="#" class="editLink">' . PMA\libraries\Util::getIcon('b_edit.png', __('Edit')) . '</a>';
        } else {
            $output .= '<span title="' . __('This is a read-only variable and can not be edited') . '" class="read_only_var" >' . PMA\libraries\Util::getIcon('bd_edit.png', __('Edit')) . '</span>';
        }
        $output .= '</td>';
        $output .= '<td class="var-name">';
        // To display variable documentation link
        if (isset($variable_doc_links[$name])) {
            $output .= '<span title="' . htmlspecialchars(str_replace('_', ' ', $name)) . '">';
            $output .= PMA\libraries\Util::showMySQLDocu($variable_doc_links[$name][1], false, $variable_doc_links[$name][2] . '_' . $variable_doc_links[$name][0], true);
            $output .= htmlspecialchars(str_replace('_', ' ', $name));
            $output .= '</a>';
            $output .= '</span>';
        } else {
            $output .= htmlspecialchars(str_replace('_', ' ', $name));
        }
        $output .= '</td>';
        $output .= '<td class="var-value value' . ($GLOBALS['dbi']->isSuperuser() ? ' editable' : '') . '">&nbsp;' . PMA_formatVariable($name, $value, $variable_doc_links) . '</td>' . '</tr>';
        if ($has_session_value) {
            $output .= '<tr class="var-row' . ($odd_row ? ' odd' : ' even') . '">' . '<td class="var-action"></td>' . '<td class="var-name session">(' . __('Session value') . ')</td>' . '<td class="var-value value">&nbsp;' . PMA_formatVariable($name, $serverVarsSession[$name], $variable_doc_links) . '</td>' . '</tr>';
        }
        $odd_row = !$odd_row;
    }
    $output .= '</tbody>';
    return $output;
}
 /**
  * Test for PMA_getHtmlForLinkTemplates
  *
  * @return void
  */
 public function testPMAGetHtmlForLinkTemplates()
 {
     //Call the test function
     $html = PMA_getHtmlForLinkTemplates();
     $url = 'server_variables.php' . PMA_URL_getCommon(array());
     //validate 1: URL
     $this->assertContains($url, $html);
     //validate 2: images
     $this->assertContains(PMA\libraries\Util::getIcon('b_save.png', __('Save')), $html);
     $this->assertContains(PMA\libraries\Util::getIcon('b_close.png', __('Cancel')), $html);
 }