Code Duplication    Length = 25-26 lines in 4 locations

src/controllers/AdminTrait.php 4 locations

@@ 27-51 (lines=25) @@
24
        }
25
26
        if ($confirm) {
27
            if (isset($_REQUEST['ma'])) {
28
                $this->printTrail('schema');
29
                $this->printTitle($lang['strclusterindex'], 'pg.index.cluster');
30
31
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
32
                foreach ($_REQUEST['ma'] as $v) {
33
                    $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
34
                    echo '<p>', sprintf($lang['strconfclustertable'], $misc->printVal($a['table'])), "</p>\n";
35
                    echo '<input type="hidden" name="table[]" value="', htmlspecialchars($a['table']), "\" />\n";
36
                }
37
            } // END if multi cluster
38
            else {
39
                $this->printTrail($type);
40
                $this->printTitle($lang['strclusterindex'], 'pg.index.cluster');
41
42
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
43
44
                if ($type == 'table') {
45
                    echo '<p>', sprintf($lang['strconfclustertable'], $misc->printVal($_REQUEST['object'])), "</p>\n";
46
                    echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n";
47
                } else {
48
                    echo '<p>', sprintf($lang['strconfclusterdatabase'], $misc->printVal($_REQUEST['object'])), "</p>\n";
49
                    echo "<input type=\"hidden\" name=\"table\" value=\"\" />\n";
50
                }
51
            }
52
            echo "<input type=\"hidden\" name=\"action\" value=\"cluster\" />\n";
53
54
            echo $misc->form;
@@ 114-138 (lines=25) @@
111
        }
112
113
        if ($confirm) {
114
            if (isset($_REQUEST['ma'])) {
115
                $this->printTrail('schema');
116
                $this->printTitle($lang['strreindex'], 'pg.reindex');
117
118
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
119
                foreach ($_REQUEST['ma'] as $v) {
120
                    $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
121
                    echo '<p>', sprintf($lang['strconfreindextable'], $misc->printVal($a['table'])), "</p>\n";
122
                    echo '<input type="hidden" name="table[]" value="', htmlspecialchars($a['table']), "\" />\n";
123
                }
124
            } // END if multi reindex
125
            else {
126
                $this->printTrail($type);
127
                $this->printTitle($lang['strreindex'], 'pg.reindex');
128
129
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
130
131
                if ($type == 'table') {
132
                    echo '<p>', sprintf($lang['strconfreindextable'], $misc->printVal($_REQUEST['object'])), "</p>\n";
133
                    echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n";
134
                } else {
135
                    echo '<p>', sprintf($lang['strconfreindexdatabase'], $misc->printVal($_REQUEST['object'])), "</p>\n";
136
                    echo "<input type=\"hidden\" name=\"table\" value=\"\" />\n";
137
                }
138
            }
139
            echo "<input type=\"hidden\" name=\"action\" value=\"reindex\" />\n";
140
141
            if ($data->hasForceReindex()) {
@@ 197-222 (lines=26) @@
194
        }
195
196
        if ($confirm) {
197
            if (isset($_REQUEST['ma'])) {
198
                $this->printTrail('schema');
199
                $this->printTitle($lang['stranalyze'], 'pg.analyze');
200
201
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
202
                foreach ($_REQUEST['ma'] as $v) {
203
                    $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
204
                    \Kint::dump($a);
205
                    echo '<p>', sprintf($lang['strconfanalyzetable'], $misc->printVal($a['table'])), "</p>\n";
206
                    echo '<input type="hidden" name="table[]" value="', htmlspecialchars($a['table']), "\" />\n";
207
                }
208
            } // END if multi analyze
209
            else {
210
                $this->printTrail($type);
211
                $this->printTitle($lang['stranalyze'], 'pg.analyze');
212
213
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
214
215
                if ($type == 'table') {
216
                    echo '<p>', sprintf($lang['strconfanalyzetable'], $misc->printVal($_REQUEST['object'])), "</p>\n";
217
                    echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n";
218
                } else {
219
                    echo '<p>', sprintf($lang['strconfanalyzedatabase'], $misc->printVal($_REQUEST['object'])), "</p>\n";
220
                    echo "<input type=\"hidden\" name=\"table\" value=\"\" />\n";
221
                }
222
            }
223
            echo "<input type=\"hidden\" name=\"action\" value=\"analyze\" />\n";
224
            echo $misc->form;
225
@@ 276-300 (lines=25) @@
273
        }
274
275
        if ($confirm) {
276
            if (isset($_REQUEST['ma'])) {
277
                $this->printTrail('schema');
278
                $this->printTitle($lang['strvacuum'], 'pg.vacuum');
279
280
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
281
                foreach ($_REQUEST['ma'] as $v) {
282
                    $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
283
                    echo '<p>', sprintf($lang['strconfvacuumtable'], $misc->printVal($a['table'])), "</p>\n";
284
                    echo '<input type="hidden" name="table[]" value="', htmlspecialchars($a['table']), "\" />\n";
285
                }
286
            } else {
287
                // END if multi vacuum
288
                $this->printTrail($type);
289
                $this->printTitle($lang['strvacuum'], 'pg.vacuum');
290
291
                echo '<form action="' . SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n";
292
293
                if ($type == 'table') {
294
                    echo '<p>', sprintf($lang['strconfvacuumtable'], $misc->printVal($_REQUEST['object'])), "</p>\n";
295
                    echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n";
296
                } else {
297
                    echo '<p>', sprintf($lang['strconfvacuumdatabase'], $misc->printVal($_REQUEST['object'])), "</p>\n";
298
                    echo "<input type=\"hidden\" name=\"table\" value=\"\" />\n";
299
                }
300
            }
301
            echo "<input type=\"hidden\" name=\"action\" value=\"vacuum\" />\n";
302
            echo $misc->form;
303
            echo "<p><input type=\"checkbox\" id=\"vacuum_full\" name=\"vacuum_full\" /> <label for=\"vacuum_full\">{$lang['strfull']}</label></p>\n";