Beispiel #1
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, $url_query, $ajax_class;
    $icon = 'b_' . strtolower($name) . '_add.png';
    $retval = "";
    $retval .= "<!-- ADD " . $name . " FORM START -->\n";
    $retval .= "<fieldset class='left'>\n";
    $retval .= "    <legend>" . __('New') . "</legend>\n";
    $retval .= "        <div class='wrap'>\n";
    if (PMA_currentUserHasPrivilege($priv, $db)) {
        $retval .= "            <a {$ajax_class['add']} ";
        $retval .= "href='db_" . strtolower($name) . "s.php";
        $retval .= "?{$url_query}&amp;add_item=1'>";
        $retval .= PMA_getIcon($icon);
        $retval .= PMA_RTE_getWord('add') . "</a>\n";
    } else {
        $retval .= "            " . PMA_getIcon($icon);
        $retval .= PMA_RTE_getWord('no_create') . "\n";
    }
    $retval .= "            " . PMA_showMySQLDocu('SQL-Syntax', $docu) . "\n";
    $retval .= "        </div>\n";
    $retval .= "</fieldset>\n";
    $retval .= "<!-- ADD " . $name . " FORM END -->\n\n";
    return $retval;
}
    function testBuildActionTitles()
    {
        $titles = array();

        $titles['Browse']     = PMA_getIcon('b_browse.png', __('Browse'));
        $titles['NoBrowse']   = PMA_getIcon('bd_browse.png', __('Browse'));
        $titles['Search']     = PMA_getIcon('b_select.png', __('Search'));
        $titles['NoSearch']   = PMA_getIcon('bd_select.png', __('Search'));
        $titles['Insert']     = PMA_getIcon('b_insrow.png', __('Insert'));
        $titles['NoInsert']   = PMA_getIcon('bd_insrow.png', __('Insert'));
        $titles['Structure']  = PMA_getIcon('b_props.png', __('Structure'));
        $titles['Drop']       = PMA_getIcon('b_drop.png', __('Drop'));
        $titles['NoDrop']     = PMA_getIcon('bd_drop.png', __('Drop'));
        $titles['Empty']      = PMA_getIcon('b_empty.png', __('Empty'));
        $titles['NoEmpty']    = PMA_getIcon('bd_empty.png', __('Empty'));
        $titles['Edit']       = PMA_getIcon('b_edit.png', __('Edit'));
        $titles['NoEdit']     = PMA_getIcon('bd_edit.png', __('Edit'));
        $titles['Export']     = PMA_getIcon('b_export.png', __('Export'));
        $titles['NoExport']   = PMA_getIcon('bd_export.png', __('Export'));
        $titles['Execute']    = PMA_getIcon('b_nextpage.png', __('Execute'));
        $titles['NoExecute']  = PMA_getIcon('bd_nextpage.png', __('Execute'));

        $this->assertEquals($titles, PMA_buildActionTitles());

    }
    function testGetIconWithForceText()
    {
        $GLOBALS['cfg']['PropertiesIconic'] = true;
        $alternate_text = 'alt_str';

        $this->assertEquals(
            '<span class="nowrap"><img src="themes/dot.gif" title="' . $alternate_text . '" alt="' . $alternate_text
            . '" class="icon ic_b_comment" /> ' . $alternate_text . '</span>',
            PMA_getIcon('b_comment.png', $alternate_text, true)
        );

    }
Beispiel #4
0
/**
 * Generate a button or image tag
 *
 * @uses    PMA_USR_BROWSER_AGENT
 * @uses    $GLOBALS['pmaThemeImage']
 * @uses    $GLOBALS['cfg']['PropertiesIconic']
 * @param   string      name of button element
 * @param   string      class of button element
 * @param   string      name of image element
 * @param   string      text to display
 * @param   string      image to display
 *
 * @access  public
 * @author  Michal Cihar (michal@cihar.com)
 */
function PMA_buttonOrImage($button_name, $button_class, $image_name, $text, $image)
{
    if (false === $GLOBALS['cfg']['PropertiesIconic']) {
        echo ' <input type="submit" name="' . $button_name . '"' . ' value="' . htmlspecialchars($text) . '"' . ' title="' . htmlspecialchars($text) . '" />' . "\n";
        return;
    }
    /* Opera has trouble with <input type="image"> */
    /* IE has trouble with <button> */
    if (PMA_USR_BROWSER_AGENT != 'IE') {
        echo '<button class="' . $button_class . '" type="submit"' . ' name="' . $button_name . '" value="' . htmlspecialchars($text) . '"' . ' title="' . htmlspecialchars($text) . '">' . "\n" . PMA_getIcon($image, $text) . '</button>' . "\n";
    } else {
        echo '<input type="image" name="' . $image_name . '" value="' . htmlspecialchars($text) . '" title="' . htmlspecialchars($text) . '" src="' . $GLOBALS['pmaThemeImage'] . $image . '" />' . ($GLOBALS['cfg']['PropertiesIconic'] === 'both' ? '&nbsp;' . htmlspecialchars($text) : '') . "\n";
    }
}
Beispiel #5
0
/**
 * Creates the HTML content for:
 * 1) Browsing foreign data for a field.
 * 2) Creating elements for search criteria input on fields.
 *
 * @param array  $foreigners      Array of foreign keys
 * @param array  $foreignData     Foreign keys data
 * @param string $field           Column name
 * @param string $tbl_fields_type Column type
 * @param int    $i               Column index
 * @param string $db              Selected database
 * @param string $table           Selected table
 * @param array  $titles          Selected title
 * @param int    $foreignMaxLimit Max limit of displaying foreign elements
 * @param array  $fields          Array of search criteria inputs
 * @param bool   $in_fbs          Whether we are in 'function based search'
 * @param bool   $in_zoom_search_edit  Whether we are in zoom search edit 
 *
 * @return string HTML content for viewing foreing data and elements
 * for search criteria input.
 */
