Code Duplication    Length = 6-11 lines in 2 locations

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

@@ 311-316 (lines=6) @@
308
                                            );
309
310
                                            // Try with the dirname if exists
311
                                            if ($old_src_fixed == $old_src) {
312
                                                if (file_exists($dirName.'/'.$old_src)) {
313
                                                    $document_path = '';
314
                                                    $old_src_fixed = $dirName.'/'.$old_src;
315
                                                }
316
                                            }
317
                                        } else {
318
                                            if (strpos($old_src, 'courses/'.$course_data['path'].'/document/') !== false) {
319
                                                $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src);
@@ 320-330 (lines=11) @@
317
                                        } else {
318
                                            if (strpos($old_src, 'courses/'.$course_data['path'].'/document/') !== false) {
319
                                                $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src);
320
                                            } else {
321
                                                // Try with the dirname if exists
322
                                                if (file_exists($dirName.'/'.$old_src)) {
323
                                                    $document_path = '';
324
                                                    $old_src_fixed = $dirName.'/'.$old_src;
325
                                                } else {
326
                                                    $document_path = '';
327
                                                    $old_src_fixed = $old_src;
328
                                                }
329
                                            }
330
                                        }
331
332
                                        $new_path = $document_path.$old_src_fixed;
333
                                    } else {