Code Duplication    Length = 31-34 lines in 5 locations

src/controllers/FulltextController.php 1 location

@@ 295-328 (lines=34) @@
292
        return $this->printTree($items, $attrs, strtolower($what));
293
    }
294
295
    public function doDropConfig($confirm)
296
    {
297
        $conf = $this->conf;
298
        $misc = $this->misc;
299
        $lang = $this->lang;
300
        $data = $misc->getDatabaseAccessor();
301
302
        if ($confirm) {
303
            $this->printTrail('ftscfg');
304
            $this->printTitle($lang['strdrop'], 'pg.ftscfg.drop');
305
306
            echo '<p>', sprintf($lang['strconfdropftsconfig'], $misc->printVal($_REQUEST['ftscfg'])), "</p>\n";
307
308
            echo '<form action="' . SUBFOLDER . "/src/views/fulltext.php\" method=\"post\">\n";
309
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
310
            echo "<p><input type=\"hidden\" name=\"action\" value=\"dropconfig\" />\n";
311
            echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), "\" />\n";
312
            echo '<input type="hidden" name="ftscfg" value="', htmlspecialchars($_REQUEST['ftscfg']), "\" />\n";
313
            echo $misc->form;
314
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
315
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
316
            echo "</form>\n";
317
        } else {
318
            $status = $data->dropFtsConfiguration($_POST['ftscfg'], isset($_POST['cascade']));
319
            if ($status == 0) {
320
                $this->misc->setReloadBrowser(true);
321
                $this->doDefault($lang['strftsconfigdropped']);
322
            } else {
323
                $this->doDefault($lang['strftsconfigdroppedbad']);
324
            }
325
        }
326
    }
327
328
    public function doDropDict($confirm)
329
    {
330
        $conf = $this->conf;
331
        $misc = $this->misc;

src/controllers/GroupsController.php 1 location

@@ 153-183 (lines=31) @@
150
    /**
151
     * Show confirmation of drop user from group and perform actual drop
152
     */
153
    public function doDropMember($confirm)
154
    {
155
        $conf = $this->conf;
156
        $misc = $this->misc;
157
        $lang = $this->lang;
158
        $data = $misc->getDatabaseAccessor();
159
160
        if ($confirm) {
161
            $this->printTrail('group');
162
            $this->printTitle($lang['strdropmember'], 'pg.group.alter');
163
164
            echo '<p>', sprintf($lang['strconfdropmember'], $misc->printVal($_REQUEST['user']), $misc->printVal($_REQUEST['group'])), "</p>\n";
165
166
            echo '<form action="' . SUBFOLDER . "/src/views/groups.php\" method=\"post\">\n";
167
            echo $misc->form;
168
            echo "<input type=\"hidden\" name=\"action\" value=\"drop_member\" />\n";
169
            echo '<input type="hidden" name="group" value="', htmlspecialchars($_REQUEST['group']), "\" />\n";
170
            echo '<input type="hidden" name="user" value="', htmlspecialchars($_REQUEST['user']), "\" />\n";
171
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
172
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
173
            echo "</form>\n";
174
        } else {
175
            $status = $data->dropGroupMember($_REQUEST['group'], $_REQUEST['user']);
176
            if ($status == 0) {
177
                $this->doProperties($lang['strmemberdropped']);
178
            } else {
179
                $this->doDropMember(true, $lang['strmemberdroppedbad']);
180
            }
181
        }
182
    }
183
184
    /**
185
     * Show read only properties for a group
186
     */

src/controllers/OperatorsController.php 1 location

@@ 241-273 (lines=33) @@
238
    /**
239
     * Show confirmation of drop and perform actual drop
240
     */
241
    public function doDrop($confirm)
242
    {
243
        $conf = $this->conf;
244
        $misc = $this->misc;
245
        $lang = $this->lang;
246
        $data = $misc->getDatabaseAccessor();
247
248
        if ($confirm) {
249
            $this->printTrail('operator');
250
            $this->printTitle($lang['strdrop'], 'pg.operator.drop');
251
252
            echo '<p>', sprintf($lang['strconfdropoperator'], $misc->printVal($_REQUEST['operator'])), "</p>\n";
253
254
            echo '<form action="' . SUBFOLDER . "/src/views/operators.php\" method=\"post\">\n";
255
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
256
            echo "<p><input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
257
            echo '<input type="hidden" name="operator" value="', htmlspecialchars($_REQUEST['operator']), "\" />\n";
258
            echo '<input type="hidden" name="operator_oid" value="', htmlspecialchars($_REQUEST['operator_oid']), "\" />\n";
259
            echo $misc->form;
260
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
261
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
262
            echo "</form>\n";
263
        } else {
264
            $status = $data->dropOperator($_POST['operator_oid'], isset($_POST['cascade']));
265
            if ($status == 0) {
266
                $this->doDefault($lang['stroperatordropped']);
267
            } else {
268
                $this->doDefault($lang['stroperatordroppedbad']);
269
            }
270
        }
271
    }
272
}
273