function PMA_getForeignFields_Values($foreigners, $foreignData, $field, $tbl_fields_type, $i, $db, $table, $titles, $foreignMaxLimit, $fields, $in_fbs = false, $in_zoom_search_edit = false)
{
    $str = '';
    if ($foreigners && isset($foreigners[$field]) && is_array($foreignData['disp_row'])) {
        // f o r e i g n    k e y s
        $str .= '<select name="fields[' . $i . ']" id="fieldID_' . $i . '">' . "\n";
        // go back to first row
        // here, the 4th parameter is empty because there is no current
        // value of data for the dropdown (the search page initial values
        // are displayed empty)
        $str .= PMA_foreignDropdown($foreignData['disp_row'], $foreignData['foreign_field'], $foreignData['foreign_display'], '', $foreignMaxLimit);
        $str .= '</select>' . "\n";
    } elseif ($foreignData['foreign_link'] == true) {
        if (isset($fields[$i]) && is_string($fields[$i])) {
            $str .= '<input type="text" id="fieldID_' . $i . '" name="fields[' . $i . ']" value="' . $fields[$i] . '" id="field_' . md5($field) . '[' . $i . ']" class="textfield" />';
        } else {
            $str .= '<input type="text" id="fieldID_' . $i . '" name="fields[' . $i . ']" id="field_' . md5($field) . '[' . $i . ']" class="textfield" />';
        }
        $str .= <<<EOT
<a target="_blank" onclick="window.open(this.href, 'foreigners', 'width=640,height=240,scrollbars=yes'); return false" href="browse_foreigners.php?
EOT;
        $str .= '' . PMA_generate_common_url($db, $table) . '&amp;field=' . urlencode($field) . '&amp;fieldkey=' . $i . '"';
        if ($in_zoom_search_edit) {
            $str .= ' class="browse_foreign"';
        }
        $str .= '>' . str_replace("'", "\\'", $titles['Browse']) . '</a>';
    } elseif (in_array($tbl_fields_type[$i], PMA_getGISDatatypes())) {
        // g e o m e t r y
        $str .= '<input type="text" name="fields[' . $i . ']"' . ' size="40" class="textfield" id="field_' . $i . '" />' . "\n";
        if ($in_fbs) {
            $edit_url = 'gis_data_editor.php?' . PMA_generate_common_url();
            $edit_str = PMA_getIcon('b_edit.png', __('Edit/Insert'));
            $str .= '<span class="open_search_gis_editor">';
            $str .= PMA_linkOrButton($edit_url, $edit_str, array(), false, false, '_blank');
            $str .= '</span>';
        }
    } elseif (strncasecmp($tbl_fields_type[$i], 'enum', 4) == 0 || strncasecmp($tbl_fields_type[$i], 'set', 3) == 0 && $in_zoom_search_edit) {
        // e n u m s   a n d   s e t s
        // Enum in edit mode   --> dropdown
        // Enum in search mode --> multiselect
        // Set in edit mode    --> multiselect
        // Set in search mode  --> input (skipped here, so the 'else'
        //                                 section would handle it)
        $value = explode(', ', str_replace("'", '', substr($tbl_fields_type[$i], 5, -1)));
        $cnt_value = count($value);
        if (strncasecmp($tbl_fields_type[$i], 'enum', 4) && !$in_zoom_search_edit || strncasecmp($tbl_fields_type[$i], 'set', 3) && $in_zoom_search_edit) {
            $str .= '<select name="fields[' . $i . '][]" id="fieldID_' . $i . '">' . "\n";
        } else {
            $str .= '<select name="fields[' . $i . '][]" id="fieldID_' . $i . '"' . ' multiple="multiple" size="' . min(3, $cnt_value) . '">' . "\n";
        }
        for ($j = 0; $j < $cnt_value; $j++) {
            if (isset($fields[$i]) && is_array($fields[$i]) && in_array($value[$j], $fields[$i])) {
                $str .= '<option value="' . $value[$j] . '" Selected>' . $value[$j] . '</option>';
            } else {
                $str .= '<option value="' . $value[$j] . '">' . $value[$j] . '</option>';
            }
        }
        // end for
        $str .= '</select>' . "\n";
    } else {
        // o t h e r   c a s e s
        $the_class = 'textfield';
        $type = $tbl_fields_type[$i];
        if ($type == 'date') {
            $the_class .= ' datefield';
        } elseif ($type == 'datetime' || substr($type, 0, 9) == 'timestamp') {
            $the_class .= ' datetimefield';
        } elseif (substr($type, 0, 3) == 'bit') {
            $the_class .= ' bit';
        }
        if (isset($fields[$i]) && is_string($fields[$i])) {
            $str .= '<input type="text" name="fields[' . $i . ']"' . ' size="40" class="' . $the_class . '" id="fieldID_' . $i . '" value = "' . $fields[$i] . '"/>' . "\n";
        } else {
            $str .= '<input type="text" name="fields[' . $i . ']"' . ' size="40" class="' . $the_class . '" id="fieldID_' . $i . '" />' . "\n";
        }
    }
    return $str;
}
Beispiel #6
0
 */
$GLOBALS['js_include'][] = 'server_privileges.js';
$GLOBALS['js_include'][] = 'replication.js';

require 'libraries/server_common.inc.php';
require 'libraries/replication.inc.php';
require 'libraries/replication_gui.lib.php';
require_once 'libraries/server_synchronize.lib.php';

/**
 * Checks if the user is allowed to do what he tries to...
 */
if (! $is_superuser) {
    include 'libraries/server_links.inc.php';
    echo '<h2>' . "\n"
        . PMA_getIcon('s_replication.png')
        . __('Replication') . "\n"
        . '</h2>' . "\n";
    PMA_Message::error(__('No Privileges'))->display();
    include 'libraries/footer.inc.php';
}

/**
 * Sets globals from $_REQUEST
 */
$request_params = array(
    'hostname',
    'mr_adduser',
    'mr_configure',
    'pma_pw',
    'port',
    }
}
if (isset($clause_is_unique)) {
    $_form_params['clause_is_unique'] = $clause_is_unique;
}
?>
<!-- Insert/Edit form -->
<form method="post" action="tbl_replace.php" name="insertForm" <?php 
if ($is_upload) {
    echo ' enctype="multipart/form-data"';
}
?>
>
<?php 
echo PMA_generate_common_hidden_inputs($_form_params);
$titles['Browse'] = PMA_getIcon('b_browse.png', $strBrowseForeignValues);
// Set if we passed the first timestamp field
$timestamp_seen = 0;
$fields_cnt = count($table_fields);
$tabindex = 0;
$tabindex_for_function = +3000;
$tabindex_for_null = +6000;
$tabindex_for_value = 0;
$o_rows = 0;
$biggest_max_file_size = 0;
// user can toggle the display of Function column
// (currently does not work for multi-edits)
$url_params['db'] = $db;
$url_params['table'] = $table;
if (isset($where_clause)) {
    $url_params['where_clause'] = trim($where_clause);
Beispiel #8
0
                    if ($bs_tables[$table_key]['Exists']) {
                        $oneBSTableExists = TRUE;
                    } else {
                        $allBSTablesExist = FALSE;
                    }
                }
                ?>

                    <form method="post" action="./db_operations.php">
                    <?php 
                echo PMA_generate_common_hidden_inputs($db);
                ?>
                    <fieldset>
                    <legend>
                    <?php 
                echo PMA_getIcon('b_edit.png', $strBLOBRepository, false, true);
                ?>
                    </legend>

                    <?php 
                echo $strBLOBRepositoryStatus;
                ?>
