Code Duplication    Length = 15-21 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 807-827 (lines=21) @@
804
    $tool_constant = null;
805
    $return_message = '';
806
807
    if ($content == 'forumcategory') {
808
        $tool_constant = TOOL_FORUM_CATEGORY;
809
        $return_message = get_lang('ForumCategoryDeleted');
810
811
        if (!empty($forum_list)) {
812
            $sql = "SELECT forum_id FROM ".$table_forums."
813
                    WHERE c_id = $course_id AND forum_category='".$id."'";
814
            $result = Database::query($sql);
815
            $row = Database::fetch_array($result);
816
            foreach ($row as $arr_forum) {
817
                $forum_id = $arr_forum['forum_id'];
818
                api_item_property_update(
819
                    $_course,
820
                    'forum',
821
                    $forum_id,
822
                    'delete',
823
                    api_get_user_id()
824
                );
825
            }
826
        }
827
    }
828
829
    if ($content == 'forum') {
830
        $tool_constant = TOOL_FORUM;
@@ 829-843 (lines=15) @@
826
        }
827
    }
828
829
    if ($content == 'forum') {
830
        $tool_constant = TOOL_FORUM;
831
        $return_message = get_lang('ForumDeleted');
832
833
        if (!empty($number_threads)) {
834
            $sql = "SELECT thread_id FROM".$table_forum_thread."
835
                    WHERE c_id = $course_id AND forum_id='".$id."'";
836
            $result = Database::query($sql);
837
            $row = Database::fetch_array($result);
838
            foreach ($row as $arr_forum) {
839
                $forum_id = $arr_forum['thread_id'];
840
                api_item_property_update($_course, 'forum_thread', $forum_id, 'delete', api_get_user_id());
841
            }
842
        }
843
    }
844
845
    if ($content == 'thread') {
846
        $tool_constant = TOOL_FORUM_THREAD;