Code Duplication    Length = 18-19 lines in 2 locations

main/inc/lib/system_announcements.lib.php 2 locations

@@ 397-414 (lines=18) @@
394
        $resultId = Database::insert($db_table, $params);
395
396
        if ($resultId) {
397
            if ($sendEmailTest) {
398
                self::send_system_announcement_by_email(
399
                    $title,
400
                    $content,
401
                    $visibility,
402
                    $lang,
403
                    true
404
                );
405
            } else {
406
                if ($send_mail == 1) {
407
                    self::send_system_announcement_by_email(
408
                        $title,
409
                        $content,
410
                        $visibility,
411
                        $lang
412
                    );
413
                }
414
            }
415
416
            if ($add_to_calendar) {
417
                $agenda = new Agenda('admin');
@@ 564-582 (lines=19) @@
561
        $content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
562
        $content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
563
564
        if ($sendEmailTest) {
565
            self::send_system_announcement_by_email(
566
                $title,
567
                $content,
568
                null,
569
                null,
570
                $lang,
571
                $sendEmailTest
572
            );
573
        } else {
574
            if ($send_mail == 1) {
575
                self::send_system_announcement_by_email(
576
                    $title,
577
                    $content,
578
                    $visibility,
579
                    $lang
580
                );
581
            }
582
        }
583
584
        $dateStart = new DateTime($start, new DateTimeZone('UTC'));
585
        $dateEnd = new DateTime($end, new DateTimeZone('UTC'));