Code Duplication    Length = 12-12 lines in 2 locations

application/modules/menu/admin.php 2 locations

@@ 775-786 (lines=12) @@
772
            }
773
        }
774
775
        if ($this->input->post('position_after') == 0) {
776
            $this->db->select_max('position');
777
            $this->db->where('menu_id', $this->input->post('menu_id'));
778
            $this->db->where('parent_id', $this->input->post('parent_id'));
779
            $query = $this->db->get('menus_data')->row_array();
780
781
            if ($query['position'] == NULL) {
782
                $position = 1;
783
            } else {
784
                $position = $query['position'] + 1;
785
            }
786
        }
787
788
        if ($this->input->post('position_after') == 'first') {
789
            $this->db->select_min('position');
@@ 788-799 (lines=12) @@
785
            }
786
        }
787
788
        if ($this->input->post('position_after') == 'first') {
789
            $this->db->select_min('position');
790
            $this->db->where('menu_id', $this->input->post('menu_id'));
791
            $this->db->where('parent_id', $this->input->post('parent_id'));
792
            $query = $this->db->get('menus_data')->row_array();
793
794
            if ($query['position'] == NULL) {
795
                $position = 1;
796
            } else {
797
                $position = $query['position'] - 1;
798
            }
799
        }
800
801
        $item_data = [
802
                      'menu_id'    => $this->input->post('menu_id'),