:

                    <?php 
                // if the blobstreaming tables exist, provide option to disable the BLOB repository
                if ($allBSTablesExist) {
                    ?>
                            <?php 
                    echo $strBLOBRepositoryEnabled;
                    ?>
Beispiel #9
0
        $goto = 'sql.php?'
              . PMA_generate_common_url($db, $table)
              . '&amp;sql_query=' . urlencode($sql_query)
              . '&amp;id_bookmark=1';

        ?>
<form action="sql.php" method="post" onsubmit="return emptyFormElements(this, 'fields[label]');">
<?php echo PMA_generate_common_hidden_inputs(); ?>
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="fields[dbase]" value="<?php echo htmlspecialchars($db); ?>" />
<input type="hidden" name="fields[user]" value="<?php echo $cfg['Bookmark']['user']; ?>" />
<input type="hidden" name="fields[query]" value="<?php echo urlencode(isset($complete_query) ? $complete_query : $sql_query); ?>" />
<fieldset>
    <legend><?php
    echo PMA_getIcon('b_bookmark.png', __('Bookmark this SQL query'), true);
?>
    </legend>

    <div class="formelement">
        <label for="fields_label_"><?php echo __('Label'); ?>:</label>
        <input type="text" id="fields_label_" name="fields[label]" value="" />
    </div>

    <div class="formelement">
        <input type="checkbox" name="bkm_all_users" id="bkm_all_users" value="true" />
        <label for="bkm_all_users"><?php echo __('Let every user access this bookmark'); ?></label>
    </div>

    <div class="clearfloat"></div>
</fieldset>
Beispiel #10
0
/**
 * Build titles and icons for action links
 *
 * @return   array   the action titles
 * @uses     PMA_getIcon()
 */
function PMA_buildActionTitles()
{
    $titles = array();
    $titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse'), true);
    $titles['NoBrowse'] = PMA_getIcon('bd_browse.png', __('Browse'), true);
    $titles['Search'] = PMA_getIcon('b_select.png', __('Search'), true);
    $titles['NoSearch'] = PMA_getIcon('bd_select.png', __('Search'), true);
    $titles['Insert'] = PMA_getIcon('b_insrow.png', __('Insert'), true);
    $titles['NoInsert'] = PMA_getIcon('bd_insrow.png', __('Insert'), true);
    $titles['Structure'] = PMA_getIcon('b_props.png', __('Structure'), true);
    $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
    $titles['NoDrop'] = PMA_getIcon('bd_drop.png', __('Drop'), true);
    $titles['Empty'] = PMA_getIcon('b_empty.png', __('Empty'), true);
    $titles['NoEmpty'] = PMA_getIcon('bd_empty.png', __('Empty'), true);
    $titles['Edit'] = PMA_getIcon('b_edit.png', __('Edit'), true);
    return $titles;
}
function PMA_buildHtmlForDb($current, $is_superuser, $checkall, $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[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
        if ($current['SCHEMA_NAME'] != 'mysql' && $current['SCHEMA_NAME'] != 'information_schema') {
            $out .= (empty($checkall) ? '' : 'checked="checked" ') . '/>';
        } else {
            $out .= ' disabled="disabled" />';
        }
        $out .= '</td>';
    }
    $out .= '<td class="name">' . '        <a onclick="' . 'if (window.parent.openDb &amp;&amp; window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;' . '" href="index.php?' . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
    foreach ($column_order as $stat_name => $stat) {
        if (array_key_exists($stat_name, $current)) {
            if (is_numeric($stat['footer'])) {
                $column_order[$stat_name]['footer'] += $current[$stat_name];
            }
            if ($stat['format'] === 'byte') {
                list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1);
            } elseif ($stat['format'] === 'number') {
                $value = PMA_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;">';
            if (strlen(array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB'])) > 0) {
                $out .= PMA_getIcon('s_cancel.png', __('Not replicated'));
            } else {
                $key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
                if (strlen($key) > 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_getIcon('s_success.png', __('Replicated'));
                }
            }
            $out .= '</td>';
        }
    }
    if ($is_superuser) {
        $out .= '<td class="tool">' . '<a onclick="' . 'if (window.parent.setDb) window.parent.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="./server_privileges.php?' . $url_query . '&amp;checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database &quot;%s&quot;.'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA_getIcon('s_rights.png', __('Check Privileges')) . '</a></td>';
    }
    return array($column_order, $out);
}
 /**
  * Show index data
  *
  * @param   string      $table          The tablename
  * @param   array       $indexes_info   Referenced info array
  * @param   array       $indexes_data   Referenced data array
  * @param   boolean     $print_mode
  * @access  public
  * @return  array       Index collection array
  */
 public static function getView($table, $schema, $print_mode = false)
 {
     $indexes = PMA_Index::getFromTable($table, $schema);
     if (count($indexes) < 1) {
         return PMA_Message::error(__('No index defined!'))->getDisplay();
     }
     $r = '';
     $r .= '<h2>' . __('Indexes') . ': ';
     $r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure');
     $r .= '</h2>';
     $r .= '<table>';
     $r .= '<thead>';
     $r .= '<tr>';
     if (!$print_mode) {
         $r .= '<th colspan="2">' . __('Action') . '</th>';
     }
     $r .= '<th>' . __('Keyname') . '</th>';
     $r .= '<th>' . __('Type') . '</th>';
     $r .= '<th>' . __('Unique') . '</th>';
     $r .= '<th>' . __('Packed') . '</th>';
     $r .= '<th>' . __('Column') . '</th>';
     $r .= '<th>' . __('Cardinality') . '</th>';
     $r .= '<th>' . __('Collation') . '</th>';
     $r .= '<th>' . __('Null') . '</th>';
     $r .= '<th>' . __('Comment') . '</th>';
     $r .= '</tr>';
     $r .= '</thead>';
     $r .= '<tbody>';
     $odd_row = true;
     foreach ($indexes as $index) {
         $row_span = ' rowspan="' . $index->getColumnCount() . '" ';
         $r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
         if (!$print_mode) {
             $this_params = $GLOBALS['url_params'];
             $this_params['index'] = $index->getName();
             $r .= '<td ' . $row_span . '>' . '    <a href="tbl_indexes.php' . PMA_generate_common_url($this_params) . '">' . PMA_getIcon('b_edit.png', __('Edit')) . '</a>' . '</td>' . "\n";
             $this_params = $GLOBALS['url_params'];
             if ($index->getName() == 'PRIMARY') {
                 $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
                 $this_params['message_to_show'] = __('The primary key has been dropped');
                 $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
             } else {
                 $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
                 $this_params['message_to_show'] = sprintf(__('Index %s has been dropped'), $index->getName());
                 $js_msg = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
             }
             $r .= '<td ' . $row_span . '>';
             $r .= '<input type="hidden" class="drop_primary_key_index_msg" value="' . $js_msg . '" />';
             $r .= '    <a ';
             if ($GLOBALS['cfg']['AjaxEnable']) {
                 $r .= 'class="drop_primary_key_index_anchor" ';
             }
             $r .= ' href="sql.php' . PMA_generate_common_url($this_params) . '" >' . PMA_getIcon('b_drop.png', __('Drop')) . '</a>' . '</td>' . "\n";
         }
         $r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
         $r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getType()) . '</td>';
         $r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
         $r .= '<td ' . $row_span . '>' . $index->isPacked(true) . '</td>';
         foreach ($index->getColumns() as $column) {
             if ($column->getSeqInIndex() > 1) {
                 $r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
             }
             $r .= '<td>' . htmlspecialchars($column->getName());
             if ($column->getSubPart()) {
                 $r .= ' (' . $column->getSubPart() . ')';
             }
             $r .= '</td>';
             $r .= '<td>' . htmlspecialchars($column->getCardinality()) . '</td>';
             $r .= '<td>' . htmlspecialchars($column->getCollation()) . '</td>';
             $r .= '<td>' . htmlspecialchars($column->getNull()) . '</td>';
             if ($column->getSeqInIndex() == 1) {
                 $r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getComments()) . '</td>';
             }
             $r .= '</tr>';
         }
         // end foreach $index['Sequences']
         $odd_row = !$odd_row;
     }
     // end while
     $r .= '</tbody>';
     $r .= '</table>';
     if (!$print_mode) {
         $r .= PMA_Index::findDuplicates($table, $schema);
     }
     return $r;
 }
