Code Duplication    Length = 21-21 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

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