Code Duplication    Length = 3-4 lines in 10 locations

main/document/create_audio.php 1 location

@@ 78-81 (lines=4) @@
75
76
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
77
78
if (!is_dir($filepath)) {
79
    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
80
    $dir = '/';
81
}
82
83
//groups //TODO: clean
84
if (!empty($groupId)) {

main/document/edit_paint.php 1 location

@@ 85-88 (lines=4) @@
82
83
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
84
85
if (!is_dir($filepath)) {
86
	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
87
	$dir = '/';
88
}
89
90
//groups //TODO:clean
91
if (!empty($groupId)) {

main/document/webcam_clip.php 1 location

@@ 66-69 (lines=4) @@
63
64
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
65
66
if (!is_dir($filepath)) {
67
	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
68
	$dir = '/';
69
}
70
71
$groupId = api_get_group_id();
72

main/document/create_draw.php 1 location

@@ 68-71 (lines=4) @@
65
66
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
67
68
if (!is_dir($filepath)) {
69
	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
70
	$dir = '/';
71
}
72
73
$groupId = api_get_group_id();
74

main/document/create_paint.php 1 location

@@ 72-75 (lines=4) @@
69
70
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
71
72
if (!is_dir($filepath)) {
73
	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
74
	$dir = '/';
75
}
76
77
$groupId = api_get_group_id();
78

main/document/edit_draw.php 1 location

@@ 82-85 (lines=4) @@
79
80
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
81
82
if (!is_dir($filepath)) {
83
	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
84
	$dir = '/';
85
}
86
87
//groups //TODO:clean
88
if (!empty($group_id)) {

main/document/record_audio.php 1 location

@@ 76-79 (lines=4) @@
73
74
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
75
76
if (!is_dir($filepath)) {
77
    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
78
    $dir = '/';
79
}
80
81
//groups //TODO: clean
82
if (!empty($groupId)) {

main/document/create_document.php 1 location

@@ 191-194 (lines=4) @@
188
189
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
190
191
if (!is_dir($filepath)) {
192
    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
193
    $dir = '/';
194
}
195
196
if (!$is_certificate_mode) {
197
    if (api_is_in_group()) {

main/lp/learnpath.class.php 2 locations

@@ 6386-6389 (lines=4) @@
6383
        }
6384
6385
        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/'.$dir;
6386
        if (!is_dir($filepath)) {
6387
            $dir = '/';
6388
            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/'.$dir;
6389
        }
6390
6391
        // stripslashes() before calling api_replace_dangerous_char() because $_POST['title']
6392
        // is already escaped twice when it gets here.
@@ 6534-6536 (lines=3) @@
6531
6532
        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6533
6534
        if (!is_dir($filepath)) {
6535
            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6536
        }
6537
6538
        $table_doc = Database::get_course_table(TABLE_DOCUMENT);
6539