Beispiel #13
0
echo implode("\n", $hidden_fields) . "\n";
?>
</div>
</form>
<?php 
// display again the table list navigator
PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
?>
</div>
<hr />

<?php 
/**
 * Work on the database
 */
/* DATABASE WORK */
/* Printable view of a table */
echo '<p>';
echo '<a href="db_printview.php?' . $url_query . '">';
echo PMA_getIcon('b_print.png', __('Print view'), true) . '</a>';
echo '<a href="./db_datadict.php?' . $url_query . '">';
echo PMA_getIcon('b_tblanalyse.png', __('Data Dictionary'), true) . '</a>';
echo '</p>';
if (empty($db_is_information_schema)) {
    include './libraries/display_create_table.lib.php';
}
// end if (Create Table dialog)
/**
 * Displays the footer
 */
require './libraries/footer.inc.php';
Beispiel #14
0
/**
 * Displays operations that are available on results.
 *
 * @param array $the_disp_mode the display mode
 * @param array $analyzed_sql  the analyzed query
 *
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  string   $sql_query         the current SQL query
 * @global  integer  $unlim_num_rows    the total number of rows returned by the
 *                                      SQL query without any programmatically
 *                                      appended "LIMIT" clause
 *
 * @access  private
 *
 * @see     PMA_showMessage(), PMA_setDisplayMode(),
 *          PMA_displayTableNavigation(), PMA_displayTableHeaders(),
 *          PMA_displayTableBody(), PMA_displayResultsOperations()
 *
 * @return nothing
 */
