Code Duplication    Length = 5-11 lines in 4 locations

application/libraries/Permitions.php 3 locations

@@ 388-392 (lines=5) @@
385
386
                $this->db->query($sql);
387
388
                if ($this->input->post('Privileges')) {
389
                    $idPrivilege = implode(',', $this->input->post('Privileges'));
390
                    $sql = 'UPDATE shop_rbac_privileges SET group_id = ' . $idNewGroup . ' WHERE id IN(' . $idPrivilege . ')';
391
                    $this->db->query($sql);
392
                }
393
394
                showMessage('Группа создана');
395
                if ($this->input->post('action') == 'tomain') {
@@ 443-447 (lines=5) @@
440
            $sql = 'UPDATE shop_rbac_group_i18n SET description = ' . $this->db->escape($this->input->post('Description')) . ' WHERE id = ' . $groupId . " AND locale = '" . MY_Controller::getCurrentLocale() . "'";
441
            $this->db->query($sql);
442
443
            if ($this->input->post('Privileges')) {
444
                $idPrivilege = implode(',', $this->input->post('Privileges'));
445
                $sql = 'UPDATE shop_rbac_privileges SET group_id = ' . $groupId . ' WHERE id IN(' . $idPrivilege . ')';
446
                $this->db->query($sql);
447
            }
448
            showMessage('Изменения сохранены');
449
            if ($this->input->post('action') == 'tomain') {
450
                pjax('/admin/rbac/groupEdit/' . $groupId);
@@ 536-541 (lines=6) @@
533
                        $this->db->query($sql);
534
                    }
535
536
                    if ($this->input->post('Privileges')) {
537
                        foreach ($this->input->post('Privileges') as $idPrivilege) {
538
                            $sqlPrivilege = 'INSERT INTO shop_rbac_roles_privileges (role_id, privilege_id) VALUES(' . $idCreate . ', ' . $this->db->escape($idPrivilege) . ')';
539
                            $this->db->query($sqlPrivilege);
540
                        }
541
                    }
542
543
                    $last_role_id = $this->db->order_by('id', 'desc')->get('shop_rbac_roles')->row()->id;
544
                    $this->lib_admin->log(lang('The role is created') . '. Id: ' . $last_role_id);

application/modules/menu/admin.php 1 location

@@ 760-770 (lines=11) @@
757
            $after_pos = $this->menu_model->get_item_position($this->input->post('position_after'));
758
            $after_pos = $after_pos['position'];
759
760
            if ($after_pos != FALSE) {
761
                $position = $after_pos + 1;
762
763
                $sql = "UPDATE `menus_data`
764
                            SET `position`=`position` + 1
765
                            WHERE `position` > '$after_pos'
766
                            AND `menu_id`='" . $this->input->post('menu_id') . "'
767
                            AND `parent_id`='" . $this->input->post('parent_id') . "'
768
                            ";
769
                $this->db->query($sql);
770
            }
771
        }
772
773
        if ($this->input->post('position_after') == 0) {