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

« back to all changes in this revision

Viewing changes to tbl_properties.inc.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.inc.php,v 2.3 2003/11/26 22:52:24 rabus Exp $ */
 
2
/* $Id: tbl_properties.inc.php,v 2.17 2004/09/29 14:52:49 nijel Exp $ */
3
3
// vim: expandtab sw=4 ts=4 sts=4:
4
4
 
5
5
// Check parameters
31
31
else if ($action == 'tbl_addfield.php') {
32
32
    echo "\n";
33
33
    ?>
 
34
    <input type="hidden" name="field_where" value="<?php echo $field_where; ?>" />
34
35
    <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
35
36
    <?php
36
37
}
42
43
    <?php
43
44
}
44
45
 
 
46
if (isset($field_where)) {
 
47
    ?>
 
48
    <input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" />
 
49
    <?php
 
50
}
 
51
 
45
52
if (isset($after_field)) {
46
53
    ?>
47
54
    <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
49
56
}
50
57
 
51
58
if (isset($selected) && is_array($selected)) {
52
 
    foreach($selected AS $o_fld_nr => $o_fld_val) {
 
59
    foreach ($selected AS $o_fld_nr => $o_fld_val) {
53
60
    ?>
54
61
    <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
55
62
    <?php
62
69
    }
63
70
 
64
71
    if (isset($true_selected) && is_array($true_selected)) {
65
 
        foreach($true_selected AS $o_fld_nr => $o_fld_val) {
 
72
        foreach ($true_selected AS $o_fld_nr => $o_fld_val) {
66
73
        ?>
67
74
        <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
68
75
        <?php
82
89
$content_cells = array();
83
90
 
84
91
$header_cells[] = $strField;
85
 
$header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
 
92
$header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('Reference', 'Column_types') : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>');
86
93
$header_cells[] = $strLengthSet;
87
94
if (PMA_MYSQL_INT_VERSION >= 40100) {
88
 
    $header_cells[] = $strCharset;
 
95
    $header_cells[] = $strCollation;
89
96
}
90
97
$header_cells[] = $strAttr;
91
98
$header_cells[] = $strNull;
92
99
$header_cells[] = $strDefault . '**';
93
100
$header_cells[] = $strExtra;
94
101
 
 
102
 
 
103
 
 
104
// lem9: We could remove this 'if' and let the key information be shown and
 
105
// editable. However, for this to work, tbl_alter must be modified to use the
 
106
// key fields, as tbl_addfield does.
 
107
 
 
108
if (!$is_backup) {
 
109
    $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;
 
110
    $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;
 
111
    $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;
 
112
    $header_cells[] = '---';
 
113
    $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;
 
114
}
 
115
 
 
116
 
95
117
require_once('./libraries/relation.lib.php');
96
118
require_once('./libraries/transformations.lib.php');
97
119
$cfgRelation = PMA_getRelationsParam();
114
136
    }
115
137
}
116
138
 
117
 
 
118
 
// lem9: We could remove this 'if' and let the key information be shown and
119
 
// editable. However, for this to work, tbl_alter must be modified to use the
120
 
// key fields, as tbl_addfield does.
121
 
 
122
 
if (!$is_backup) {
123
 
    $header_cells[] = $strPrimary;
124
 
    $header_cells[] = $strIndex;
125
 
    $header_cells[] = $strUnique;
126
 
    $header_cells[] = '---';
127
 
    $header_cells[] = $strIdxFulltext;
128
 
}
129
 
 
130
139
// garvin: workaround for field_fulltext, because its submitted indizes contain
131
140
//         the index as a value, not a key. Inserted here for easier maintaineance
132
141
//         and less code to change in existing files.
133
142
if (isset($field_fulltext) && is_array($field_fulltext)) {
134
 
    foreach($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
 
143
    foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
135
144
        $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
136
145
    }
137
146
}
145
154
        $row['Field']     = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
146
155
        $row['Type']      = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
147
156
        $row['Null']      = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
148
 
        if ($row['Null'] == '') {
 
157
        if (isset($field_type[$i]) && $row['Null'] == '') {
149
158
            $submit_null = TRUE;
150
159
        }
151
160
 
201
210
        $content_cells[$i][$ci] = '';
202
211
    }
203
212
 
204
 
    $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '&quot;', $row['Field']) : '') . '" class="textfield" />';
 
213
    $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '&quot;', $row['Field']) : '') . '" class="textfield" title="' . $strField . '" />';
205
214
    $ci++;
206
215
    $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
207
216
 
217
226
        $type   = $tmp[1];
218
227
        $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
