~ubuntu-branches/ubuntu/dapper/phpmyadmin/dapper-updates

« back to all changes in this revision

Viewing changes to tbl_properties_structure.php

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Roszatycki
  • Date: 2004-12-13 19:23:57 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20041213192357-5jfwhvbnxaip4zbv
Tags: 2:2.6.1-rc1-1
* New upstream release.
* Security fix: Command execution and file disclosure was found.
  See http://www.phpmyadmin.net/home_page/security.php?issue=PMASA-2004-4
  Closes: #285488.
* Remove 003.non_standard_port_fix.diff applied to upstream.
* Add commented out options 'extension' and 'AllowRoot' to default config
  file.
* Support mysqli.so extension. Autodetect modules from 'extension' option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* $Id: tbl_properties_structure.php,v 2.3 2003/12/29 17:15:14 rabus Exp $ */
 
2
/* $Id: tbl_properties_structure.php,v 2.31 2004/10/25 13:28:19 nijel Exp $ */
3
3
// vim: expandtab sw=4 ts=4 sts=4:
4
4
 
5
5
require_once('./libraries/grab_globals.lib.php');
13
13
// workaround for IE problem:
14
14
if (isset($submit_mult_change_x)) {
15
15
    $submit_mult = $strChange;
16
 
}
17
 
if (isset($submit_mult_drop_x)) {
 
16
} elseif (isset($submit_mult_drop_x)) {
18
17
    $submit_mult = $strDrop;
 
18
} elseif (isset($submit_mult_primary_x)) {
 
19
    $submit_mult = $strPrimary;
 
20
} elseif (isset($submit_mult_index_x)) {
 
21
    $submit_mult = $strIndex;
 
22
} elseif (isset($submit_mult_unique_x)) {
 
23
    $submit_mult = $strUnique;
 
24
} elseif (isset($submit_mult_fulltext_x)) {
 
25
    $submit_mult = $strIdxFulltext;
19
26
}
20
27
 