function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
{
    global $db, $table, $sql_query, $unlim_num_rows, $fields_meta;
    $header_shown = false;
    $header = '<fieldset><legend>' . __('Query results operations') . '</legend>';
    if ($the_disp_mode[6] == '1' || $the_disp_mode[9] == '1') {
        // Displays "printable view" link if required
        if ($the_disp_mode[9] == '1') {
            if (!$header_shown) {
                echo $header;
                $header_shown = true;
            }
            $_url_params = array('db' => $db, 'table' => $table, 'printview' => '1', 'sql_query' => $sql_query);
            $url_query = PMA_generate_common_url($_url_params);
            echo PMA_linkOrButton('sql.php' . $url_query, PMA_getIcon('b_print.png', __('Print view'), true), '', true, true, 'print_view') . "\n";
            if ($_SESSION['tmp_user_values']['display_text']) {
                $_url_params['display_text'] = 'F';
                echo PMA_linkOrButton('sql.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_print.png', __('Print view (with full texts)'), true), '', true, true, 'print_view') . "\n";
                unset($_url_params['display_text']);
            }
        }
        // end displays "printable view"
    }
    // Export link
    // (the url_query has extra parameters that won't be used to export)
    // (the single_table parameter is used in display_export.lib.php
    //  to hide the SQL and the structure export dialogs)
    // If the parser found a PROCEDURE clause
    // (most probably PROCEDURE ANALYSE()) it makes no sense to
    // display the Export link).
    if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && !isset($printview) && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
        if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && !isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) {
            $_url_params['single_table'] = 'true';
        }
        if (!$header_shown) {
            echo $header;
            $header_shown = true;
        }
        $_url_params['unlim_num_rows'] = $unlim_num_rows;
        /**
         * At this point we don't know the table name; this can happen
         * for example with a query like
         * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp
         * As a workaround we set in the table parameter the name of the
         * first table of this database, so that tbl_export.php and
         * the script it calls do not fail
         */
        if (empty($_url_params['table']) && !empty($_url_params['db'])) {
            $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES");
            /* No result (probably no database selected) */
            if ($_url_params['table'] === false) {
                unset($_url_params['table']);
            }
        }
        echo PMA_linkOrButton('tbl_export.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_tblexport.png', __('Export'), true), '', true, true, '') . "\n";
        // show chart
        echo PMA_linkOrButton('tbl_chart.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_chart.png', __('Display chart'), true), '', true, true, '') . "\n";
        // show GIS chart
        $geometry_found = false;
        // If atleast one geometry field is found
        foreach ($fields_meta as $meta) {
            if ($meta->type == 'geometry') {
                $geometry_found = true;
                break;
            }
        }
        if ($geometry_found) {
            echo PMA_linkOrButton('tbl_gis_visualization.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_globe.gif', __('Visualize GIS data'), true), '', true, true, '') . "\n";
        }
    }
    // CREATE VIEW
    /**
     *
     * @todo detect privileges to create a view
     *       (but see 2006-01-19 note in display_create_table.lib.php,
     *        I think we cannot detect db-specific privileges reliably)
     * Note: we don't display a Create view link if we found a PROCEDURE clause
     */
    if (!$header_shown) {
        echo $header;
        $header_shown = true;
    }
    if (!PMA_DRIZZLE && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
        echo PMA_linkOrButton('view_create.php' . $url_query, PMA_getIcon('b_views.png', __('Create view'), true), '', true, true, '') . "\n";
    }
    if ($header_shown) {
        echo '</fieldset><br />';
    }
}
    /**
     * Show index data
     *
     * @param   string      $table          The tablename
     * @param   array       $indexes_info   Referenced info array
     * @param   array       $indexes_data   Referenced data array
     * @param   boolean     $print_mode
     * @access  public
     * @return  array       Index collection array
     * @author  Garvin Hicking (pma@supergarv.de)
     */
    static public function getView($table, $schema, $print_mode = false)
    {
        $indexes = PMA_Index::getFromTable($table, $schema);

        if (count($indexes) < 1) {
            return PMA_Message::warning('strNoIndex')->getDisplay();
        }

        $r = '';

        $r .= '<h2>' . $GLOBALS['strIndexes'] . ': ';
        $r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure');
        $r .= '</h2>';
        $r .= '<table>';
        $r .= '<thead>';
        $r .= '<tr>';
        if (! $print_mode) {
            $r .= '<th colspan="2">' . $GLOBALS['strAction'] . '</th>';
        }
        $r .= '<th>' . $GLOBALS['strKeyname'] . '</th>';
        $r .= '<th>' . $GLOBALS['strType'] . '</th>';
        $r .= '<th>' . $GLOBALS['strUnique'] . '</th>';
        $r .= '<th>' . $GLOBALS['strPacked'] . '</th>';
        $r .= '<th>' . $GLOBALS['strField'] . '</th>';
        $r .= '<th>' . $GLOBALS['strCardinality'] . '</th>';
        $r .= '<th>' . $GLOBALS['strCollation'] . '</th>';
        $r .= '<th>' . $GLOBALS['strNull'] . '</th>';
        $r .= '<th>' . $GLOBALS['strComment'] . '</th>';
        $r .= '</tr>';
        $r .= '</thead>';
        $r .= '<tbody>';

        $odd_row = true;
        foreach ($indexes as $index) {
            $row_span = ' rowspan="' . $index->getColumnCount() . '" ';

            $r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';

            if (! $print_mode) {
                $this_params = $GLOBALS['url_params'];
                $this_params['index'] = $index->getName();
                $r .= '<td ' . $row_span . '>'
                   . '    <a href="tbl_indexes.php' . PMA_generate_common_url($this_params)
                   . '">' . PMA_getIcon('b_edit.png', $GLOBALS['strEdit']) . '</a>'
                   . '</td>' . "\n";

                $this_params = $GLOBALS['url_params'];
                if ($index->getName() == 'PRIMARY') {
                    $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY';
                    $this_params['zero_rows'] = $GLOBALS['strPrimaryKeyHasBeenDropped'];
                    $js_msg      = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP PRIMARY KEY');
                } else {
                    $this_params['sql_query'] = 'ALTER TABLE ' . PMA_backquote($table) . ' DROP INDEX ' . PMA_backquote($index->getName());
                    $this_params['zero_rows'] = sprintf($GLOBALS['strIndexHasBeenDropped'], $index->getName());
                    $js_msg      = PMA_jsFormat('ALTER TABLE ' . $table . ' DROP INDEX ' . $index->getName());
                }

                $r .= '<td ' . $row_span . '>'
                   . '    <a href="sql.php' . PMA_generate_common_url($this_params)
                   . '" onclick="return confirmLink(this, \'' . $js_msg . '\')">'
                   . PMA_getIcon('b_drop.png', $GLOBALS['strDrop'])  . '</a>'
                   . '</td>' . "\n";
            }

            $r .= '<th ' . $row_span . '>' . htmlspecialchars($index->getName()) . '</th>';
            $r .= '<td ' . $row_span . '>' . htmlspecialchars($index->getType()) . '</td>';
            $r .= '<td ' . $row_span . '>' . $index->isUnique(true) . '</td>';
            $r .= '<td ' . $row_span . '>' . $index->isPacked(true) . '</td>';

            foreach ($index->getColumns() as $column) {
                if ($column->getSeqInIndex() > 1) {
                    $r .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
                }
                $r .= '<td>' . htmlspecialchars($column->getName());
                if ($column->getSubPart()) {
                    $r .= ' (' . $column->getSubPart() . ')';
                }
                $r .= '</td>';
                $r .= '<td>' . htmlspecialchars($column->getCardinality()) . '</td>';
                $r .= '<td>' . htmlspecialchars($column->getCollation()) . '</td>';
                $r .= '<td>' . htmlspecialchars($column->getNull()) . '</td>';

                if ($column->getSeqInIndex() == 1) {
                    $r .= '<td ' . $row_span . '>'
                        . htmlspecialchars($index->getComments()) . '</td>';
                }
                $r .= '</tr>';
            } // end foreach $index['Sequences']

            $odd_row = ! $odd_row;
        } // end while
        $r .= '</tbody>';
        $r .= '</table>';

        if (! $print_mode) {
            $r .= PMA_Index::findDuplicates($table, $schema);
        }

        return $r;
    }
Beispiel #16
0
    <tr>
        <th width="300"><?php 
    echo __('Table');
    ?>
