Passed
Pull Request — develop (#92)
by Felipe
04:25
created

SchemasController::doCreate()   B

Complexity

Conditions 7
Paths 32

Size

Total Lines 58
Code Lines 40

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 40
nc 32
nop 1
dl 0
loc 58
rs 7.6045
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
/*
4
 * PHPPgAdmin v6.0.0-beta.30
5
 */
6
7
namespace PHPPgAdmin\Controller;
8
9
use PHPPgAdmin\Decorators\Decorator;
10
11
/**
12
 * Base controller class.
13
 */
5 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
14
class SchemasController extends BaseController
15
{
16
    public $controller_name = 'SchemasController';
17
18
    /**
19
     * Default method to render the controller according to the action parameter.
20
     */
21
    public function render()
22
    {
23
        $lang   = $this->lang;
24
        $action = $this->action;
25
26
        if ('tree' == $action) {
27
            return $this->doTree();
28
        }
29
        if ('subtree' == $action) {
30
            return $this->doSubTree();
31
        }
32
33
        if (isset($_POST['cancel'])) {
34
            $action = '';
35
        }
36
37
        $header_template = 'header.twig';
38
        $footer_template = 'footer.twig';
0 ignored issues
show
Unused Code introduced by
The assignment to $footer_template is dead and can be removed.
Loading history...
39
40
        ob_start();
41
        switch ($action) {
42
            case 'create':
43
                if (isset($_POST['create'])) {
44
                    $this->doSaveCreate();
45
                } else {
46
                    $this->doCreate();
47
                }
48
49
                break;
50
            case 'alter':
51
                if (isset($_POST['alter'])) {
52
                    $this->doSaveAlter();
53
                } else {
54
                    $this->doAlter();
55
                }
56
57
                break;
58
            case 'drop':
59
                if (isset($_POST['drop'])) {
60
                    $this->doDrop(false);
61
                } else {
62
                    $this->doDrop(true);
63
                }
64
65
                break;
66
            case 'export':
67
                $this->doExport();
68
69
                break;
70
            default:
71
                $header_template = 'header_datatables.twig';
72
                $this->doDefault();
73
74
                break;
75
        }
76
77
        $output = ob_get_clean();
78
79
        $this->printHeader($lang['strschemas'], null, true, $header_template);
80
        $this->printBody();
81
82
        echo $output;
83
84
        return $this->printFooter();
85
    }
86
87
    /**
88
     * Show default list of schemas in the database.
89
     *
90
     * @param mixed $msg
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
91
     */
92
    public function doDefault($msg = '')
93
    {
94
        $lang = $this->lang;
95
        $data = $this->misc->getDatabaseAccessor();
96
97
        $this->printTrail('database');
98
        $this->printTabs('database', 'schemas');
99
        $this->printMsg($msg);
100
101
        // Check that the DB actually supports schemas
102
        $schemas = $data->getSchemas();
103
104
        $columns = [
105
            'schema'  => [
106
                'title' => $lang['strschema'],
107
                'field' => Decorator::field('nspname'),
108
                'url'   => \SUBFOLDER . "/redirect/schema?{$this->misc->href}&amp;",
109
                'vars'  => ['schema' => 'nspname'],
110
            ],
111
            'owner'   => [
112
                'title' => $lang['strowner'],
113
                'field' => Decorator::field('nspowner'),
114
            ],
115
            'actions' => [
116
                'title' => $lang['stractions'],
117
            ],
118
            'comment' => [
119
                'title' => $lang['strcomment'],
120
                'field' => Decorator::field('nspcomment'),
121
            ],
122
        ];
123
124
        $actions = [
125
            'multiactions' => [
126
                'keycols' => ['nsp' => 'nspname'],
127
                'url'     => 'schemas.php',
128
            ],
129
            'drop'         => [
130
                'content'     => $lang['strdrop'],
131
                'attr'        => [
132
                    'href' => [
133
                        'url'     => 'schemas.php',
134
                        'urlvars' => [
135
                            'action' => 'drop',
136
                            'nsp'    => Decorator::field('nspname'),
137
                        ],
138
                    ],
139
                ],
140
                'multiaction' => 'drop',
141
            ],
142
            'privileges'   => [
143
                'content' => $lang['strprivileges'],
144
                'attr'    => [
145
                    'href' => [
146
                        'url'     => 'privileges.php',
147
                        'urlvars' => [
148
                            'subject' => 'schema',
149
                            'schema'  => Decorator::field('nspname'),
150
                        ],
151
                    ],
152
                ],
153
            ],
154
            'alter'        => [
155
                'content' => $lang['stralter'],
156
                'attr'    => [
157
                    'href' => [
158
                        'url'     => 'schemas.php',
159
                        'urlvars' => [
160
                            'action' => 'alter',
161
                            'schema' => Decorator::field('nspname'),
162
                        ],
163
                    ],
164
                ],
165
            ],
166
        ];
167
168
        if (!$data->hasAlterSchema()) {
169
            unset($actions['alter']);
170
        }
171
172
        echo $this->printTable($schemas, $columns, $actions, 'schemas-schemas', $lang['strnoschemas']);
173
174
        $this->printNavLinks(['create' => [
1 ignored issue
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
175
            'attr'    => [
176
                'href' => [
177
                    'url'     => 'schemas.php',
178
                    'urlvars' => [
179
                        'action'   => 'create',
180
                        'server'   => $_REQUEST['server'],
181
                        'database' => $_REQUEST['database'],
182
                    ],
183
                ],
184
            ],
185
            'content' => $lang['strcreateschema'],
186
        ]], 'schemas-schemas', get_defined_vars());
1 ignored issue
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
187
    }
188
189
    /**
190
     * Generate XML for the browser tree.
191
     */
192
    public function doTree()
193
    {
194
        $lang = $this->lang;
0 ignored issues
show
Unused Code introduced by
The assignment to $lang is dead and can be removed.
Loading history...
195
        $data = $this->misc->getDatabaseAccessor();
196
197
        $schemas = $data->getSchemas();
198
199
        $reqvars = $this->misc->getRequestVars('schema');
200
201
        //$this->prtrace($reqvars);
202
203
        $attrs = [
204
            'text'    => Decorator::field('nspname'),
205
            'icon'    => 'Schema',
206
            'toolTip' => Decorator::field('nspcomment'),
207
            'action'  => Decorator::redirecturl(
208
                'redirect.php',
209
                $reqvars,
210
                [
211
                    'subject' => 'schema',
212
                    'schema'  => Decorator::field('nspname'),
213
                ]
214
            ),
215
            'branch'  => Decorator::url(
216
                'schemas.php',
217
                $reqvars,
218
                [
219
                    'action' => 'subtree',
220
                    'schema' => Decorator::field('nspname'),
221
                ]
222
            ),
223
        ];
224
225
        $this->printTree($schemas, $attrs, 'schemas');
226
    }
227
228
    public function doSubTree()
1 ignored issue
show
Coding Style introduced by
Missing function doc comment
Loading history...
229
    {
230
        $lang = $this->lang;
0 ignored issues
show
Unused Code introduced by
The assignment to $lang is dead and can be removed.
Loading history...
231
        $data = $this->misc->getDatabaseAccessor();
0 ignored issues
show
Unused Code introduced by
The assignment to $data is dead and can be removed.
Loading history...
232
233
        $tabs = $this->misc->getNavTabs('schema');
234
235
        $items = $this->adjustTabsForTree($tabs);
236
237
        $reqvars = $this->misc->getRequestVars('schema');
238
239
        //$this->prtrace($reqvars);
240
241
        $attrs = [
242
            'text'   => Decorator::field('title'),
243
            'icon'   => Decorator::field('icon'),
244
            'action' => Decorator::actionurl(
245
                Decorator::field('url'),
246
                $reqvars,
247
                Decorator::field('urlvars', [])
248
            ),
249
            'branch' => Decorator::url(
250
                Decorator::field('url'),
251
                $reqvars,
252
                Decorator::field('urlvars'),
253
                ['action' => 'tree']
254
            ),
255
        ];
256
257
        $this->printTree($items, $attrs, 'schema');
258
    }
259
260
    /**
261
     * Displays a screen where they can enter a new schema.
262
     *
263
     * @param mixed $msg
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
264
     */
265
    public function doCreate($msg = '')
266
    {
267
        $lang = $this->lang;
268
        $data = $this->misc->getDatabaseAccessor();
269
270
        $server_info = $this->misc->getServerInfo();
271
272
        if (!isset($_POST['formName'])) {
273
            $_POST['formName'] = '';
274
        }
275
276
        if (!isset($_POST['formAuth'])) {
277
            $_POST['formAuth'] = $server_info['username'];
278
        }
279
280
        if (!isset($_POST['formSpc'])) {
281
            $_POST['formSpc'] = '';
282
        }
283
284
        if (!isset($_POST['formComment'])) {
285
            $_POST['formComment'] = '';
286
        }
287
288
        // Fetch all users from the database
289
        $users = $data->getUsers();
290
291
        $this->printTrail('database');
292
        $this->printTitle($lang['strcreateschema'], 'pg.schema.create');
293
        $this->printMsg($msg);
294
295
        echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n";
296
        echo "<table style=\"width: 100%\">\n";
297
        echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n";
298
        echo "\t\t<td class=\"data1\"><input name=\"formName\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
299
        htmlspecialchars($_POST['formName']), "\" /></td>\n\t</tr>\n";
300
        // Owner
301
        echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strowner']}</th>\n";
302
        echo "\t\t<td class=\"data1\">\n\t\t\t<select name=\"formAuth\">\n";
303
        while (!$users->EOF) {
304
            $uname = htmlspecialchars($users->fields['usename']);
305
            echo "\t\t\t\t<option value=\"{$uname}\"",
306
            ($uname == $_POST['formAuth']) ? ' selected="selected"' : '', ">{$uname}</option>\n";
307
            $users->moveNext();
308
        }
309
        echo "\t\t\t</select>\n\t\t</td>\n\t</tr>\n";
310
        echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strcomment']}</th>\n";
311
        echo "\t\t<td class=\"data1\"><textarea name=\"formComment\" rows=\"3\" cols=\"32\">",
312
        htmlspecialchars($_POST['formComment']), "</textarea></td>\n\t</tr>\n";
313
314
        echo "</table>\n";
315
        echo "<p>\n";
316
        echo "<input type=\"hidden\" name=\"action\" value=\"create\" />\n";
317
        echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n";
318
        echo $this->misc->form;
319
        echo "<input type=\"submit\" name=\"create\" value=\"{$lang['strcreate']}\" />\n";
320
        echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
321
        echo "</p>\n";
322
        echo "</form>\n";
323
    }
324
325
    /**
326
     * Actually creates the new schema in the database.
327
     */
328
    public function doSaveCreate()
329
    {
330
        $lang = $this->lang;
331
        $data = $this->misc->getDatabaseAccessor();
332
333
        // Check that they've given a name
334
        if ('' == $_POST['formName']) {
335
            $this->doCreate($lang['strschemaneedsname']);
336
        } else {
337
            $status = $data->createSchema($_POST['formName'], $_POST['formAuth'], $_POST['formComment']);
338
            if (0 == $status) {
339
                $this->misc->setReloadBrowser(true);
340
                $this->doDefault($lang['strschemacreated']);
341
            } else {
342
                $this->doCreate($lang['strschemacreatedbad']);
343
            }
344
        }
345
    }
346
347
    /**
348
     * Display a form to permit editing schema properies.
349
     * TODO: permit changing owner.
350
     *
351
     * @param mixed $msg
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
352
     */
353
    public function doAlter($msg = '')
354
    {
355
        $lang = $this->lang;
356
        $data = $this->misc->getDatabaseAccessor();
357
358
        $this->printTrail('schema');
359
        $this->printTitle($lang['stralter'], 'pg.schema.alter');
360
        $this->printMsg($msg);
361
362
        $schema = $data->getSchemaByName($_REQUEST['schema']);
363
        if ($schema->recordCount() > 0) {
364
            if (!isset($_POST['comment'])) {
365
                $_POST['comment'] = $schema->fields['nspcomment'];
366
            }
367
368
            if (!isset($_POST['schema'])) {
369
                $_POST['schema'] = $_REQUEST['schema'];
370
            }
371
372
            if (!isset($_POST['name'])) {
373
                $_POST['name'] = $_REQUEST['schema'];
374
            }
375
376
            if (!isset($_POST['owner'])) {
377
                $_POST['owner'] = $schema->fields['ownername'];
378
            }
379
380
            echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n";
381
            echo "<table>\n";
382
383
            echo "\t<tr>\n";
384
            echo "\t\t<th class=\"data left required\">{$lang['strname']}</th>\n";
385
            echo "\t\t<td class=\"data1\">";
386
            echo "\t\t\t<input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
387
            htmlspecialchars($_POST['name']), "\" />\n";
388
            echo "\t\t</td>\n";
389
            echo "\t</tr>\n";
390
391
            if ($data->hasAlterSchemaOwner()) {
392
                $users = $data->getUsers();
393
                echo "<tr><th class=\"data left required\">{$lang['strowner']}</th>\n";
394
                echo '<td class="data2"><select name="owner">';
395
                while (!$users->EOF) {
396
                    $uname = $users->fields['usename'];
397
                    echo '<option value="', htmlspecialchars($uname), '"',
398
                    ($uname == $_POST['owner']) ? ' selected="selected"' : '', '>', htmlspecialchars($uname), "</option>\n";
399
                    $users->moveNext();
400
                }
401
                echo "</select></td></tr>\n";
402
            } else {
403
                echo "<input name=\"owner\" value=\"{$_POST['owner']}\" type=\"hidden\" />";
404
            }
405
406
            echo "\t<tr>\n";
407
            echo "\t\t<th class=\"data\">{$lang['strcomment']}</th>\n";
408
            echo "\t\t<td class=\"data1\"><textarea cols=\"32\" rows=\"3\" name=\"comment\">", htmlspecialchars($_POST['comment']), "</textarea></td>\n";
409
            echo "\t</tr>\n";
410
            echo "</table>\n";
411
            echo "<p><input type=\"hidden\" name=\"action\" value=\"alter\" />\n";
412
            echo '<input type="hidden" name="schema" value="', htmlspecialchars($_POST['schema']), "\" />\n";
413
            echo $this->misc->form;
414
            echo "<input type=\"submit\" name=\"alter\" value=\"{$lang['stralter']}\" />\n";
415
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
416
            echo "</form>\n";
417
        } else {
418
            echo "<p>{$lang['strnodata']}</p>\n";
419
        }
420
    }
421
422
    /**
423
     * Save the form submission containing changes to a schema.
424
     *
425
     * @param mixed $msg
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
426
     */
427
    public function doSaveAlter($msg = '')
1 ignored issue
show
Unused Code introduced by
The parameter $msg is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

427
    public function doSaveAlter(/** @scrutinizer ignore-unused */ $msg = '')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
428
    {
429
        $lang = $this->lang;
430
        $data = $this->misc->getDatabaseAccessor();
431
432
        $status = $data->updateSchema($_POST['schema'], $_POST['comment'], $_POST['name'], $_POST['owner']);
433
        if (0 == $status) {
434
            $this->misc->setReloadBrowser(true);
435
            $this->doDefault($lang['strschemaaltered']);
436
        } else {
437
            $this->doAlter($lang['strschemaalteredbad']);
438
        }
439
    }
440
441
    /**
442
     * Show confirmation of drop and perform actual drop.
443
     *
444
     * @param mixed $confirm
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
445
     */
446
    public function doDrop($confirm)
447
    {
448
        $lang = $this->lang;
449
        $data = $this->misc->getDatabaseAccessor();
450
451
        if (empty($_REQUEST['nsp']) && empty($_REQUEST['ma'])) {
452
            return $this->doDefault($lang['strspecifyschematodrop']);
453
        }
454
455
        if ($confirm) {
456
            $this->printTrail('schema');
457
            $this->printTitle($lang['strdrop'], 'pg.schema.drop');
458
459
            echo '<form action="' . \SUBFOLDER . '/src/views/schemas.php" method="post">' . "\n";
460
            //If multi drop
461
            if (isset($_REQUEST['ma'])) {
462
                foreach ($_REQUEST['ma'] as $v) {
463
                    $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
464
                    echo '<p>', sprintf($lang['strconfdropschema'], $this->misc->printVal($a['nsp'])), "</p>\n";
465
                    echo '<input type="hidden" name="nsp[]" value="', htmlspecialchars($a['nsp']), "\" />\n";
466
                }
467
            } else {
468
                echo '<p>', sprintf($lang['strconfdropschema'], $this->misc->printVal($_REQUEST['nsp'])), "</p>\n";
469
                echo '<input type="hidden" name="nsp" value="', htmlspecialchars($_REQUEST['nsp']), "\" />\n";
470
            }
471
472
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
473
            echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
474
            echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n";
475
            echo $this->misc->form;
476
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
477
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
478
            echo "</form>\n";
479
        } else {
480
            if (is_array($_POST['nsp'])) {
481
                $msg    = '';
482
                $status = $data->beginTransaction();
483
                if (0 == $status) {
484
                    foreach ($_POST['nsp'] as $s) {
485
                        $status = $data->dropSchema($s, isset($_POST['cascade']));
486
                        if (0 == $status) {
487
                            $msg .= sprintf('%s: %s<br />', htmlentities($s, ENT_QUOTES, 'UTF-8'), $lang['strschemadropped']);
488
                        } else {
489
                            $data->endTransaction();
490
                            $this->doDefault(sprintf('%s%s: %s<br />', $msg, htmlentities($s, ENT_QUOTES, 'UTF-8'), $lang['strschemadroppedbad']));
491
492
                            return;
493
                        }
494
                    }
495
                }
496
                if (0 == $data->endTransaction()) {
497
                    // Everything went fine, back to the Default page....
498
                    $this->misc->setReloadBrowser(true);
499
                    $this->doDefault($msg);
500
                } else {
501
                    $this->doDefault($lang['strschemadroppedbad']);
502
                }
503
            } else {
504
                $status = $data->dropSchema($_POST['nsp'], isset($_POST['cascade']));
505
                if (0 == $status) {
506
                    $this->misc->setReloadBrowser(true);
507
                    $this->doDefault($lang['strschemadropped']);
508
                } else {
509
                    $this->doDefault($lang['strschemadroppedbad']);
510
                }
511
            }
512
        }
513
    }
514
515
    /**
516
     * Displays options for database download.
517
     *
518
     * @param mixed $msg
1 ignored issue
show
Coding Style introduced by
Missing parameter comment
Loading history...
519
     */
520
    public function doExport($msg = '')
521
    {
522
        $lang = $this->lang;
523
        $data = $this->misc->getDatabaseAccessor();
0 ignored issues
show
Unused Code introduced by
The assignment to $data is dead and can be removed.
Loading history...
524
525
        $this->printTrail('schema');
526
        $this->printTabs('schema', 'export');
527
        $this->printMsg($msg);
528
529
        echo '<form action="' . \SUBFOLDER . '/src/views/dbexport.php" method="post">' . "\n";
530
531
        echo "<table>\n";
532
        echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n";
533
        // Data only
534
        echo '<tr><th class="data left" rowspan="2">';
535
        echo "<input type=\"radio\" id=\"what1\" name=\"what\" value=\"dataonly\" checked=\"checked\" /><label for=\"what1\">{$lang['strdataonly']}</label></th>\n";
536
        echo "<td>{$lang['strformat']}</td>\n";
537
        echo "<td><select name=\"d_format\">\n";
538
        echo "<option value=\"copy\">COPY</option>\n";
539
        echo "<option value=\"sql\">SQL</option>\n";
540
        echo "</select>\n</td>\n</tr>\n";
541
        echo "<tr><td><label for=\"d_oids\">{$lang['stroids']}</label></td><td><input type=\"checkbox\" id=\"d_oids\" name=\"d_oids\" /></td>\n</tr>\n";
542
        // Structure only
543
        echo "<tr><th class=\"data left\"><input type=\"radio\" id=\"what2\" name=\"what\" value=\"structureonly\" /><label for=\"what2\">{$lang['strstructureonly']}</label></th>\n";
544
        echo "<td><label for=\"s_clean\">{$lang['strdrop']}</label></td><td><input type=\"checkbox\" id=\"s_clean\" name=\"s_clean\" /></td>\n</tr>\n";
545
        // Structure and data
546
        echo '<tr><th class="data left" rowspan="3">';
547
        echo "<input type=\"radio\" id=\"what3\" name=\"what\" value=\"structureanddata\" /><label for=\"what3\">{$lang['strstructureanddata']}</label></th>\n";
548
        echo "<td>{$lang['strformat']}</td>\n";
549
        echo "<td><select name=\"sd_format\">\n";
550
        echo "<option value=\"copy\">COPY</option>\n";
551
        echo "<option value=\"sql\">SQL</option>\n";
552
        echo "</select>\n</td>\n</tr>\n";
553
        echo "<tr><td><label for=\"sd_clean\">{$lang['strdrop']}</label></td><td><input type=\"checkbox\" id=\"sd_clean\" name=\"sd_clean\" /></td>\n</tr>\n";
554
        echo "<tr><td><label for=\"sd_oids\">{$lang['stroids']}</label></td><td><input type=\"checkbox\" id=\"sd_oids\" name=\"sd_oids\" /></td>\n</tr>\n";
555
        echo "</table>\n";
556
557
        echo "<h3>{$lang['stroptions']}</h3>\n";
558
        echo "<p><input type=\"radio\" id=\"output1\" name=\"output\" value=\"show\" checked=\"checked\" /><label for=\"output1\">{$lang['strshow']}</label>\n";
559
        echo "<br/><input type=\"radio\" id=\"output2\" name=\"output\" value=\"download\" /><label for=\"output2\">{$lang['strdownload']}</label>\n";
560
        // MSIE cannot download gzip in SSL mode - it's just broken
561
        if (!(strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') && isset($_SERVER['HTTPS']))) {
562
            echo "<br /><input type=\"radio\" id=\"output3\" name=\"output\" value=\"gzipped\" /><label for=\"output3\">{$lang['strdownloadgzipped']}</label>\n";
563
        }
564
        echo "</p>\n";
565
        echo "<p><input type=\"hidden\" name=\"action\" value=\"export\" />\n";
566
        echo "<input type=\"hidden\" name=\"subject\" value=\"schema\" />\n";
567
        echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n";
568
        echo '<input type="hidden" name="schema" value="', htmlspecialchars($_REQUEST['schema']), "\" />\n";
569
        echo $this->misc->form;
570
        echo "<input type=\"submit\" value=\"{$lang['strexport']}\" /></p>\n";
571
        echo "</form>\n";
572
    }
573
}
574