21
28
if ((!empty($submit_mult) && isset($selected_fld))
34
41
/**
35
42
 * Prepares the table structure display
36
43
 */
37
 
// 1. Get table information/display tabs
 
44
 
 
45
/**
 
46
 * Gets tables informations
 
47
 */
38
48
require('./tbl_properties_table_info.php');
39
49
 
40
50
/**
42
52
 */
43
53
if ((!empty($submit_mult) && isset($selected_fld))
44
54
    || isset($mult_btn)) {
45
 
    PMA_showMessage($strSuccess);
 
55
    $message = $strSuccess;
46
56
}
47
57
 
 
58
/**
 
59
 * Displays top menu links
 
60
 */
 
61
require('./tbl_properties_links.php');
 
62
 
48
63
// 2. Gets table keys and retains them
49
 
$local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
50
 
$result      = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
 
64
$result      = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
51
65
$primary     = '';
52
66
$ret_keys    = array();
53
67
$pk_array    = array(); // will be use to emphasis prim. keys in the table view
54
 
while ($row = PMA_mysql_fetch_array($result)) {
 
68
while ($row = PMA_DBI_fetch_assoc($result)) {
55
69
    $ret_keys[]  = $row;
56
70
    // Backups the list of primary keys
57
71
    if ($row['Key_name'] == 'PRIMARY') {
59
73
        $pk_array[$row['Column_name']] = 1;
60
74
    }
61
75
} // end while
62
 
mysql_free_result($result);
 
76
PMA_DBI_free_result($result);
63
77
 
64
78
// 3. Get fields
65
 
$local_query = 'SHOW FULL FIELDS FROM ' . PMA_backquote($table);
66
 
$fields_rs   = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
67
 
$fields_cnt  = mysql_num_rows($fields_rs);
 
79
$fields_rs   = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
 
80
$fields_cnt  = PMA_DBI_num_rows($fields_rs);
68
81
 
69
82
 
70
83
 
77
90
 
78
91
<form method="post" action="tbl_properties_structure.php" name="fieldsForm">
79
92
    <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
80
 
 
81
 
<table border="<?php echo $cfg['Border']; ?>">
 
93
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
82
94
<tr>
83
 
    <td></td>
84
 
    <th>&nbsp;<?php echo $strField; ?>&nbsp;</th>
85
 
    <th><?php echo $strType; ?></th>
 
95
    <th id="th1">&nbsp;</th>
 
96
    <th id="th2">&nbsp;<?php echo $strField; ?>&nbsp;</th>
 
97
    <th id="th3"><?php echo $strType; ?></th>
86
98
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <th>' . $strCollation . '</th>' . "\n" : ''; ?>
87
 
    <th><?php echo $strAttr; ?></th>
88
 
    <th><?php echo $strNull; ?></th>
89
 
    <th><?php echo $strDefault; ?></th>
90
 
    <th><?php echo $strExtra; ?></th>
91
 
    <th colspan="6"><?php echo $strAction; ?></th>
 
99
    <th id="th4"><?php echo $strAttr; ?></th>
 
100
    <th id="th5"><?php echo $strNull; ?></th>
 
101
    <th id="th6"><?php echo $strDefault; ?></th>
 
102
    <th id="th7"><?php echo $strExtra; ?></th>
 
103
    <th colspan="6" id="th8"><?php echo $strAction; ?></th>
92
104
</tr>
93
105
 
94
106
<?php
114
126
$i         = 0;
115
127
$aryFields = array();
116
128
$checked   = (!empty($checkall) ? ' checked="checked"' : '');
 
129
$save_row  = array();
117
130
 
118
 
while ($row = PMA_mysql_fetch_array($fields_rs)) {
 
131
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
 
132
    $save_row[] = $row;
119
133
    $i++;
120
134
    $bgcolor          = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
121
135
    $aryFields[]      = $row['Field'];
122
136
 
 
137
    if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
 
138
        $on_mouse = ' onmouseover="setPointer(this, ' . $i . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
 
139
                  . ' onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
 
140
    } else {
 
141
        $on_mouse = '';
 
142
    }
 
143
    if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
 
144
        $on_mouse .= ' onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
 
145
    }
 
146
 
 
147
    $click_mouse = ' onmousedown="document.getElementById(\'checkbox_row_' . $i . '\').checked = (document.getElementById(\'checkbox_row_' . $i . '\').checked ? false : true);" ';
 
148
 
123
149
    $type             = $row['Type'];
124
150
    // reformat mysql query output - staybyte - 9. June 2001
125
151
    // loic1: set or enum types: slashes single quotes inside options
133
159
        $zerofill     = 0;
134
160
    } else {
135
161
        $type_nowrap  = ' nowrap="nowrap"';
136
 
        $type         = preg_replace('@BINARY@i', '', $type);
 
162
        // strip the "BINARY" attribute, except if we find "BINARY(" because
 
163
        // this would be a BINARY or VARBINARY field type
 
164
        if (!preg_match('@BINARY[\(]@i', $type)) {
 
165
            $type         = preg_replace('@BINARY@i', '', $type);
 
166
        }
137
167
        $type         = preg_replace('@ZEROFILL@i', '', $type);
138
168
        $type         = preg_replace('@UNSIGNED@i', '', $type);
139
169
        if (empty($type)) {
140
170
            $type     = '&nbsp;';
141
171
        }
142
172
 
143
 
        $binary       = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');
 
173
        if (!preg_match('@BINARY[\(]@i', $row['Type'])) {
 
174
            $binary           = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');
 
175
        } else {
 
176
            $binary           = FALSE;
 
177
        }
 
178
 
144
179
        $unsigned     = stristr($row['Type'], 'unsigned');
145
180
        $zerofill     = stristr($row['Type'], 'zerofill');
146
181
    }
216
251
        $propicon = (string)$cfg['PropertiesIconic'];
217
252
 
218
253
        if ($propicon == 'both') {
219
 
            $iconic_spacer = '<nobr>';
 
254
            $iconic_spacer = '<div class="nowrap">';
220
255
        } else {
221
256
            $iconic_spacer = '';
222
257
        }
223
258
 
224
 
        $titles['Change']        = $iconic_spacer . '<img hspace="7" width="12" height="13" src="images/button_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
225
 
        $titles['Drop']          = $iconic_spacer . '<img hspace="7" width="11" height="12" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
226
 
        $titles['NoDrop']        = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
227
 
        $titles['Primary']       = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
228
 
        $titles['Index']         = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
229
 
        $titles['Unique']        = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
230
 
        $titles['IdxFulltext']   = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_fulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
231
 
        $titles['NoPrimary']     = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noprimary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
232
 
        $titles['NoIndex']       = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noindex.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