</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
<?php 
    // Print out list of untracked tables
    $style = 'odd';
    foreach ($my_tables as $key => $tablename) {
        if (PMA_Tracker::getVersion($GLOBALS['db'], $tablename) == -1) {
            $my_link = '<a href="tbl_tracking.php?' . $url_query . '&amp;table=' . htmlspecialchars($tablename) . '">';
            $my_link .= PMA_getIcon('eye.png', __('Track table')) . '</a>';
            ?>
            <tr class="noclick <?php 
            echo $style;
            ?>
">
            <td><?php 
            echo htmlspecialchars($tablename);
            ?>
</td>
            <td><?php 
            echo $my_link;
            ?>
</td>
            </tr>
        <?php 
 * Does the common work
 */
$GLOBALS['js_include'][] = 'server_privileges.js';
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools_common.js';
require './libraries/server_common.inc.php';
require './libraries/replication.inc.php';
require './libraries/replication_gui.lib.php';
require_once './libraries/server_synchronize.lib.php';
/**
 * Checks if the user is allowed to do what he tries to...
 */
if (!$is_superuser) {
    require './libraries/server_links.inc.php';
    echo '<h2>' . "\n" . PMA_getIcon('s_replication.png') . $GLOBALS['strReplication'] . "\n" . '</h2>' . "\n";
    PMA_Message::error('strNoPrivileges')->display();
    require_once './libraries/footer.inc.php';
}
/**
 * Handling control requests
 */
if (isset($GLOBALS['sr_take_action'])) {
    $refresh = false;
    if (isset($GLOBALS['slave_changemaster'])) {
        $_SESSION['replication']['m_username'] = $sr['username'] = PMA_sqlAddslashes($GLOBALS['username']);
        $_SESSION['replication']['m_password'] = $sr['pma_pw'] = PMA_sqlAddslashes($GLOBALS['pma_pw']);
        $_SESSION['replication']['m_hostname'] = $sr['hostname'] = PMA_sqlAddslashes($GLOBALS['hostname']);
        $_SESSION['replication']['m_port'] = $sr['port'] = PMA_sqlAddslashes($GLOBALS['port']);
        $_SESSION['replication']['m_correct'] = '';
        $_SESSION['replication']['sr_action_status'] = 'error';
            foreach ($current_privileges as $current) {
                echo '        <td>' . "\n" . '            ';
                if (!isset($current['Db']) || $current['Db'] == '*') {
                    echo $GLOBALS['strGlobal'];
                } elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) {
                    echo $GLOBALS['strDbSpecific'];
                } else {
                    echo $GLOBALS['strWildcard'], ': <tt>' . htmlspecialchars($current['Db']) . '</tt>';
                }
                echo "\n" . '        </td>' . "\n" . '        <td>' . "\n" . '            <tt>' . "\n" . '                ' . join(',' . "\n" . '                ', PMA_extractPrivInfo($current, TRUE)) . "\n" . '            </tt>' . "\n" . '        </td>' . "\n" . '        <td>' . "\n" . '            ' . ($current['Grant_priv'] == 'Y' ? $GLOBALS['strYes'] : $GLOBALS['strNo']) . "\n" . '        </td>' . "\n" . '        <td>' . "\n";
                printf($link_edit, urlencode($current_user), urlencode($current_host), urlencode(!isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), '');
                echo '</td>' . "\n" . '    </tr>' . "\n";
            }
            if (empty($row) && empty($row1) && empty($row2)) {
                break;
            }
            $odd_row = !$odd_row;
        }
    } else {
        echo '    <tr class="odd">' . "\n" . '        <td colspan="6">' . "\n" . '            ' . $GLOBALS['strNoUsersFound'] . "\n" . '        </td>' . "\n" . '    </tr>' . "\n";
    }
    echo '</tbody>' . "\n" . '</table>' . "\n";
    // Offer to create a new user for the current database
    echo '<fieldset id="fieldset_add_user">' . "\n" . '    <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . $checkprivs . '">' . "\n" . PMA_getIcon('b_usradd.png') . '        ' . $GLOBALS['strAddUser'] . '</a>' . "\n" . '</fieldset>' . "\n";
}
// end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...
/**
 * Displays the footer
 */
echo "\n\n";
require_once './libraries/footer.inc.php';
Beispiel #19
0
}
if (!$is_information_schema) {
    if ($cfgRelation['commwork']) {
        /**
         * database comment
         */
        ?>
    <div class="operations_half_width">
    <form method="post" action="db_operations.php">
    <?php 
        echo PMA_generate_common_hidden_inputs($db);
        ?>
    <fieldset>
        <legend>
        <?php 
        echo PMA_getIcon('b_comment.png', __('Database comment: '), false, true);
        ?>
        </legend>
        <input type="text" name="comment" class="textfield" size="30"
            value="<?php 
        echo htmlspecialchars(PMA_getDBComment($db));
        ?>
" />
    </fieldset>
    <fieldset class="tblFooters">
        <input type="submit" value="<?php 
        echo __('Go');
        ?>
" />
    </fieldset>
    </form>
require_once './libraries/common.inc.php';
/**
 * Does the common work
 */
$GLOBALS['js_include'][] = 'server_privileges.js';
$GLOBALS['js_include'][] = 'replication.js';
require './libraries/server_common.inc.php';
require './libraries/replication.inc.php';
require './libraries/replication_gui.lib.php';
require_once './libraries/server_synchronize.lib.php';
/**
 * Checks if the user is allowed to do what he tries to...
 */
if (!$is_superuser) {
    require './libraries/server_links.inc.php';
    echo '<h2>' . "\n" . PMA_getIcon('s_replication.png') . __('Replication') . "\n" . '</h2>' . "\n";
    PMA_Message::error(__('No Privileges'))->display();
    require './libraries/footer.inc.php';
}
/**
 * Handling control requests
 */
if (isset($GLOBALS['sr_take_action'])) {
    $refresh = false;
    if (isset($GLOBALS['slave_changemaster'])) {
        $_SESSION['replication']['m_username'] = $sr['username'] = PMA_sqlAddslashes($GLOBALS['username']);
        $_SESSION['replication']['m_password'] = $sr['pma_pw'] = PMA_sqlAddslashes($GLOBALS['pma_pw']);
        $_SESSION['replication']['m_hostname'] = $sr['hostname'] = PMA_sqlAddslashes($GLOBALS['hostname']);
        $_SESSION['replication']['m_port'] = $sr['port'] = PMA_sqlAddslashes($GLOBALS['port']);
        $_SESSION['replication']['m_correct'] = '';
        $_SESSION['replication']['sr_action_status'] = 'error';
    $result = PMA_DBI_query($row_info_query . ";", null, PMA_DBI_QUERY_STORE);
    $fields_meta = PMA_DBI_get_fields_meta($result);
    while ($row = PMA_DBI_fetch_assoc($result)) {
        // for bit fields we need to convert them to printable form
        $i = 0;
        foreach ($row as $col => $val) {
            if ($fields_meta[$i]->type == 'bit') {
                $row[$col] = PMA_printable_bit_value($val, $fields_meta[$i]->length);
            }
            $i++;
        }
        $extra_data['row_info'] = $row;
    }
    PMA_ajaxResponse(null, true, $extra_data);
}
$titles['Browse'] = PMA_getIcon('b_browse.png', __('Browse foreign values'));
/**
 * Not selection yet required -> displays the selection form
 */
// Gets some core libraries
require_once './libraries/tbl_common.php';
$url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
/**
 * Gets tables informations
 */
require_once './libraries/tbl_info.inc.php';
/**
 * Displays top menu links
 */
require_once './libraries/tbl_links.inc.php';
if (!isset($goto)) {
    </tr>
            <?php 
        }
        // Optimize link if overhead
        if (isset($free_size) && !PMA_DRIZZLE && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA' || $tbl_type == 'BDB')) {
            ?>
    <tr class="tblFooters">
        <td colspan="3" align="center">
            <a href="sql.php?<?php 
            echo $url_query;
            ?>
&pos=0&amp;sql_query=<?php 
            echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table));
            ?>
"><?php 
            echo PMA_getIcon('b_tbloptimize.png', __('Optimize table'));
            ?>
</a>
        </td>
    </tr>
            <?php 
        }
        ?>
    </tbody>
    </table>
        <?php 
    }
    $odd_row = false;
    ?>
    <table id="tablerowstats" class="data">
    <caption class="tblHeaders"><?php 
                $user_form .= sprintf($link_edit, urlencode($current_user), urlencode($current_host), urlencode(!isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), '');
                $user_form .= '</td>' . "\n" . '    </tr>' . "\n";
                if ($i + 1 < count($current_privileges)) {
                    $user_form .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">' . "\n";
                }
            }
            if (empty($row) && empty($row1) && empty($row2)) {
                break;
            }
            $odd_row = !$odd_row;
        }
    } else {
        $user_form .= '    <tr class="odd">' . "\n" . '        <td colspan="6">' . "\n" . '            ' . __('No user found.') . "\n" . '        </td>' . "\n" . '    </tr>' . "\n";
    }
    $user_form .= '</tbody>' . "\n" . '</table></fieldset></form>' . "\n";
    if ($GLOBALS['is_ajax_request'] == true) {
        $extra_data['user_form'] = $user_form;
        $message = PMA_Message::success(__('User has been added.'));
        PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
    } else {
        // Offer to create a new user for the current database
        $user_form .= '<fieldset id="fieldset_add_user">' . "\n" . '<legend>' . __('New') . '</legend>' . "\n" . '    <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . htmlspecialchars($checkprivs) . '" rel="' . 'checkprivs=' . htmlspecialchars($checkprivs) . '&amp;' . $GLOBALS['url_query'] . '" class="' . $conditional_class . '" name="db_specific">' . "\n" . PMA_getIcon('b_usradd.png') . '        ' . __('Add user') . '</a>' . "\n" . '</fieldset>' . "\n";
        echo $user_form;
    }
}
// end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...
/**
 * Displays the footer
 */
