Code Duplication    Length = 21-21 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

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