Code Duplication    Length = 21-21 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

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