219
228
    } else {
220
 
        $type   = preg_replace('@BINARY@i', '', $type);
 
229
        // strip the "BINARY" attribute, except if we find "BINARY(" because
 
230
        // this would be a BINARY or VARBINARY field type
 
231
        $type   = preg_replace('@BINARY([^\(])@i', '', $type);
221
232
        $type   = preg_replace('@ZEROFILL@i', '', $type);
222
233
        $type   = preg_replace('@UNSIGNED@i', '', $type);
223
234
 
230
241
    } // end if else
231
242
 
232
243
    // some types, for example longtext, are reported as
233
 
    // "longtext character set latin7" when not latin1
 
244
    // "longtext character set latin7" when their charset and / or collation
 
245
    // differs from the ones of the corresponding database.
234
246
    if (PMA_MYSQL_INT_VERSION >= 40100) {
235
247
        $tmp = strpos($type, 'character set');
236
248
        if ($tmp) {
268
280
        $unsigned         = 0;
269
281
        $zerofill         = 0;
270
282
    } else {
271
 
        $binary           = stristr($row['Type'], 'binary');
 
283
        if (!preg_match('@BINARY[\(]@i', $row['Type']) && PMA_MYSQL_INT_VERSION < 40100) {
 
284
            $binary           = stristr($row['Type'], 'binary');
 
285
        } else {
 
286
            $binary           = FALSE;
 
287
        }
272
288
        $unsigned         = stristr($row['Type'], 'unsigned');
273
289
        $zerofill         = stristr($row['Type'], 'zerofill');
274
290
    }
275
291
 
276
292
    if (PMA_MYSQL_INT_VERSION >= 40100) {
277
 
        $content_cells[$i][$ci] = '<select name="field_charset[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"
278
 
                                . '    <option value=""></option>' . "\n";
279
 
        if (!empty($row['Collation']) && (
280
 
            strtolower(substr($type, 0, 4)) == 'char'
281
 
            || strtolower(substr($type, 0, 7)) == 'varchar'
282
 
            || strtolower(substr($type, 0, 4)) == 'text'
283
 
            || strtolower(substr($type, 0, 8)) == 'tinytext'
284
 
            || strtolower(substr($type, 0, 10)) == 'mediumtext'
285
 
            || strtolower(substr($type, 0, 8)) == 'longtext'
286
 
            || strtolower(substr($type, 0, 3)) == 'set'
287
 
            || strtolower(substr($type, 0, 4)) == 'enum'
288
 
            ) && !$binary) {
289
 
            $real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
290
 
        } else {
291
 
            $real_charset = '';
292
 
        }
293
 
        for ($j = 0; isset($mysql_charsets[$j]); $j++) {
294
 
            $content_cells[$i][$ci] .= '    <option value="' . $mysql_charsets[$j] . '"' . ($mysql_charsets[$j] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$j] . '</option>' . "\n";
295
 
        }
296
 
        unset($j);
297
 
        unset($real_charset);
298
 
        $content_cells[$i][$ci] .= '</select>' . "\n";
 
293
        $tmp_collation          = empty($row['Collation']) ? NULL : $row['Collation'];
 
294
        $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE);
 
295
        unset($tmp_collation);
299
296
        $ci++;
300
297
    }
301
298
 
318
315
 
319
316
    $cnt_attribute_types = count($cfg['AttributeTypes']);
320
317
    for ($j = 0;$j < $cnt_attribute_types; $j++) {
 
318
        if (PMA_MYSQL_INT_VERSION >= 40100 && $cfg['AttributeTypes'][$j] == 'BINARY') {
 
319
            continue;
 
320
        }
321
321
        $content_cells[$i][$ci] .= '                <option value="'. $cfg['AttributeTypes'][$j] . '"';
322
322
        if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
323
323
            $content_cells[$i][$ci] .= ' selected="selected"';
354
354
        $content_cells[$i][$ci] = "\n";
355
355
    }
356
356
 
357
 
    $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="8" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '&quot;', $row['Default']) : '') . '" class="textfield" />';
 
357
    $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="12" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '&quot;', $row['Default']) : '') . '" class="textfield" />';
358
358
    $ci++;
359
359
 
360
360
    $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
361
361
 
