Code Duplication    Length = 38-38 lines in 3 locations

src/controllers/MaterializedviewsController.php 1 location

@@ 378-415 (lines=38) @@
375
            echo "</form>\n";
376
377
            return;
378
        } else {
379
            if (!isset($_POST['show'])) {
380
                $_POST['show'] = [];
381
            }
382
383
            if (!isset($_POST['values'])) {
384
                $_POST['values'] = [];
385
            }
386
387
            if (!isset($_POST['nulls'])) {
388
                $_POST['nulls'] = [];
389
            }
390
391
            // Verify that they haven't supplied a value for unary operators
392
            foreach ($_POST['ops'] as $k => $v) {
393
                if ($data->selectOps[$v] == 'p' && $_POST['values'][$k] != '') {
394
                    $this->doSelectRows(true, $lang['strselectunary']);
395
396
                    return;
397
                }
398
            }
399
400
            if (count($_POST['show']) == 0) {
401
                return $this->doSelectRows(true, $lang['strselectneedscol']);
402
            } else {
403
                // Generate query SQL
404
                $query = $data->getSelectSQL($_REQUEST['matview'], array_keys($_POST['show']), $_POST['values'], $_POST['ops']);
405
406
                $_REQUEST['query'] = $query;
407
                $_REQUEST['return'] = 'schema';
408
409
                $this->setNoOutput(true);
410
411
                $display_controller = new DisplayController($this->getContainer());
412
413
                return $display_controller->render();
414
            }
415
        }
416
    }
417
418
    /**

src/controllers/TablesController.php 1 location

@@ 878-915 (lines=38) @@
875
            echo "</form>\n";
876
877
            return;
878
        } else {
879
            if (!isset($_POST['show'])) {
880
                $_POST['show'] = [];
881
            }
882
883
            if (!isset($_POST['values'])) {
884
                $_POST['values'] = [];
885
            }
886
887
            if (!isset($_POST['nulls'])) {
888
                $_POST['nulls'] = [];
889
            }
890
891
            // Verify that they haven't supplied a value for unary operators
892
            foreach ($_POST['ops'] as $k => $v) {
893
                if ($data->selectOps[$v] == 'p' && $_POST['values'][$k] != '') {
894
                    $this->doSelectRows(true, $lang['strselectunary']);
895
896
                    return;
897
                }
898
            }
899
900
            if (count($_POST['show']) == 0) {
901
                $this->doSelectRows(true, $lang['strselectneedscol']);
902
            } else {
903
                // Generate query SQL
904
                $query = $data->getSelectSQL($_REQUEST['table'], array_keys($_POST['show']),
905
                    $_POST['values'], $_POST['ops']);
906
                $_REQUEST['query'] = $query;
907
                $_REQUEST['return'] = 'selectrows';
908
909
                $this->setNoOutput(true);
910
911
                $display_controller = new DisplayController($this->getContainer());
912
913
                return $display_controller->render();
914
            }
915
        }
916
    }
917
918
    /**

src/controllers/ViewsController.php 1 location

@@ 377-414 (lines=38) @@
374
            echo "</form>\n";
375
376
            return;
377
        } else {
378
            if (!isset($_POST['show'])) {
379
                $_POST['show'] = [];
380
            }
381
382
            if (!isset($_POST['values'])) {
383
                $_POST['values'] = [];
384
            }
385
386
            if (!isset($_POST['nulls'])) {
387
                $_POST['nulls'] = [];
388
            }
389
390
            // Verify that they haven't supplied a value for unary operators
391
            foreach ($_POST['ops'] as $k => $v) {
392
                if ($data->selectOps[$v] == 'p' && $_POST['values'][$k] != '') {
393
                    $this->doSelectRows(true, $lang['strselectunary']);
394
395
                    return;
396
                }
397
            }
398
399
            if (count($_POST['show']) == 0) {
400
                return $this->doSelectRows(true, $lang['strselectneedscol']);
401
            } else {
402
                // Generate query SQL
403
                $query = $data->getSelectSQL($_REQUEST['view'], array_keys($_POST['show']), $_POST['values'], $_POST['ops']);
404
405
                $_REQUEST['query'] = $query;
406
                $_REQUEST['return'] = 'schema';
407
408
                $this->setNoOutput(true);
409
410
                $display_controller = new DisplayController($this->getContainer());
411
412
                return $display_controller->render();
413
            }
414
        }
415
    }
416
417
    /**