@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | |
6 | 6 | if (isset($_GET['workid'])) { |
7 | 7 | $compTable = Database::get_course_table("plagiarism_compilatio_docs"); |
8 | - $workIdList = $_GET['workid']; // list of workid separate by the : |
|
8 | + $workIdList = $_GET['workid']; // list of workid separate by the : |
|
9 | 9 | $result = ""; |
10 | - $tabWorkId = split("a", $workIdList); |
|
11 | - for ($i=0; $i < count($tabWorkId); $i++) { |
|
10 | + $tabWorkId = split("a", $workIdList); |
|
11 | + for ($i = 0; $i < count($tabWorkId); $i++) { |
|
12 | 12 | if (is_numeric($tabWorkId[$i])) { |
13 | 13 | $result .= giveWorkIdState($tabWorkId[$i]); |
14 | 14 | } |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | $compi = Database::fetch_object($compiSqlResult); |
42 | 42 | if (isset($compi->compilatio_id)) { |
43 | 43 | $actionCompilatio = ""; |
44 | - if(isMd5($compi->compilatio_id)) { |
|
44 | + if (isMd5($compi->compilatio_id)) { |
|
45 | 45 | // if compilatio_id is a hash md5, we call the function of the compilatio's webservice who return the document's status |
46 | 46 | |
47 | 47 | $soapRes = $compilatio->getDoc($compi->compilatio_id); |
48 | 48 | $status = ''; |
49 | - if(isset($soapRes->documentStatus)) { |
|
49 | + if (isset($soapRes->documentStatus)) { |
|
50 | 50 | $status = $soapRes->documentStatus->status; |
51 | 51 | } |
52 | 52 | } else { |
53 | 53 | // if the compilatio's hash is not a valide hash md5, we return à specific status (cf : IsInCompilatio() ) |
54 | - $status="NOT_IN_COMPILATIO"; |
|
54 | + $status = "NOT_IN_COMPILATIO"; |
|
55 | 55 | $actionCompilatio = "<div style='font-style:italic'>" |
56 | 56 | . get_lang('compilatioDocumentTextNotImage') |
57 | 57 | . "<br/>" |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $urlRapport = $compilatio->getReportUrl($compi->compilatio_id); |
64 | 64 | $actionCompilatio .= getPomprankBarv31( |
65 | 65 | $soapRes->documentStatus->indice, |
66 | - 10 , |
|
66 | + 10, |
|
67 | 67 | 35, |
68 | 68 | $compilatioImgFolder, |
69 | 69 | $text |
@@ -91,29 +91,29 @@ discard block |
||
91 | 91 | ); |
92 | 92 | } |
93 | 93 | elseif ($status == "ANALYSE_IN_QUEUE") { |
94 | - $actionCompilatio.="<img src='" |
|
94 | + $actionCompilatio .= "<img src='" |
|
95 | 95 | . $compilatioImgFolder |
96 | 96 | . "/ajax-loader2.gif' style='margin-right:10px;' />" |
97 | 97 | . get_lang('compilatioAwaitingAnalysis'); |
98 | 98 | } elseif ($status == "BAD_FILETYPE") { |
99 | - $actionCompilatio.= "<div style='font-style:italic'>" |
|
99 | + $actionCompilatio .= "<div style='font-style:italic'>" |
|
100 | 100 | . get_lang('compilatioFileisnotsupported') |
101 | 101 | . "<br/>" |
102 | 102 | . get_lang('compilatioProtectedPdfVerification') |
103 | 103 | . "</div>"; |
104 | 104 | } elseif ($status == "BAD_FILESIZE") { |
105 | - $actionCompilatio.= "<div style='font-style:italic'>" |
|
105 | + $actionCompilatio .= "<div style='font-style:italic'>" |
|
106 | 106 | . get_lang('compilatioTooHeavyDocument') |
107 | 107 | . "</div>"; |
108 | 108 | } elseif ($status != "NOT_IN_COMPILATIO") { |
109 | - $actionCompilatio.= "<div style='font-style:italic'>" |
|
109 | + $actionCompilatio .= "<div style='font-style:italic'>" |
|
110 | 110 | . get_lang('compilatioMomentarilyUnavailableResult') |
111 | 111 | . " : [ " |
112 | 112 | . $status |
113 | 113 | . "].</div>"; |
114 | 114 | } |
115 | 115 | } |
116 | - $result = $workId . "|" . $actionCompilatio . "|" . $status . "|"; |
|
116 | + $result = $workId."|".$actionCompilatio."|".$status."|"; |
|
117 | 117 | |
118 | 118 | return $result; |
119 | 119 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | |
16 | 16 | /* Variables */ |
17 | 17 | $typeMessage = 0; |
18 | -$errorCodeNotValid = get_lang('compilatioError') . get_lang('documentCodeNotValid'); |
|
19 | -$errorLoadError = get_lang('compilatioLoadError') . get_lang('compilatioContactAdmin'); |
|
18 | +$errorCodeNotValid = get_lang('compilatioError').get_lang('documentCodeNotValid'); |
|
19 | +$errorLoadError = get_lang('compilatioLoadError').get_lang('compilatioContactAdmin'); |
|
20 | 20 | |
21 | 21 | /*message to the user for be patient*/ |
22 | 22 | $msgWait = get_lang('PleaseWaitThisCouldTakeAWhile'); |
23 | 23 | |
24 | 24 | /* if we have to upload severals documents*/ |
25 | -if(isset($_REQUEST['type']) && $_REQUEST['type']=="multi"){ |
|
25 | +if (isset($_REQUEST['type']) && $_REQUEST['type'] == "multi") { |
|
26 | 26 | $docs = preg_split("/a/", $_REQUEST['doc']); |
27 | - for ($k=0 ; $k < sizeof($docs)-1 ; $k++) { |
|
27 | + for ($k = 0; $k < sizeof($docs) - 1; $k++) { |
|
28 | 28 | /* We have to modify the timeout server for send the heavy files */ |
29 | 29 | set_time_limit(600); |
30 | 30 | $documentId = 0; |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | $doc = Database::fetch_object($sqlResult); |
63 | 63 | if ($doc) { |
64 | 64 | /*We load the document in compilatio through the webservice */ |
65 | - $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/"; |
|
66 | - $WrkUrl = $currentCourseRepositoryWeb . $doc->url; |
|
67 | - $LocalWrkUrl = api_get_path(SYS_COURSE_PATH) . $_course["path"] . "/" . $doc->url; |
|
65 | + $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH).$_course["path"]."/"; |
|
66 | + $WrkUrl = $currentCourseRepositoryWeb.$doc->url; |
|
67 | + $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"]."/".$doc->url; |
|
68 | 68 | $LocalWrkTitle = $doc->title; |
69 | 69 | $mime = typeMime($LocalWrkTitle); |
70 | 70 | $compilatio = new compilatio( |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if ($compilatioParameter['mode_transport'] == 'wget') { |
77 | 77 | /*Compilatio's server recover tjre file throught wget like this: |
78 | 78 | username:password@http://somedomain.com/reg/remotefilename.tar.gz */ |
79 | - if (strlen($compilatioParameter['wget_uri']) > 2) { |
|
79 | + if (strlen($compilatioParameter['wget_uri']) > 2) { |
|
80 | 80 | $filename = ereg_replace("/$", |
81 | 81 | "", |
82 | 82 | $compilatioParameter['wget_uri']) |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | if ($typeMessage == 1) { |
141 | 141 | $message = $errorCodeNotValid; |
142 | 142 | Display::display_error_message($message); |
143 | - }elseif($typeMessage == 2){ |
|
143 | + }elseif ($typeMessage == 2) { |
|
144 | 144 | $message = $errorLoadError; |
145 | 145 | Display::display_error_message($message); |
146 | - }else{ |
|
146 | + } else { |
|
147 | 147 | $message = $msgWait; |
148 | 148 | Display::display_confirmation_message($message); |
149 | 149 | } |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | . $coursId; |
163 | 163 | $sqlResult = Database::query($query); |
164 | 164 | $doc = Database::fetch_object($sqlResult); |
165 | - $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/"; |
|
166 | - $WrkUrl = $currentCourseRepositoryWeb . $doc->url; |
|
165 | + $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH).$_course["path"]."/"; |
|
166 | + $WrkUrl = $currentCourseRepositoryWeb.$doc->url; |
|
167 | 167 | $WrkTitle = $doc->title; |
168 | - $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"] . "/" . $doc->url; |
|
168 | + $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"]."/".$doc->url; |
|
169 | 169 | $mime = typeMime($WrkTitle); |
170 | 170 | $compilatio = new compilatio( |
171 | 171 | $compilatioParameter['key'], |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } else { |
198 | 198 | $pieces = explode("/", $doc->url); |
199 | 199 | $nbPieces = count($pieces); |
200 | - $filename = $pieces[$nbPieces-1]; |
|
200 | + $filename = $pieces[$nbPieces - 1]; |
|
201 | 201 | $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, file_get_contents($LocalWrkUrl)); |
202 | 202 | } |
203 | 203 | $compTable = Database::get_course_table("plagiarism_compilatio_docs"); |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | if ($typeMessage == 1) { |
234 | 234 | $message = $errorCodeNotValid; |
235 | 235 | Display::display_error_message($message); |
236 | - }elseif($typeMessage == 2){ |
|
236 | + }elseif ($typeMessage == 2) { |
|
237 | 237 | $message = $errorLoadError; |
238 | 238 | Display::display_error_message($message); |
239 | - }else{ |
|
239 | + } else { |
|
240 | 240 | $message = $msgWait; |
241 | 241 | Display::display_confirmation_message($message); |
242 | 242 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | function getWorkTitle($docId, $coursId) { |
269 | 269 | $res = ""; |
270 | 270 | $workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION); |
271 | - $sql = "SELECT title FROM " . $workTable . " WHERE c_id=" . $coursId . " AND id=" . $docId; |
|
271 | + $sql = "SELECT title FROM ".$workTable." WHERE c_id=".$coursId." AND id=".$docId; |
|
272 | 272 | $res = Database::query($sql); |
273 | 273 | if (Database::num_rows($res) > 0) { |
274 | 274 | $data = Database::fetch_array($res); |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | $filename = getFilename($urlFile); |
313 | 313 | $work_folder = getWorkFolder($urlFile); |
314 | 314 | $urlFile_ext = getFileExtension($urlFile); |
315 | - $coursePath = api_get_path(SYS_COURSE_PATH) . $_course["path"] . "/"; |
|
315 | + $coursePath = api_get_path(SYS_COURSE_PATH).$_course["path"]."/"; |
|
316 | 316 | $workTitle = getWorkTitle($docId, $coursId); |
317 | 317 | |
318 | 318 | if ($extensionFile != "" && $urlFile_ext == "") { |
319 | 319 | /*rename the files in the FS whit the extension*/ |
320 | 320 | $shortFilename = $filename; |
321 | 321 | $cleanWorkTitle = api_replace_dangerous_char($workTitle); |
322 | - $newestFilename = $shortFilename . "_" . $cleanWorkTitle; |
|
323 | - rename($coursePath . $urlFile, $coursePath . $work_folder . $newestFilename); |
|
322 | + $newestFilename = $shortFilename."_".$cleanWorkTitle; |
|
323 | + rename($coursePath.$urlFile, $coursePath.$work_folder.$newestFilename); |
|
324 | 324 | /*rename the db's input with the extension*/ |
325 | 325 | $sql = "UPDATE " |
326 | 326 | . $workTable |