src/controllers/TriggersController.php 2 locations

@@ 334-366 (lines=33) @@
331
    /**
332
     * Show confirmation of enable trigger and perform enabling the trigger
333
     */
334
    public function doEnable($confirm)
335
    {
336
        $conf = $this->conf;
337
        $misc = $this->misc;
338
        $lang = $this->lang;
339
        $data = $misc->getDatabaseAccessor();
340
341
        if ($confirm) {
342
            $this->printTrail('trigger');
343
            $this->printTitle($lang['strenable'], 'pg.table.alter');
344
345
            echo '<p>', sprintf($lang['strconfenabletrigger'], $misc->printVal($_REQUEST['trigger']),
346
                $misc->printVal($_REQUEST['table'])), "</p>\n";
347
348
            echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n";
349
            echo "<input type=\"hidden\" name=\"action\" value=\"enable\" />\n";
350
            echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n";
351
            echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n";
352
            echo $misc->form;
353
            echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n";
354
            echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />\n";
355
            echo "</form>\n";
356
        } else {
357
            $status = $data->enableTrigger($_POST['trigger'], $_POST['table']);
358
            if ($status == 0) {
359
                $this->doDefault($lang['strtriggerenabled']);
360
            } else {
361
                $this->doDefault($lang['strtriggerenabledbad']);
362
            }
363
        }
364
    }
365
366
    /**
367
     * Show confirmation of disable trigger and perform disabling the trigger
368
     */
369
    public function doDisable($confirm)
@@ 369-401 (lines=33) @@
366
    /**
367
     * Show confirmation of disable trigger and perform disabling the trigger
368
     */
369
    public function doDisable($confirm)
370
    {
371
        $conf = $this->conf;
372
        $misc = $this->misc;
373
        $lang = $this->lang;
374
        $data = $misc->getDatabaseAccessor();
375
376
        if ($confirm) {
377
            $this->printTrail('trigger');
378
            $this->printTitle($lang['strdisable'], 'pg.table.alter');
379
380
            echo '<p>', sprintf($lang['strconfdisabletrigger'], $misc->printVal($_REQUEST['trigger']),
381
                $misc->printVal($_REQUEST['table'])), "</p>\n";
382
383
            echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n";
384
            echo "<input type=\"hidden\" name=\"action\" value=\"disable\" />\n";
385
            echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n";
386
            echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n";
387
            echo $misc->form;
388
            echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n";
389
            echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />\n";
390
            echo "</form>\n";
391
        } else {
392
            $status = $data->disableTrigger($_POST['trigger'], $_POST['table']);
393
            if ($status == 0) {
394
                $this->doDefault($lang['strtriggerdisabled']);
395
            } else {
396
                $this->doDefault($lang['strtriggerdisabledbad']);
397
            }
398
        }
399
    }
400
401
    /**
402
     * Let them create s.th.
403
     */
404
    public function doCreate($msg = '')