233
 
        $titles['NoUnique']      = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nounique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
234
 
        $titles['NoIdxFulltext'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nofulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
 
259
        // images replaced 2004-05-08 by mkkeck
 
260
        $titles['Change']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
 
261
        $titles['Drop']          = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
 
262
        $titles['NoDrop']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
 
263
        $titles['Primary']       = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
 
264
        $titles['Index']         = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
 
265
        $titles['Unique']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
 
266
        $titles['IdxFulltext']   = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
 
267
        $titles['NoPrimary']     = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
 
268
        $titles['NoIndex']       = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
 
269
        $titles['NoUnique']      = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
 
270
        $titles['NoIdxFulltext'] = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
235
271
 
236
272
        if ($propicon == 'both') {
237
 
            $titles['Change']        .= '&nbsp;' . $strChange . '</nobr>';
238
 
            $titles['Drop']          .= '&nbsp;' . $strDrop . '</nobr>';
239
 
            $titles['NoDrop']        .= '&nbsp;' . $strDrop . '</nobr>';
240
 
            $titles['Primary']       .= '&nbsp;' . $strPrimary . '</nobr>';
241
 
            $titles['Index']         .= '&nbsp;' . $strIndex . '</nobr>';
242
 
            $titles['Unique']        .= '&nbsp;' . $strUnique . '</nobr>';
243
 
            $titles['IdxFulltext'  ] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
244
 
            $titles['NoPrimary']     .= '&nbsp;' . $strPrimary . '</nobr>';
245
 
            $titles['NoIndex']       .= '&nbsp;' . $strIndex . '</nobr>';
246
 
            $titles['NoUnique']      .= '&nbsp;' . $strUnique . '</nobr>';
247
 
            $titles['NoIdxFulltext'] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
 
273
            $titles['Change']        .= '&nbsp;' . $strChange . '</div>';
 
274
            $titles['Drop']          .= '&nbsp;' . $strDrop . '</div>';
 
275
            $titles['NoDrop']        .= '&nbsp;' . $strDrop . '</div>';
 
276
            $titles['Primary']       .= '&nbsp;' . $strPrimary . '</div>';
 
277
            $titles['Index']         .= '&nbsp;' . $strIndex . '</div>';
 
278
            $titles['Unique']        .= '&nbsp;' . $strUnique . '</div>';
 
279
            $titles['IdxFulltext'  ] .= '&nbsp;' . $strIdxFulltext . '</div>';
 
280
            $titles['NoPrimary']     .= '&nbsp;' . $strPrimary . '</div>';
 
281
            $titles['NoIndex']       .= '&nbsp;' . $strIndex . '</div>';
 
282
            $titles['NoUnique']      .= '&nbsp;' . $strUnique . '</div>';
 
283
            $titles['NoIdxFulltext'] .= '&nbsp;' . $strIdxFulltext . '</div>';
248
284
        }
249
285
    } else {
250
286
        $titles['Change']        = $strChange;
261
297
    }
262
298
 
263
299
    ?>
264
 
<tr>
 
300
<tr <?php echo $on_mouse; ?>>
265
301
    <td align="center" bgcolor="<?php echo $bgcolor; ?>">
266
302
        <input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
267
303
    </td>
268
 
    <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
269
 
    <td bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
270
 
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <td bgcolor="' . $bgcolor . '">' . (empty($field_charset) ? '&nbsp;' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
271
 
    <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>
272
 
    <td bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
273
 
    <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
274
 
    <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
 
304
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label onclick="return (document.getElementById('checkbox_row_<?php echo $i; ?>') ? false : true)" for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
 
305
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
 
306
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <td bgcolor="' . $bgcolor . '" ' . $click_mouse . '>' . (empty($field_charset) ? '&nbsp;' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
 
307
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>
 
308
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
 
309
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
 
310
    <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
275
311
    <td align="center" bgcolor="<?php echo $bgcolor; ?>">
276
312
        <a href="tbl_alter.php?<?php echo $url_query; ?>&amp;field=<?php echo $field_encoded; ?>">
277
313
            <?php echo $titles['Change']; ?></a>
299
335
        } else {
300
336
            echo "\n";
301
337
            ?>
302
 
        <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
303
 
            onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP PRIMARY KEY, ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
 
338
        <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
 
339
            onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,'); ?> ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
304
340
            <?php echo $titles['Primary']; ?></a>
305
341
            <?php
306
342
        }
