Code Duplication    Length = 10-15 lines in 2 locations

main/wiki/wiki.inc.php 2 locations

@@ 4347-4356 (lines=10) @@
4344
            if ($current_row['assignment'] == 1) {
4345
                Display::addFlash(Display::return_message(get_lang('EditAssignmentWarning'), 'normal', false));
4346
            } elseif ($current_row['assignment'] == 2) {
4347
                if (($userId == $current_row['user_id']) == false) {
4348
                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
4349
                        $PassEdit = true;
4350
                    } else {
4351
                        Display::addFlash(Display::return_message(get_lang('LockByTeacher'), 'normal', false));
4352
                        $PassEdit = false;
4353
                    }
4354
                } else {
4355
                    $PassEdit = true;
4356
                }
4357
            }
4358
4359
            //show editor if edit is allowed
@@ 5005-5019 (lines=15) @@
5002
                $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
5003
            } elseif ($row['assignment'] == 2) {
5004
                $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
5005
                if (($userId == $row['user_id']) == false) {
5006
                    if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
5007
                        $PassEdit = true;
5008
                    } else {
5009
                        Display::addFlash(
5010
                            Display::return_message(
5011
                                get_lang('LockByTeacher'),
5012
                                'warning'
5013
                            )
5014
                        );
5015
                        $PassEdit = false;
5016
                    }
5017
                } else {
5018
                    $PassEdit = true;
5019
                }
5020
            }
5021
5022
            if ($PassEdit) {