echo "\n\n";
require './libraries/footer.inc.php';
            foreach ($current_privileges as $current) {
                echo '        <td>' . "\n" . '            ';
                if (!isset($current['Db']) || $current['Db'] == '*') {
                    echo __('global');
                } elseif ($current['Db'] == PMA_escape_mysql_wildcards($checkprivs)) {
                    echo __('database-specific');
                } else {
                    echo __('wildcard'), ': <tt>' . htmlspecialchars($current['Db']) . '</tt>';
                }
                echo "\n" . '        </td>' . "\n" . '        <td>' . "\n" . '            <tt>' . "\n" . '                ' . join(',' . "\n" . '                ', PMA_extractPrivInfo($current, TRUE)) . "\n" . '            </tt>' . "\n" . '        </td>' . "\n" . '        <td>' . "\n" . '            ' . ($current['Grant_priv'] == 'Y' ? __('Yes') : __('No')) . "\n" . '        </td>' . "\n" . '        <td>' . "\n";
                printf($link_edit, urlencode($current_user), urlencode($current_host), urlencode(!isset($current['Db']) || $current['Db'] == '*' ? '' : $current['Db']), '');
                echo '</td>' . "\n" . '    </tr>' . "\n";
            }
            if (empty($row) && empty($row1) && empty($row2)) {
                break;
            }
            $odd_row = !$odd_row;
        }
    } else {
        echo '    <tr class="odd">' . "\n" . '        <td colspan="6">' . "\n" . '            ' . __('No user found.') . "\n" . '        </td>' . "\n" . '    </tr>' . "\n";
    }
    echo '</tbody>' . "\n" . '</table></form>' . "\n";
    // Offer to create a new user for the current database
    echo '<fieldset id="fieldset_add_user">' . "\n" . '    <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . htmlspecialchars($checkprivs) . '">' . "\n" . PMA_getIcon('b_usradd.png') . '        ' . __('Add a new User') . '</a>' . "\n" . '</fieldset>' . "\n";
}
// end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...
/**
 * Displays the footer
 */
echo "\n\n";
require './libraries/footer.inc.php';
Beispiel #25
0
 * prepare table infos
 */
// action titles (image or string)
$titles = array();
$titles['Change'] = PMA_getIcon('b_edit.png', $strChange, true);
$titles['Drop'] = PMA_getIcon('b_drop.png', $strDrop, true);
$titles['NoDrop'] = PMA_getIcon('b_drop.png', $strDrop, true);
$titles['Primary'] = PMA_getIcon('b_primary.png', $strPrimary, true);
$titles['Index'] = PMA_getIcon('b_index.png', $strIndex, true);
$titles['Unique'] = PMA_getIcon('b_unique.png', $strUnique, true);
$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', $strIdxFulltext, true);
$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', $strPrimary, true);
$titles['NoIndex'] = PMA_getIcon('bd_index.png', $strIndex, true);
$titles['NoUnique'] = PMA_getIcon('bd_unique.png', $strUnique, true);
$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', $strIdxFulltext, true);
$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', $strBrowseDistinctValues, true);
/**
 * Displays the table structure ('show table' works correct since 3.23.03)
 */
/* TABLE INFORMATION */
// table header
$i = 0;
?>
<form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm">
    <?php 
echo PMA_generate_common_hidden_inputs($db, $table);
?>
<table id="tablestructure" class="data">
<thead>
<tr>
    <th id="th<?php 
Beispiel #26
0
                    <?php 
                }
                if ($field['pma_type'] == 'date' || $field['pma_type'] == 'datetime' || substr($field['pma_type'], 0, 9) == 'timestamp') {
                    // the _3 suffix points to the date field
                    // the _2 suffix points to the corresponding NULL checkbox
                    // in dateFormat, 'yy' means the year with 4 digits
                }
            }
        }
        if (in_array($field['pma_type'], $gis_data_types)) {
            $data_val = isset($vrow[$field['Field']]) ? $vrow[$field['Field']] : '';
            $_url_params = array('field' => $field['Field_title'], 'value' => $data_val);
            if ($field['pma_type'] != 'geometry') {
                $_url_params = $_url_params + array('gis_data[gis_type]' => strtoupper($field['pma_type']));
            }
            $edit_str = PMA_getIcon('b_edit.png', __('Edit/Insert'));
            echo '<span class="open_gis_editor">';
            echo PMA_linkOrButton('#', $edit_str, array(), false, false, '_blank');
            echo '</span>';
        }
        ?>
            </td>
        </tr>
        <?php 
        $odd_row = !$odd_row;
    }
    // end for
    $o_rows++;
    echo '  </tbody></table><br />';
}
// end foreach on multi-edit
/**
 * Displays operations that are available on results.
 *
 * @param   array   the display mode
 * @param   array   the analyzed query
 *
 * @uses    $_SESSION['tmp_user_values']['pos']
 * @uses    $_SESSION['tmp_user_values']['display_text']
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  string   $sql_query         the current SQL query
 * @global  integer  $unlim_num_rows    the total number of rows returned by the
 *                                      SQL query without any programmatically
 *                                      appended "LIMIT" clause
 *
 * @access  private
 *
 * @see     PMA_showMessage(), PMA_setDisplayMode(),
 *          PMA_displayTableNavigation(), PMA_displayTableHeaders(),
 *          PMA_displayTableBody(), PMA_displayResultsOperations()
 */