370
406
        <table>
371
407
            <tr>
372
408
                <td>
373
 
                    <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
 
409
                    <img src="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
374
410
        <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('fieldsForm', true); return false;">
375
411
            <?php echo $strCheckAll; ?></a>
376
412
        &nbsp;/&nbsp;
383
419
                    <?php
384
420
 
385
421
if ($cfg['PropertiesIconic']) {
386
 
    /* Opera has trouble with <input type="image"> */
387
 
    /* IE has trouble with <button> */
388
 
    if (PMA_USR_BROWSER_AGENT != 'IE') {
389
 
        echo '<button class="mult_submit" type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '">' . "\n"
390
 
           . '<img src="./images/button_edit.png" title="' . $strChange . '" alt="' . $strChange . '" width="12" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n"
391
 
           . '</button>' . "\n";
392
 
    } else {
393
 
        echo '                    <input type="image" name="submit_mult_change" value="' .$strChange . '" title="' . $strChange . '" src="./images/button_edit.png" />'  . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n";
394
 
    }
 
422
    PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $strChange, 'b_edit.png');
395
423
    // Drop button if there is at least two fields
396
424
    if ($fields_cnt > 1) {
397
 
        if (PMA_USR_BROWSER_AGENT != 'IE') {
398
 
            echo '                    <button class="mult_submit" type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '">' . "\n"
399
 
               . '<img src="./images/button_drop.png" title="' . $strDrop . '" alt="' . $strDrop . '" width="11" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n"
400
 
               . '</button>' . "\n";
401
 
        } else {
402
 
            echo '                    <input type="image" name="submit_mult_drop" value="' .$strDrop . '" title="' . $strDrop . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n";
403
 
        }
 
425
        PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', $strDrop, 'b_drop.png');
 
426
    }
 
427
    PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', $strPrimary, 'b_primary.png');
 
428
    PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', $strIndex, 'b_index.png');
 
429
    PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', $strUnique, 'b_unique.png');
 
430
    if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
 
431
        PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', $strIdxFulltext, 'b_ftext.png');
404
432
    }
405
433
} else {
406
 
    echo '                    <input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
 
434
    echo '<input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
407
435
    // Drop button if there is at least two fields
408
436
    if ($fields_cnt > 1) {
409
 
        echo '                    &nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
410
 
           . '                    <input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
 
437
        echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
 
438
           . '<input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
 
439
    }
 
440
    echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
 
441
       . '<input type="submit" name="submit_mult" value="' . $strPrimary . '" title="' . $strPrimary . '" />' . "\n";
 
442
    echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
 
443
       . '<input type="submit" name="submit_mult" value="' . $strIndex . '" title="' . $strIndex . '" />' . "\n";
 
444
    echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
 
445
       . '<input type="submit" name="submit_mult" value="' . $strUnique . '" title="' . $strUnique . '" />' . "\n";
 
446
    if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
 
447
        echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
 
448
           . '<input type="submit" name="submit_mult" value="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' . "\n";
411
449
    }
412
450
}
413
451
 
418
456
    </td>
419
457
</tr>
420
458
</table>
421
 
 
422
 
</form>
423
 
 
 
459
</form>
 
460
 
 
461
<hr />
 
462
 
 
463
 
 
464
<?php
 
465
/**
 
466
 * Work on the table
 
467
 */
 
468
?>
 
469
<!-- TABLE WORK -->
 
470
<!-- Printable view of the table -->
 
471
<a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
 
472
    if ($cfg['PropertiesIconic']) {
 
473
        echo '<img src="' . $pmaThemeImage . 'b_print.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strPrintView . '"/>';
 
474
    }
 
475
    echo $strPrintView;
 
476
    ?></a>&nbsp;&nbsp;&nbsp;
 
477
 
 
478
<?php
 
479
// if internal relations are available, or the table type is INNODB
 
480
// ($tbl_type comes from tbl_properties_table_info.php)
 
481
 
 
482
if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
 
483
?>
 
484
<!-- Work on Relations -->
 
485
<a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
 
486
    if ($cfg['PropertiesIconic']) {
 
487
        echo '<img src="' . $pmaThemeImage . 'b_relations.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strRelationView . '"/>';
 
488
    }
 
489
    echo $strRelationView;
 
490
?></a>&nbsp;&nbsp;&nbsp;
 
491
<?php
 
