Code Duplication    Length = 32-32 lines in 2 locations

src/controllers/DomainsController.php 1 location

@@ 379-410 (lines=32) @@
376
     * @param mixed $confirm
377
     * @param mixed $msg
378
     */
379
    public function doDropConstraint($confirm, $msg = '')
380
    {
381
        $data = $this->misc->getDatabaseAccessor();
382
383
        if ($confirm) {
384
            $this->printTrail('domain');
385
            $this->printTitle($this->lang['strdrop'], 'pg.constraint.drop');
386
            $this->printMsg($msg);
387
388
            echo '<p>', sprintf(
389
                $this->lang['strconfdropconstraint'],
390
                $this->misc->printVal($_REQUEST['constraint']),
391
                $this->misc->printVal($_REQUEST['domain'])
392
            ), '</p>'.PHP_EOL;
393
            echo '<form action="'.\SUBFOLDER.'/src/views/domains" method="post">'.PHP_EOL;
394
            echo '<input type="hidden" name="action" value="drop_con" />'.PHP_EOL;
395
            echo '<input type="hidden" name="domain" value="', htmlspecialchars($_REQUEST['domain']), '" />'.PHP_EOL;
396
            echo '<input type="hidden" name="constraint" value="', htmlspecialchars($_REQUEST['constraint']), '" />'.PHP_EOL;
397
            echo $this->misc->form;
398
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL;
399
            echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL;
400
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL;
401
            echo '</form>'.PHP_EOL;
402
        } else {
403
            $status = $data->dropDomainConstraint($_POST['domain'], $_POST['constraint'], isset($_POST['cascade']));
404
            if (0 == $status) {
405
                $this->doProperties($this->lang['strconstraintdropped']);
406
            } else {
407
                $this->doDropConstraint(true, $this->lang['strconstraintdroppedbad']);
408
            }
409
        }
410
    }
411
412
    /**
413
     * Show properties for a domain.  Allow manipulating constraints as well.

src/controllers/TriggersController.php 1 location

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