Code Duplication    Length = 7-9 lines in 3 locations

main/inc/lib/message.lib.php 3 locations

@@ 1346-1352 (lines=7) @@
1343
        $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'&nbsp;</a>';
1344
1345
        $date = '';
1346
        if ($main_message['send_date'] != $main_message['update_date']) {
1347
            if (!empty($main_message['update_date']) && $main_message['update_date'] != '0000-00-00 00:00:00') {
1348
                $date = '<div class="message-group-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
1349
            }
1350
        } else {
1351
            $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1352
        }
1353
        $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1354
        $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1355
        $main_content = Security::remove_XSS($main_content, STUDENT, true);
@@ 1390-1396 (lines=7) @@
1387
                $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
1388
1389
                $date = '';
1390
                if ($topic['send_date'] != $topic['update_date']) {
1391
                    if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') {
1392
                        $date = '<div class="message-group-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
1393
                    }
1394
                } else {
1395
                    $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1396
                }
1397
                $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1398
                $html_items.= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1399
@@ 1193-1201 (lines=9) @@
1190
                }
1191
1192
                $date = '';
1193
                if ($topic['send_date'] != $topic['update_date']) {
1194
                    if (!empty($topic['update_date']) &&
1195
                        $topic['update_date'] != '0000-00-00 00:00:00'
1196
                    ) {
1197
                        $date .= '<div class="message-group-date" > <i>'.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</i></div>';
1198
                    }
1199
                } else {
1200
                    $date .= '<div class="message-group-date"> <i>'.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</i></div>';
1201
                }
1202
                $html .= $date.$label.$actions;
1203
                $html .= '</div>';
1204