362
 
    if(!isset($row) || empty($row['Extra'])) {
 
362
    if (!isset($row) || empty($row['Extra'])) {
363
363
        $content_cells[$i][$ci] .= "\n";
364
364
        $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
365
365
        $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
372
372
    $content_cells[$i][$ci] .= "\n" . '</select>';
373
373
    $ci++;
374
374
 
375
 
    // garvin: comments
376
 
    if ($cfgRelation['commwork']) {
377
 
        $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="8" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?  htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
378
 
        $ci++;
379
 
    }
380
 
 
381
 
    // garvin: MIME-types
382
 
    if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
383
 
        $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
384
 
        $content_cells[$i][$ci] .= '    <option value=""></option>' . "\n";
385
 
        $content_cells[$i][$ci] .= '    <option value="auto">auto-detect</option>' . "\n";
386
 
 
387
 
        if (is_array($available_mime['mimetype'])) {
388
 
            foreach($available_mime['mimetype'] AS $mimekey => $mimetype) {
389
 
                $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
390
 
                $content_cells[$i][$ci] .= '    <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
391
 
            }
392
 
        }
393
 
 
394
 
        $content_cells[$i][$ci] .= '</select>';
395
 
        $ci++;
396
 
 
397
 
        $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
398
 
        $content_cells[$i][$ci] .= '    <option value="" title="' . $strNone . '"></option>' . "\n";
399
 
        if (is_array($available_mime['transformation'])) {
400
 
            foreach($available_mime['transformation'] AS $mimekey => $transform) {
401
 
                $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : '');
402
 
                $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
403
 
                $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
404
 
                $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
405
 
            }
406
 
        }
407
 
 
408
 
        $content_cells[$i][$ci] .= '</select>';
409
 
        $ci++;
410
 
 
411
 
        $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="8" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?  htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
412
 
        $ci++;
413
 
    }
414
375
 
415
376
    // lem9: See my other comment about removing this 'if'.
416
377
    if (!$is_backup) {
443
404
            $checked_fulltext = '';
444
405
        }
445
406
 
446
 
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
447
 
        $ci++;
448
 
 
449
 
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' .  $checked_index . ' />';
450
 
        $ci++;
451
 
 
452
 
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' .  $checked_unique . ' />';
453
 
        $ci++;
454
 
 
455
 
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' .  $checked_none . ' />';
456
 
        $ci++;
457
 
 
458
 
        $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
 
407
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' title="' . $strPrimary . '" />';
 
408
        $ci++;
 
409
 
 
410
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' .  $checked_index . ' title="' . $strIndex . '" />';
 
411
        $ci++;
 
412
 
 
413
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' .  $checked_unique . ' title="' . $strUnique . '" />';
 
414
        $ci++;
 
415
 
 
416
        $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' .  $checked_none . ' title="---" />';
 
417
        $ci++;
 
418
 
 
419
        $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' title="' . $strIdxFulltext . '" />';
 
420
        $ci++;
459
421
    } // end if ($action ==...)
 
422
 
 
423
    // garvin: comments
 
424
    if ($cfgRelation['commwork']) {
 
425
        $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="12" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?  htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
 
426
        $ci++;
 
427
    }
 
428
 
 
429
    // garvin: MIME-types
 
430
    if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
 
431
        $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
 
432
        $content_cells[$i][$ci] .= '    <option value=""></option>' . "\n";
 
433
        $content_cells[$i][$ci] .= '    <option value="auto">auto-detect</option>' . "\n";
 
434
 
 
435
        if (is_array($available_mime['mimetype'])) {
 
436
            foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
 
437
                $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
 
438
                $content_cells[$i][$ci] .= '    <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
 
439
            }
 
440
        }
 
441
 
 
442
        $content_cells[$i][$ci] .= '</select>';
 
443
        $ci++;
 
444
 
 
445
        $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
 
446
        $content_cells[$i][$ci] .= '    <option value="" title="' . $strNone . '"></option>' . "\n";
 
447
        if (is_array($available_mime['transformation'])) {
 
448
            foreach ($available_mime['transformation'] AS $mimekey => $transform) {
 
449
                $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : '');
 
450
                $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
 
451
                $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
 
452
                $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
 
453
            }
 
454
        }
 
455
 
 
456
        $content_cells[$i][$ci] .= '</select>';
 
457
        $ci++;
 
458
 
 
459
        $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="16" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?  htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
 
460
        //$ci++;
 
461
    }
460
462
} // end for
461
463
 