492
}
 
493
?>
 
494
<!-- Let MySQL propose the optimal structure -->
 
495
<a href="sql.php?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
 
496
    if ($cfg['PropertiesIconic']) {
 
497
        echo '<img src="' . $pmaThemeImage . 'b_tblanalyse.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strStructPropose . '" />';
 
498
    }
 
499
    echo $strStructPropose;
 
500
?></a><?php
 
501
    echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
 
502
?><br />
 
503
<!-- Add some new fields -->
 
504
<form method="post" action="tbl_addfield.php"
 
505
    onsubmit="return checkFormElementInRange(this, 'num_fields', 1)">
 
506
    <?php
 
507
        echo PMA_generate_common_hidden_inputs($db, $table);
 
508
        if ($cfg['PropertiesIconic']) {
 
509
            echo '<img src="' . $pmaThemeImage . 'b_insrow.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strAddNewField . '"/>';
 
510
        }
 
511
        echo sprintf($strAddFields, '<input type="text" name="num_fields" size="2" maxlength="2" value="1" style="vertical-align: middle" onfocus="this.select()" />');
 
512
    ?>
 
513
    <input type="radio" name="field_where" id="radio_field_where_last" value="last" checked="checked" /><label for="radio_field_where_last"><?php echo $strAtEndOfTable; ?></label>
 
514
    <input type="radio" name="field_where" id="radio_field_where_first" value="first" /><label for="radio_field_where_first"><?php echo $strAtBeginningOfTable; ?></label>
 
515
    <input type="radio" name="field_where" id="radio_field_where_after" value="after" /><?php
 
516
        $fieldOptions = '</label><select name="after_field" style="vertical-align: middle" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">';
 
517
        foreach ($aryFields AS $fieldname) {
 
518
            $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
 
519
        }
 
520
        unset($aryFields);
 
521
        $fieldOptions .= '</select><label for="radio_field_where_after">';
 
522
        echo str_replace('<label for="radio_field_where_after"></label>', '', '<label for="radio_field_where_after">' . sprintf($strAfter, $fieldOptions) . '</label>') . "\n";
 
523
        ?>
 
524
    <input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
 
525
</form>
 
526
 
 
527
<hr />
424
528
 
425
529
<?php
426
530
/**
442
546
 */
443
547
?>
444
548
<!-- Indexes, space usage and row statistics -->
445
 
<br />
446
549
<table border="0" cellspacing="0" cellpadding="0">
447
550
<tr>
448
551
    <td valign="top">
493
596
    <!-- Space usage -->
494
597
    <td width="20">&nbsp;</td>
495
598
    <td valign="top">
496
 
        <?php echo $strSpaceUsage . '&nbsp;:' . "\n"; ?>
497
599
        <a name="showusage"></a>
498
 
        <table border="<?php echo $cfg['Border']; ?>">
 
600
        <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
 
601
        <tr><td class="tblHeaders" colspan="3"><?php echo $strSpaceUsage . ':&nbsp;' . "\n"; ?></td></tr>
499
602
        <tr>
500
603
            <th><?php echo $strType; ?></th>
501
604
            <th colspan="2" align="center"><?php echo $strUsage; ?></th>
546
649
            echo "\n";
547
650
            ?>
548
651
        <tr>
549
 
            <td colspan="3" align="center">
