Code Duplication    Length = 6-7 lines in 3 locations

main/document/document.php 1 location

@@ 43-49 (lines=7) @@
40
api_protect_course_group(GroupManager::GROUP_TOOL_DOCUMENTS);
41
DocumentManager::removeGeneratedAudioTempFile();
42
43
if (
44
    isset($_SESSION['temp_realpath_image']) &&
45
    !empty($_SESSION['temp_realpath_image']) &&
46
    file_exists($_SESSION['temp_realpath_image'])
47
) {
48
    unlink($_SESSION['temp_realpath_image']);
49
}
50
$_user = api_get_user_info();
51
$courseInfo = api_get_course_info();
52
$courseId = $courseInfo['real_id'];

main/work/download_comment_file.php 1 location

@@ 26-31 (lines=6) @@
23
$courseInfo = api_get_course_info();
24
25
if (!empty($workData)) {
26
    if (
27
        empty($workData['file_path']) ||
28
        (isset($workData['file_path']) && !file_exists($workData['file_path']))
29
    ) {
30
        api_not_allowed(true);
31
    }
32
33
    $work = get_work_data_by_id($workData['work_id']);
34

main/inc/lib/document.lib.php 1 location

@@ 4585-4591 (lines=7) @@
4582
     */
4583
    public static function removeGeneratedAudioTempFile()
4584
    {
4585
        if (isset($_SESSION['temp_audio_nanogong'])
4586
            && !empty($_SESSION['temp_audio_nanogong'])
4587
            && is_file($_SESSION['temp_audio_nanogong'])) {
4588
4589
            unlink($_SESSION['temp_audio_nanogong']);
4590
            unset($_SESSION['temp_audio_nanogong']);
4591
        }
4592
    }
4593
4594
    /**