Code Duplication    Length = 34-35 lines in 3 locations

src/controllers/DomainsController.php 1 location

@@ 369-402 (lines=34) @@
366
    /**
367
     * Show confirmation of drop constraint and perform actual drop
368
     */
369
    public function doDropConstraint($confirm, $msg = '')
370
    {
371
        $conf = $this->conf;
372
        $misc = $this->misc;
373
        $lang = $this->lang;
374
        $data = $misc->getDatabaseAccessor();
375
376
        if ($confirm) {
377
            $this->printTrail('domain');
378
            $this->printTitle($lang['strdrop'], 'pg.constraint.drop');
379
            $this->printMsg($msg);
380
381
            echo '<p>', sprintf($lang['strconfdropconstraint'], $misc->printVal($_REQUEST['constraint']),
382
                $misc->printVal($_REQUEST['domain'])), "</p>\n";
383
            echo '<form action="' . SUBFOLDER . "/src/views/domains.php\" method=\"post\">\n";
384
            echo "<input type=\"hidden\" name=\"action\" value=\"drop_con\" />\n";
385
            echo '<input type="hidden" name="domain" value="', htmlspecialchars($_REQUEST['domain']), "\" />\n";
386
            echo '<input type="hidden" name="constraint" value="', htmlspecialchars($_REQUEST['constraint']), "\" />\n";
387
            echo $misc->form;
388
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
389
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
390
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
391
            echo "</form>\n";
392
        } else {
393
            $status = $data->dropDomainConstraint($_POST['domain'], $_POST['constraint'], isset($_POST['cascade']));
394
            if ($status == 0) {
395
                $this->doProperties($lang['strconstraintdropped']);
396
            } else {
397
                $this->doDropConstraint(true, $lang['strconstraintdroppedbad']);
398
            }
399
        }
400
    }
401
402
    /**
403
     * Show properties for a domain.  Allow manipulating constraints as well.
404
     */
405
    public function doProperties($msg = '')

src/controllers/TblpropertiesController.php 1 location

@@ 844-878 (lines=35) @@
841
    /**
842
     * Show confirmation of drop column and perform actual drop
843
     */
844
    public function doDrop($confirm)
845
    {
846
        $conf = $this->conf;
847
        $misc = $this->misc;
848
        $lang = $this->lang;
849
        $data = $misc->getDatabaseAccessor();
850
851
        if ($confirm) {
852
            $this->printTrail('column');
853
            $this->printTitle($lang['strdrop'], 'pg.column.drop');
854
855
            echo '<p>', sprintf($lang['strconfdropcolumn'], $misc->printVal($_REQUEST['column']),
856
                $misc->printVal($_REQUEST['table'])), "</p>\n";
857
858
            echo '<form action="' . SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n";
859
            echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
860
            echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n";
861
            echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), "\" />\n";
862
            echo $misc->form;
863
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\"> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
864
            echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />\n";
865
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
866
            echo "</form>\n";
867
        } else {
868
            $status = $data->dropColumn($_POST['table'], $_POST['column'], isset($_POST['cascade']));
869
            if ($status == 0) {
870
                $misc->setReloadBrowser(true);
871
                $this->doDefault($lang['strcolumndropped']);
872
            } else {
873
                $this->doDefault($lang['strcolumndroppedbad']);
874
            }
875
        }
876
    }
877
}
878

src/controllers/TriggersController.php 1 location

@@ 298-331 (lines=34) @@
295
    /**
296
     * Show confirmation of drop and perform actual drop
297
     */
298
    public function doDrop($confirm)
299
    {
300
        $conf = $this->conf;
301
        $misc = $this->misc;
302
        $lang = $this->lang;
303
        $data = $misc->getDatabaseAccessor();
304
305
        if ($confirm) {
306
            $this->printTrail('trigger');
307
            $this->printTitle($lang['strdrop'], 'pg.trigger.drop');
308
309
            echo '<p>', sprintf($lang['strconfdroptrigger'], $misc->printVal($_REQUEST['trigger']),
310
                $misc->printVal($_REQUEST['table'])), "</p>\n";
311
312
            echo '<form action="' . SUBFOLDER . "/src/views/triggers.php\" method=\"post\">\n";
313
            echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n";
314
            echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n";
315
            echo '<input type="hidden" name="trigger" value="', htmlspecialchars($_REQUEST['trigger']), "\" />\n";
316
            echo $misc->form;
317
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>\n";
318
            echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n";
319
            echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />\n";
320
            echo "</form>\n";
321
        } else {
322
            $status = $data->dropTrigger($_POST['trigger'], $_POST['table'], isset($_POST['cascade']));
323
            if ($status == 0) {
324
                $this->doDefault($lang['strtriggerdropped']);
325
            } else {
326
                $this->doDefault($lang['strtriggerdroppedbad']);
327
            }
328
        }
329
    }
330
331
    /**
332
     * Show confirmation of enable trigger and perform enabling the trigger
333
     */
334
    public function doEnable($confirm)