Code Duplication    Length = 7-9 lines in 3 locations

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

@@ 1185-1193 (lines=9) @@
1182
                }
1183
1184
                $date = '';
1185
                if ($topic['send_date'] != $topic['update_date']) {
1186
                    if (!empty($topic['update_date']) &&
1187
                        $topic['update_date'] != '0000-00-00 00:00:00'
1188
                    ) {
1189
                        $date .= '<div class="message-group-date" > <i>'.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</i></div>';
1190
                    }
1191
                } else {
1192
                    $date .= '<div class="message-group-date"> <i>'.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</i></div>';
1193
                }
1194
                $html .= $date.$label.$actions;
1195
                $html .= '</div>';
1196
@@ 1338-1344 (lines=7) @@
1335
        $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'&nbsp;</a>';
1336
1337
        $date = '';
1338
        if ($main_message['send_date'] != $main_message['update_date']) {
1339
            if (!empty($main_message['update_date']) && $main_message['update_date'] != '0000-00-00 00:00:00') {
1340
                $date = '<div class="message-group-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
1341
            }
1342
        } else {
1343
            $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1344
        }
1345
        $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1346
        $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1347
        $main_content = Security::remove_XSS($main_content, STUDENT, true);
@@ 1382-1388 (lines=7) @@
1379
                $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
1380
1381
                $date = '';
1382
                if ($topic['send_date'] != $topic['update_date']) {
1383
                    if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') {
1384
                        $date = '<div class="message-group-date"> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
1385
                    }
1386
                } else {
1387
                    $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1388
                }
1389
                $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1390
                $html_items.= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1391