462
464
if ($cfg['DefaultPropDisplay'] == 'horizontal') {
463
465
?>
464
 
    <table border="<?php echo $cfg['Border']; ?>">
 
466
    <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
465
467
    <tr>
466
468
<?php
467
469
    if (is_array($header_cells)) {
468
 
        foreach($header_cells AS $header_nr => $header_val) {
 
470
        foreach ($header_cells AS $header_nr => $header_val) {
469
471
?>
470
 
        <th><?php echo $header_val; ?></th>
 
472
        <th class="tblHeaders"><?php echo $header_val; ?></th>
471
473
<?php
472
474
        }
473
475
    }
476
478
<?php
477
479
    if (is_array($content_cells)) {
478
480
        $i = 0;
479
 
        foreach($content_cells AS $content_nr => $content_row) {
 
481
        foreach ($content_cells AS $content_nr => $content_row) {
480
482
            $i++;
481
483
            echo "\n" . '<tr>' . "\n";
482
484
 
483
485
            $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
484
486
 
485
487
            if (is_array($content_row)) {
486
 
                foreach($content_row AS $content_row_nr => $content_row_val) {
 
488
                foreach ($content_row AS $content_row_nr => $content_row_val) {
487
489
?>
488
 
        <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
 
490
        <td bgcolor="<?php echo $bgcolor; ?>" align="center"><?php echo $content_row_val; ?></td>
489
491
<?php
490
492
                }
491
493
            }
503
505
<?php
504
506
    if (is_array($header_cells)) {
505
507
        $i = 0;
506
 
        foreach($header_cells AS $header_nr => $header_val) {
 
508
        foreach ($header_cells AS $header_nr => $header_val) {
507
509
            echo "\n" . '<tr>' . "\n";
508
510
?>
509
511
        <th align="right"><?php echo $header_val; ?></th>
533
535
    ?>
534
536
    <table>
535
537
    <tr valign="top">
536
 
        <td><?php echo $strTableComments; ?>&nbsp;:</td>
 
538
        <td><?php echo $strTableComments; ?>:&nbsp;</td>
537
539
    <?php
538
540
    if ($action == 'tbl_create.php') {
539
541
        echo "\n";
540
542
        ?>
541
543
        <td width="25">&nbsp;</td>
542
 
        <td><?php echo $strTableType; ?>&nbsp;:</td>
 
544
        <td><?php echo $strTableType; ?>:&nbsp;</td>
543
545
        <?php
544
546
        if (PMA_MYSQL_INT_VERSION >= 40100) {
545
547
            echo '        <td width="25">&nbsp;</td>' . "\n"
546
 
               . '        <td>' . $strCharset . '&nbsp;:</td>' . "\n";
 
548
               . '        <td>' . $strCollation . ':&nbsp;</td>' . "\n";
547
549
        }
548
550
    }
549
551
    echo "\n";
558
560
    // change by staybyte - 11 June 2001
559
561
    if ($action == 'tbl_create.php') {
560
562
        // find mysql capability - staybyte - 11. June 2001
561
 
        $query = 'SHOW VARIABLES LIKE \'have_%\'';
562
 
        $result = PMA_mysql_query($query);
563
 
        if ($result != FALSE && mysql_num_rows($result) > 0) {
564
 
            while ($tmp = PMA_mysql_fetch_array($result)) {
 
563
        $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'have_%\';');
 
564
        if ($result) {
 
565
            while ($tmp = PMA_DBI_fetch_assoc($result)) {
565
566
                if (isset($tmp['Variable_name'])) {
566
567
                    switch ($tmp['Variable_name']) {
567
568
                        case 'have_bdb':
588
589
                } // end if
589
590
            } // end while
590
591
        } // end if
591
 
        mysql_free_result($result);
 
592
        PMA_DBI_free_result($result);
592
593
 
593
594
        echo "\n";
594
595
        ?>
609
610
        if (PMA_MYSQL_INT_VERSION >= 40100) {
610
611
            echo '        <td width="25">&nbsp;</td>' . "\n"
611
612
               . '        <td>' . "\n"
612
 
               . '            <select name="tbl_charset">' . "\n";
613
 
            for ($i = 0; isset($mysql_charsets[$i]); $i++) {
614
 
                echo '                <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
615
 
            }
616
 
            unset($i);
617
 
            echo '            </select>' . "\n"
 
613
               . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, NULL, FALSE, 3)
618
614
               . '        </td>' . "\n";
619
615
        }
620
616
    }
629
625
// END - Table Type - 2 May 2001 - Robbat2
630
626
?>
631
627
 
632
 
<input type="submit" name="submit" value="<?php echo $strSave; ?>" />
 
628
<?php
 
629
if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') {
 
630
    echo '    ' . sprintf($strAddFields,  '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n";
 
631
    echo '    &nbsp;<input type="submit" name="submit_num_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', 1)" style="vertical-align: middle;" />' . "\n<br />\n<br />\n";
 
632
}
 
633
?>
 
634
 
 
635
<div class="tblFooters" style="width: 80%; text-align: center; padding: 3px;">
 
636
    <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" />
 
637
</div>
 
638
 
633
639
</form>
634
640
 
635
641
<table>