Code Duplication    Length = 21-21 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 836-856 (lines=21) @@
833
    $tool_constant = null;
834
    $return_message = '';
835
836
    if ($content == 'forumcategory') {
837
        $tool_constant = TOOL_FORUM_CATEGORY;
838
        $return_message = get_lang('ForumCategoryDeleted');
839
840
        if (!empty($forum_list)) {
841
            $sql = "SELECT forum_id FROM $table_forums
842
                    WHERE c_id = $course_id AND forum_category='".$id."'";
843
            $result = Database::query($sql);
844
            $row = Database::fetch_array($result);
845
            foreach ($row as $arr_forum) {
846
                $forum_id = $arr_forum['forum_id'];
847
                api_item_property_update(
848
                    $_course,
849
                    'forum',
850
                    $forum_id,
851
                    'delete',
852
                    api_get_user_id()
853
                );
854
            }
855
        }
856
    }
857
858
    if ($content == 'forum') {
859
        $tool_constant = TOOL_FORUM;
@@ 858-878 (lines=21) @@
855
        }
856
    }
857
858
    if ($content == 'forum') {
859
        $tool_constant = TOOL_FORUM;
860
        $return_message = get_lang('ForumDeleted');
861
862
        if (!empty($number_threads)) {
863
            $sql = "SELECT thread_id FROM $table_forum_thread
864
                    WHERE c_id = $course_id AND forum_id = $id ";
865
            $result = Database::query($sql);
866
            $row = Database::fetch_array($result);
867
            foreach ($row as $arr_forum) {
868
                $forum_id = $arr_forum['thread_id'];
869
                api_item_property_update(
870
                    $_course,
871
                    'forum_thread',
872
                    $forum_id,
873
                    'delete',
874
                    api_get_user_id()
875
                );
876
            }
877
        }
878
    }
879
880
    if ($content == 'thread') {
881
        $tool_constant = TOOL_FORUM_THREAD;