Code Duplication    Length = 28-31 lines in 4 locations

src/controllers/FulltextController.php 1 location

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

src/controllers/OperatorsController.php 1 location

@@ 250-277 (lines=28) @@
247
     *
248
     * @param mixed $confirm
249
     */
250
    public function doDrop($confirm)
251
    {
252
        $data = $this->misc->getDatabaseAccessor();
253
254
        if ($confirm) {
255
            $this->printTrail('operator');
256
            $this->printTitle($this->lang['strdrop'], 'pg.operator.drop');
257
258
            echo '<p>', sprintf($this->lang['strconfdropoperator'], $this->misc->printVal($_REQUEST['operator'])), '</p>'.PHP_EOL;
259
260
            echo '<form action="'.\SUBFOLDER.'/src/views/operators" method="post">'.PHP_EOL;
261
            echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL;
262
            echo '<p><input type="hidden" name="action" value="drop" />'.PHP_EOL;
263
            echo '<input type="hidden" name="operator" value="', htmlspecialchars($_REQUEST['operator']), '" />'.PHP_EOL;
264
            echo '<input type="hidden" name="operator_oid" value="', htmlspecialchars($_REQUEST['operator_oid']), '" />'.PHP_EOL;
265
            echo $this->misc->form;
266
            echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL;
267
            echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
268
            echo '</form>'.PHP_EOL;
269
        } else {
270
            $status = $data->dropOperator($_POST['operator_oid'], isset($_POST['cascade']));
271
            if (0 == $status) {
272
                $this->doDefault($this->lang['stroperatordropped']);
273
            } else {
274
                $this->doDefault($this->lang['stroperatordroppedbad']);
275
            }
276
        }
277
    }
278
}
279

src/controllers/TriggersController.php 2 locations

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