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

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