Code Duplication    Length = 29-31 lines in 2 locations

src/controllers/AggregatesController.php 1 location

@@ 394-422 (lines=29) @@
391
     *
392
     * @param mixed $confirm
393
     */
394
    public function doDrop($confirm)
395
    {
396
        $this->data = $this->misc->getDatabaseAccessor();
397
398
        if ($confirm) {
399
            $this->printTrail('aggregate');
400
            $this->printTitle($this->lang['strdrop'], 'pg.aggregate.drop');
401
402
            echo '<p>', sprintf($this->lang['strconfdropaggregate'], htmlspecialchars($_REQUEST['aggrname'])), '</p>'.PHP_EOL;
403
404
            echo '<form action="'.\SUBFOLDER.'/src/views/aggregates" method="post">'.PHP_EOL;
405
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL;
406
            echo '<p><input type="hidden" name="action" value="drop" />'.PHP_EOL;
407
            echo '<input type="hidden" name="aggrname" value="', htmlspecialchars($_REQUEST['aggrname']), '" />'.PHP_EOL;
408
            echo '<input type="hidden" name="aggrtype" value="', htmlspecialchars($_REQUEST['aggrtype']), '" />'.PHP_EOL;
409
            echo $this->misc->form;
410
            echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL;
411
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
412
            echo '</form>'.PHP_EOL;
413
        } else {
414
            $status = $this->data->dropAggregate($_POST['aggrname'], $_POST['aggrtype'], isset($_POST['cascade']));
415
            if (0 == $status) {
416
                $this->misc->setReloadBrowser(true);
417
                $this->doDefault($this->lang['straggregatedropped']);
418
            } else {
419
                $this->doDefault($this->lang['straggregatedroppedbad']);
420
            }
421
        }
422
    }
423
424
    /**
425
     * Show the properties of an aggregate.

src/controllers/FulltextController.php 1 location

@@ 330-360 (lines=31) @@
327
        }
328
    }
329
330
    public function doDropDict($confirm)
331
    {
332
        $data = $this->misc->getDatabaseAccessor();
333
334
        if ($confirm) {
335
            $this->printTrail('ftscfg'); // TODO: change to smth related to dictionary
336
            $this->printTitle($this->lang['strdrop'], 'pg.ftsdict.drop');
337
338
            echo '<p>', sprintf($this->lang['strconfdropftsdict'], $this->misc->printVal($_REQUEST['ftsdict'])), '</p>'.PHP_EOL;
339
340
            echo '<form action="'.\SUBFOLDER.'/src/views/fulltext" method="post">'.PHP_EOL;
341
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL;
342
            echo '<p><input type="hidden" name="action" value="dropdict" />'.PHP_EOL;
343
            echo '<input type="hidden" name="database" value="', htmlspecialchars($_REQUEST['database']), '" />'.PHP_EOL;
344
            echo '<input type="hidden" name="ftsdict" value="', htmlspecialchars($_REQUEST['ftsdict']), '" />'.PHP_EOL;
345
            //echo "<input type=\"hidden\" name=\"ftscfg\" value=\"", htmlspecialchars($_REQUEST['ftscfg']), "\" />".PHP_EOL;
346
            echo '<input type="hidden" name="prev_action" value="viewdicts" /></p>'.PHP_EOL;
347
            echo $this->misc->form;
348
            echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL;
349
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
350
            echo '</form>'.PHP_EOL;
351
        } else {
352
            $status = $data->dropFtsDictionary($_POST['ftsdict'], isset($_POST['cascade']));
353
            if (0 == $status) {
354
                $this->misc->setReloadBrowser(true);
355
                $this->doViewDicts($this->lang['strftsdictdropped']);
356
            } else {
357
                $this->doViewDicts($this->lang['strftsdictdroppedbad']);
358
            }
359
        }
360
    }
361
362
    /**
363
     * Displays a screen where one can enter a new FTS configuration.