Code Duplication    Length = 9-11 lines in 3 locations

main/newscorm/openoffice_document.class.php 2 locations

@@ 91-101 (lines=11) @@
88
            //var_dump( $this->base_work_dir.$this->created_dir.$this->file_path);
89
            $perm = api_get_setting('permissions_for_new_files');
90
91
            if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
92
                $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
93
                $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar';
94
                //$cmd = 'java -cp "'.$class_path.'" DokeosConverter';
95
                $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter';
96
            } else {
97
                $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
98
                //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar';
99
                $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
100
                $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter';
101
            }
102
103
            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
104
            // Call to the function implemented by child.
@@ 263-271 (lines=9) @@
260
        }
261
262
        if ($ppt2lpHost == 'localhost') {
263
            if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
264
                $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
265
                $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
266
                $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"';
267
            } else {
268
                $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
269
                $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar';
270
                $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' ';
271
            }
272
273
            $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
274
            // Call to the function implemented by child.

main/webservices/additional_webservices.php 1 location

@@ 43-51 (lines=9) @@
40
    $file = base64_decode($fileData);
41
    file_put_contents($tempPath . $fullFileName, $file);
42
43
    if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
44
        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
45
        $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
46
        $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter';
47
    } else {
48
        $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
49
        $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
50
        $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter';
51
    }
52
53
    $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
54
    $cmd .= ' -w 720 -h 540 -d oogie "' . $tempPath . $fullFileName.'"  "' . $tempPathNewFiles . $fileName . '.html"';