Code Duplication    Length = 28-35 lines in 2 locations

main/plagiarism/compilatio/upload.php 2 locations

@@ 76-110 (lines=35) @@
73
                    $compilatioParameter['proxy_host'],
74
                    $compilatioParameter['proxy_port']);
75
76
                if ($compilatioParameter['mode_transport'] == 'wget') {
77
                    /*Compilatio's server recover tjre file throught wget like this:
78
                    username:password@http://somedomain.com/reg/remotefilename.tar.gz */
79
                    if (strlen($compilatioParameter['wget_uri']) > 2)  {
80
                        $filename = ereg_replace("/$",
81
                                "",
82
                                $compilatioParameter['wget_uri'])
83
                            . "/"
84
                            . $_course["path"]
85
                            . "/"
86
                            . $doc->url;
87
                    } else {
88
                        $filename = $WrkUrl;
89
                    }
90
                    if (strlen($compilatioParameter['wget_login']) > 2) {
91
                        $filename = $compilatioParameter['wget_login']
92
                            . ":"
93
                            . $compilatioParameter['wget_password']
94
                            . "@"
95
                            . $filename;
96
                    }
97
                    $mime = "text/plain";
98
                    $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, 'get_url');
99
                } else {
100
                    /* we use strictly the SOAP for the data trasmission */
101
                    $pieces = explode("/", $doc->url);
102
                    $nbPieces = count($pieces);
103
                    $filename = $pieces[$nbPieces - 1];
104
                    $compilatioId = $compilatio->sendDoc($doc->title,
105
                        '',
106
                        $filename,
107
                        $mime,
108
                        file_get_contents($LocalWrkUrl)
109
                    );
110
                }
111
                /*we associate in the database the document chamilo to the document compilatio*/
112
                $compTable = Database::get_course_table("plagiarism_compilatio_docs");
113
                $sql4 = "INSERT INTO "
@@ 175-202 (lines=28) @@
172
        $compilatioParameter['$urlsoap'],
173
        $compilatioParameter['proxy_host'],
174
        $compilatioParameter['proxy_port']);
175
	if ($compilatioParameter['mode_transport'] == 'wget') {
176
177
        if (strlen($compilatioParameter['wget_uri']) > 2) {
178
            $filename = ereg_replace("/$",
179
                    "",
180
                    $compilatioParameter['wget_uri'])
181
                    . "/"
182
                    . $_course["path"]
183
                    . "/"
184
                    . $doc->title;
185
        } else {
186
            $filename = $WrkUrl;
187
        }
188
        if (strlen($compilatioParameter['wget_login']) > 2) {
189
            $filename = $compilatioParameter['wget_login']
190
                . ":"
191
                . $compilatioParameter['wget_password']
192
                . "@"
193
                . $filename;
194
        }
195
        $mime = "text/plain";
196
        $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, 'get_url');
197
    } else {
198
		$pieces = explode("/", $doc->url);
199
		$nbPieces = count($pieces);
200
		$filename = $pieces[$nbPieces-1];
201
        $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, file_get_contents($LocalWrkUrl));
202
    }
203
	$compTable = Database::get_course_table("plagiarism_compilatio_docs");
204
205
	$sql4 = "INSERT INTO "