550
 
                [<a href="sql.php?<?php echo $url_query; ?>&amp;pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
 
652
            <td colspan="3" align="center" bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
 
653
                <a href="sql.php?<?php echo $url_query; ?>&pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php
 
654
                    if ($cfg['PropertiesIconic']) {
 
655
                       echo '<img src="' . $pmaThemeImage . 'b_tbloptimize.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strOptimizeTable. '" />';
 
656
                    }
 
657
                    echo $strOptimizeTable;
 
658
                ?></a>
551
659
            </td>
552
660
        </tr>
553
661
            <?php
560
668
    <!-- Rows Statistic -->
561
669
    <td width="20">&nbsp;</td>
562
670
    <td valign="top">
563
 
        <?php echo $strRowsStatistic . '&nbsp;:' . "\n"; ?>
564
 
        <table border="<?php echo $cfg['Border']; ?>">
 
671
        <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
 
672
        <tr><td class="tblHeaders" colspan="2"><?php echo $strRowsStatistic . ':&nbsp;' . "\n"; ?></td></tr>
565
673
        <tr>
566
674
            <th><?php echo $strStatement; ?></th>
567
675
            <th align="center"><?php echo $strValue; ?></th>
599
707
            <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCollation; ?></td>
600
708
            <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
601
709
            <?php
602
 
            echo '<dfn title="' . PMA_getCollationDescr($tbl_charset) . '">' . $tbl_charset . '</dfn>';
 
710
            echo '<dfn title="' . PMA_getCollationDescr($tbl_collation) . '">' . $tbl_collation . '</dfn>';
603
711
            ?>
604
712
            </td>
605
713
        </tr>
661
769
            ?>
662
770
        <tr>
663
771
            <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCreateTime; ?></td>
664
 
            <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
 
772
            <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
665
773
                <?php echo PMA_localisedDate(strtotime($showtable['Create_time'])) . "\n"; ?>
666
774
            </td>
667
775
        </tr>
675
783
            ?>
676
784
        <tr>
677
785
            <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatUpdateTime; ?></td>
678
 
            <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
 
786
            <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
679
787
                <?php echo PMA_localisedDate(strtotime($showtable['Update_time'])) . "\n"; ?>
680
788
            </td>
681
789
        </tr>
689
797
            ?>
690
798
        <tr>
691
799
            <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCheckTime; ?></td>
692
 
            <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
 
800
            <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
693
801
                <?php echo PMA_localisedDate(strtotime($showtable['Check_time'])) . "\n"; ?>
694
802
            </td>
695
803
        </tr>
708
816
</tr>
709
817
</table>
710
818
<hr />
711
 
 
712
 
 
713
 
<?php
714
 
/**
715
 
 * Work on the table
716
 
 */
717
 
?>
718
 
<!-- TABLE WORK -->
719
 
<ul>
720
 
 
721
 
    <!-- Printable view of the table -->
722
 
    <li>
723
 
        <div style="margin-bottom: 10px"><a href="tbl_printview.php?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
724
 
    </li>
725
 
 
726
 
    <!-- Add some new fields -->
727
 
    <li>
728
 
        <form method="post" action="tbl_addfield.php"
729
 
            onsubmit="return checkFormElementInRange(this, 'num_fields', 1)">
730
 
            <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
731
 
            <?php echo $strAddNewField; ?>&nbsp;:
732
 
            <input type="text" name="num_fields" size="2" maxlength="2" value="1" class="textfield" style="vertical-align: middle" onfocus="this.select()" />
733
 
            <select name="after_field" style="vertical-align: middle">
734
 
                <option value="--end--"><?php echo $strAtEndOfTable; ?></option>
735
 
                <option value="--first--"><?php echo $strAtBeginningOfTable; ?></option>
736
 
<?php
737
 
foreach($aryFields AS $junk => $fieldname) {
738
 
    echo '                <option value="' . htmlspecialchars($fieldname) . '">' . sprintf($strAfter, htmlspecialchars($fieldname)) . '</option>' . "\n";
739
 
}
740
 
unset($aryFields);
741
 
?>
742
 
            </select>
743
 
            <input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
744
 
        </form>
745
 
    </li>
746
 
 
747
 
<?php
748
 
if ($cfg['Server']['relation']) {
749
 
    ?>
750
 
    <!-- Work on Relations -->
751
 
    <li>
752
 
        <div style="margin-bottom: 10px">
753
 
            <a href="tbl_relation.php?<?php echo $url_query; ?>"><?php echo $strRelationView; ?></a>
754
 
        </div>
755
 
    </li>
756
 
    <?php
757
 
}
758
 
echo "\n";
759
 
?>
760
 
 
761
 
    <!-- Let MySQL propose the optimal structure -->
762
 
    <li>
763
 
        <div style="margin-bottom: 10px">
764
 
        <a href="sql.php?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>">
765
 
            <?php echo $strStructPropose; ?></a>
766
 
        <?php echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n"; ?>
767
 
        </div>
768
 
    </li>
769
 
 
770
819
<?php
771
820
/**
772
821
 * Query box, bookmark, insert data from textfile
773
822
 */
774
823
$goto = 'tbl_properties_structure.php';
775
824
require('./tbl_query_box.php');
776
 
?>
777
 
 
778
 
</ul>
779
 
 
780
 
 
781
 
<?php
 
825
 
782
826
/**
783
827
 * Displays the footer
784
828
 */