Code Duplication    Length = 5-11 lines in 4 locations

application/libraries/Permitions.php 3 locations

@@ 395-399 (lines=5) @@
392
393
                $this->db->query($sql);
394
395
                if ($this->input->post('Privileges')) {
396
                    $idPrivilege = implode(',', $this->input->post('Privileges'));
397
                    $sql = 'UPDATE shop_rbac_privileges SET group_id = ' . $idNewGroup . ' WHERE id IN(' . $idPrivilege . ')';
398
                    $this->db->query($sql);
399
                }
400
401
                showMessage('Группа создана');
402
                if ($this->input->post('action') == 'tomain') {
@@ 450-454 (lines=5) @@
447
            $sql = 'UPDATE shop_rbac_group_i18n SET description = ' . $this->db->escape($this->input->post('Description')) . ' WHERE id = ' . $groupId . " AND locale = '" . MY_Controller::getCurrentLocale() . "'";
448
            $this->db->query($sql);
449
450
            if ($this->input->post('Privileges')) {
451
                $idPrivilege = implode(',', $this->input->post('Privileges'));
452
                $sql = 'UPDATE shop_rbac_privileges SET group_id = ' . $groupId . ' WHERE id IN(' . $idPrivilege . ')';
453
                $this->db->query($sql);
454
            }
455
            showMessage('Изменения сохранены');
456
            if ($this->input->post('action') == 'tomain') {
457
                pjax('/admin/rbac/groupEdit/' . $groupId);
@@ 543-548 (lines=6) @@
540
                        $this->db->query($sql);
541
                    }
542
543
                    if ($this->input->post('Privileges')) {
544
                        foreach ($this->input->post('Privileges') as $idPrivilege) {
545
                            $sqlPrivilege = 'INSERT INTO shop_rbac_roles_privileges (role_id, privilege_id) VALUES(' . $idCreate . ', ' . $this->db->escape($idPrivilege) . ')';
546
                            $this->db->query($sqlPrivilege);
547
                        }
548
                    }
549
550
                    $last_role_id = $this->db->order_by('id', 'desc')->get('shop_rbac_roles')->row()->id;
551
                    $this->lib_admin->log(lang('The role is created') . '. Id: ' . $last_role_id);

application/modules/menu/admin.php 1 location

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