function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
{
    global $db, $table, $sql_query, $unlim_num_rows;
    $header_shown = FALSE;
    $header = '<fieldset><legend>' . $GLOBALS['strQueryResultsOperations'] . '</legend>';
    if ($the_disp_mode[6] == '1' || $the_disp_mode[9] == '1') {
        // Displays "printable view" link if required
        if ($the_disp_mode[9] == '1') {
            if (!$header_shown) {
                echo $header;
                $header_shown = TRUE;
            }
            $_url_params = array('db' => $db, 'table' => $table, 'printview' => '1', 'sql_query' => $sql_query);
            $url_query = PMA_generate_common_url($_url_params);
            echo PMA_linkOrButton('sql.php' . $url_query, PMA_getIcon('b_print.png', $GLOBALS['strPrintView'], false, true), '', true, true, 'print_view') . "\n";
            if ($_SESSION['tmp_user_values']['display_text']) {
                $_url_params['display_text'] = 'F';
                echo PMA_linkOrButton('sql.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_print.png', $GLOBALS['strPrintViewFull'], false, true), '', true, true, 'print_view') . "\n";
                unset($_url_params['display_text']);
            }
        }
        // end displays "printable view"
    }
    // Export link
    // (the url_query has extra parameters that won't be used to export)
    // (the single_table parameter is used in display_export.lib.php
    //  to hide the SQL and the structure export dialogs)
    // If the parser found a PROCEDURE clause
    // (most probably PROCEDURE ANALYSE()) it makes no sense to
    // display the Export link).
    if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && !isset($printview) && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
        if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && !isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) {
            $_url_params['single_table'] = 'true';
        }
        if (!$header_shown) {
            echo $header;
            $header_shown = TRUE;
        }
        $_url_params['unlim_num_rows'] = $unlim_num_rows;
        /**
         * At this point we don't know the table name; this can happen
         * for example with a query like
         * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp
         * As a workaround we set in the table parameter the name of the
         * first table of this database, so that tbl_export.php and
         * the script it calls do not fail
         */
        if (empty($_url_params['table'])) {
            $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES");
        }
        echo PMA_linkOrButton('tbl_export.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_tblexport.png', $GLOBALS['strExport'], false, true), '', true, true, '') . "\n";
    }
    // CREATE VIEW
    /**
     *
     * @todo detect privileges to create a view
     *       (but see 2006-01-19 note in display_create_table.lib.php,
     *        I think we cannot detect db-specific privileges reliably)
     * Note: we don't display a Create view link if we found a PROCEDURE clause
     */
    if (!$header_shown) {
        echo $header;
        $header_shown = TRUE;
    }
    if (!isset($analyzed_sql[0]['queryflags']['procedure'])) {
        echo PMA_linkOrButton('view_create.php' . $url_query, PMA_getIcon('b_views.png', 'CREATE VIEW', false, true), '', true, true, '') . "\n";
    }
    if ($header_shown) {
        echo '</fieldset><br />';
    }
}
$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true);
$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true);
$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true);
$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true);
$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
// hidden action titles (image and string)
$hidden_titles = array();
$hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), false, true);
$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), false, true);
$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), false, true);
$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), false, true);
$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true);
$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true);
$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true);
$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true);
$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true);
/**
 * Displays the table structure ('show table' works correct since 3.23.03)
 */
/* TABLE INFORMATION */
// table header
$i = 0;
?>
<form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm">
    <?php 
echo PMA_generate_common_hidden_inputs($db, $table);
echo '<input type="hidden" name="table_type" value=';
if ($db_is_information_schema) {
    echo '"information_schema" />';
} else {
    if ($tbl_is_view) {
           . '        </td>' . "\n"
           . '    </tr>' . "\n";
    }
    $user_form .= '</tbody>' . "\n"
       . '</table></fieldset></form>' . "\n";

    if ($GLOBALS['is_ajax_request'] == true) {
        $extra_data['user_form'] = $user_form;
        $message = PMA_Message::success(__('User has been added.'));
        PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
    } else {
        // Offer to create a new user for the current database
        $user_form .= '<fieldset id="fieldset_add_user">' . "\n"
           . '<legend>' . __('New') . '</legend>' . "\n"
           . '    <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;adduser=1&amp;dbname=' . htmlspecialchars($checkprivs) .'" rel="'.'checkprivs='.htmlspecialchars($checkprivs). '&amp;'.$GLOBALS['url_query'] . '" class="'.$conditional_class.'" name="db_specific">' . "\n"
           . PMA_getIcon('b_usradd.png')
           . '        ' . __('Add user') . '</a>' . "\n"
           . '</fieldset>' . "\n";
        echo $user_form ;
    }

} // end if (empty($_REQUEST['adduser']) && empty($checkprivs)) ... elseif ... else ...


/**
 * Displays the footer
 */
echo "\n\n";
require 'libraries/footer.inc.php';

?>
Beispiel #30
0
    $tabs['import']['fragment'] = '#';
    $tabs['import']['attr'] = 'onclick="PMA_querywindowCommit(\'files\');return false;"';
    $tabs['import']['active'] = (bool) ($querydisplay_tab == 'files');
    $tabs['history']['icon'] = 'b_bookmark.png';
    $tabs['history']['text'] = __('SQL history');
    $tabs['history']['fragment'] = '#';
    $tabs['history']['attr'] = 'onclick="PMA_querywindowCommit(\'history\');return false;"';
    $tabs['history']['active'] = (bool) ($querydisplay_tab == 'history');
    if ($GLOBALS['cfg']['QueryWindowDefTab'] == 'full') {
        $tabs['all']['text'] = __('All');
        $tabs['all']['fragment'] = '#';
        $tabs['all']['attr'] = 'onclick="PMA_querywindowCommit(\'full\');return false;"';
        $tabs['all']['active'] = (bool) ($querydisplay_tab == 'full');
    }
}
$titles['Change'] = PMA_getIcon('b_edit.png', __('Change'));
$url_query = PMA_generate_common_url($db, $table);
if (!empty($sql_query)) {
    $show_query = 1;
}
if ($no_js) {
    // ... we redirect to appropriate query sql page
    // works only full if $db and $table is also stored/grabbed from $_COOKIE
    if (strlen($table)) {
        include './tbl_sql.php';
    } elseif (strlen($db)) {
        include './db_sql.php';
    } else {
        include './server_sql.php';
    }
    exit;