Code Duplication    Length = 5-7 lines in 2 locations

main/forum/forumfunction.inc.php 2 locations

@@ 2568-2572 (lines=5) @@
2565
2566
    $post_date = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
2567
2568
    if ($current_forum['approval_direct_post'] == '1' && !api_is_allowed_to_edit(null, true)) {
2569
        $visible = 0; // The post has not been approved yet.
2570
    } else {
2571
        $visible = 1;
2572
    }
2573
    $clean_post_title = $values['post_title'];
2574
    // We first store an entry in the forum_thread table because the thread_id is used in the forum_post table.
2575
@@ 3365-3371 (lines=7) @@
3362
    $post_date = api_get_utc_datetime();
3363
    $userId = $userId ?: api_get_user_id();
3364
3365
    if ($current_forum['approval_direct_post'] == '1' &&
3366
        !api_is_allowed_to_edit(null, true)
3367
    ) {
3368
        $visible = 0;
3369
    } else {
3370
        $visible = 1;
3371
    }
3372
3373
    $upload_ok = 1;
3374
    $return = array();