Code Duplication    Length = 10-12 lines in 2 locations

main/exercice/export/aiken/aiken_import.inc.php 1 location

@@ 23-32 (lines=10) @@
20
 * @param int $mode
21
 * @return string
22
 */
23
function tempdir($dir, $prefix = 'tmp', $mode = 0777) {
24
    if (substr($dir, -1) != '/')
25
        $dir .= '/';
26
27
    do {
28
        $path = $dir . $prefix . mt_rand(0, 9999999);
29
    } while (!mkdir($path, $mode));
30
31
    return $path;
32
}
33
34
/**
35
 * This function displays the form for import of the zip file with qti2

main/exercice/export/exercise_import.inc.php 1 location

@@ 16-27 (lines=12) @@
13
/**
14
 * function to create a temporary directory (SAME AS IN MODULE ADMIN)
15
 */
16
function tempdir($dir, $prefix = 'tmp', $mode = 0777)
17
{
18
    if (substr($dir, -1) != '/') {
19
        $dir .= '/';
20
    }
21
22
    do {
23
        $path = $dir.$prefix.mt_rand(0, 9999999);
24
    } while (!mkdir($path, $mode));
25
26
    return $path;
27
}
28
29
/**
30
 * Unzip the exercise in the temp folder