Completed
Pull Request — 1.10.x (#1244)
by
unknown
42:26
created
main/plagiarism/compilatio/compilatio.class.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @param $pour
227 227
 	 * @param $imagesPath
228 228
 	 * @param $text  Array includes the extract from the text
229
-	 * @return unknown_type
229
+	 * @return string|null
230 230
 	 */
231 231
 	function getProgressionAnalyseDocv31($status, $pour = 0, $imagesPath = '', $text = '')
232 232
 	{
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 	 * Method for display the PomprseuilmankBar (% de plagiat)
282 282
 	 *
283 283
 	 * @param $percentagePumping
284
-	 * @param $weakThreshold
285
-	 * @param $highThreshold
284
+	 * @param integer $weakThreshold
285
+	 * @param integer $highThreshold
286 286
 	 * @param $imagesPath
287 287
 	 * @param $text : array  includes the extract from the text
288
-	 * @return unknown_type
288
+	 * @return string
289 289
 	 */
290 290
 	function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') {
291 291
 
Please login to merge, or discard this patch.
Indentation   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-	/**
3
-	 * Description:
4
-	 * build the comunication with the SOAP server Compilatio.net
5
-	 * call severals methods for the file management in Compilatio.net
6
-	 *
7
-	 * Date: 26/05/16
8
-	 * @version:1.0
9
-	 */
2
+    /**
3
+     * Description:
4
+     * build the comunication with the SOAP server Compilatio.net
5
+     * call severals methods for the file management in Compilatio.net
6
+     *
7
+     * Date: 26/05/16
8
+     * @version:1.0
9
+     */
10 10
 
11
-	class compilatio
12
-	{
13
-		/*Identification key for the Compilatio account*/
14
-		var $key  = null;
15
-		/*Webservice connection*/
16
-		var $soapcli;
11
+    class compilatio
12
+    {
13
+        /*Identification key for the Compilatio account*/
14
+        var $key  = null;
15
+        /*Webservice connection*/
16
+        var $soapcli;
17 17
 
18 18
         /**
19 19
          * compilatio constructor.
@@ -22,338 +22,338 @@  discard block
 block discarded – undo
22 22
          * @param $proxyHost
23 23
          * @param $proxyPort
24 24
          */
25
-		function compilatio($key, $urlsoap, $proxyHost, $proxyPort)
26
-		{
27
-			try
28
-			{
29
-				if(!empty($key)){
30
-					$this->key = $key;
31
-					if(!empty($urlsoap)){
32
-						if(!empty($proxyHost)) {
33
-							$param = array('trace' => false,
34
-								'soap_version' => SOAP_1_2,
35
-								'exceptions' => true,
36
-								'proxy_host' => '"' . $proxyHost . '"',
37
-								'proxy_port' => $proxyPort);
38
-						} else {
39
-							$param = array('trace' => false,
40
-								'soap_version' => SOAP_1_2,
41
-								'exceptions' => true);
42
-						}
43
-						$this->soapcli = new SoapClient($urlsoap,$param);
44
-					}else{
45
-						$this->soapcli = 'WS urlsoap not available' ;
46
-					}
47
-				}else{
48
-					$this->soapcli ='API key not available';
49
-				}
50
-			}
51
-			catch (SoapFault $fault)
52
-			{
53
-				$this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ;
54
-			}
55
-			catch (Exception $e) {
56
-				$this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap;
57
-			}
58
-		}
25
+        function compilatio($key, $urlsoap, $proxyHost, $proxyPort)
26
+        {
27
+            try
28
+            {
29
+                if(!empty($key)){
30
+                    $this->key = $key;
31
+                    if(!empty($urlsoap)){
32
+                        if(!empty($proxyHost)) {
33
+                            $param = array('trace' => false,
34
+                                'soap_version' => SOAP_1_2,
35
+                                'exceptions' => true,
36
+                                'proxy_host' => '"' . $proxyHost . '"',
37
+                                'proxy_port' => $proxyPort);
38
+                        } else {
39
+                            $param = array('trace' => false,
40
+                                'soap_version' => SOAP_1_2,
41
+                                'exceptions' => true);
42
+                        }
43
+                        $this->soapcli = new SoapClient($urlsoap,$param);
44
+                    }else{
45
+                        $this->soapcli = 'WS urlsoap not available' ;
46
+                    }
47
+                }else{
48
+                    $this->soapcli ='API key not available';
49
+                }
50
+            }
51
+            catch (SoapFault $fault)
52
+            {
53
+                $this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ;
54
+            }
55
+            catch (Exception $e) {
56
+                $this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap;
57
+            }
58
+        }
59 59
 
60 60
 
61
-		/**
62
-		 * Method for the file load
63
-		 *
64
-		 * @param $title
65
-		 * @param $description
66
-		 * @param $filename
61
+        /**
62
+         * Method for the file load
63
+         *
64
+         * @param $title
65
+         * @param $description
66
+         * @param $filename
67 67
          * @param $mimeType
68
-		 * @param $content
69
-		 * @return string
70
-		 */
68
+         * @param $content
69
+         * @return string
70
+         */
71 71
         function sendDoc($title, $description, $filename, $mimeType, $content)
72
-		{
73
-			try
74
-			{
75
-				if (!is_object($this->soapcli))
76
-					return("Error in constructor compilatio() " . $this->soapcli);
77
-				$idDocument = $this->soapcli->__call('addDocumentBase64',
78
-					array(
79
-						$this->key,
80
-						utf8_encode(urlencode($title)),
81
-						utf8_encode(urlencode($description)),
82
-						utf8_encode(urlencode($filename)),
72
+        {
73
+            try
74
+            {
75
+                if (!is_object($this->soapcli))
76
+                    return("Error in constructor compilatio() " . $this->soapcli);
77
+                $idDocument = $this->soapcli->__call('addDocumentBase64',
78
+                    array(
79
+                        $this->key,
80
+                        utf8_encode(urlencode($title)),
81
+                        utf8_encode(urlencode($description)),
82
+                        utf8_encode(urlencode($filename)),
83 83
                         utf8_encode($mimeType),
84
-						base64_encode($content)
85
-					)
86
-				);
87
-				return $idDocument;
88
-			}
89
-			catch (SoapFault $fault)
90
-			{
84
+                        base64_encode($content)
85
+                    )
86
+                );
87
+                return $idDocument;
88
+            }
89
+            catch (SoapFault $fault)
90
+            {
91 91
                 return("Erreur sendDoc()" . $fault->faultcode ." " .$fault->faultstring);
92
-			}
93
-		}
92
+            }
93
+        }
94 94
 
95 95
 
96
-		/**
97
-		 * Method for recover a document's information
98
-		 * @param $compiHash
99
-		 * @return string
100
-		 */
96
+        /**
97
+         * Method for recover a document's information
98
+         * @param $compiHash
99
+         * @return string
100
+         */
101 101
         function getDoc($compiHash)
102
-		{
103
-			try
104
-			{
105
-				if (!is_object($this->soapcli)){
106
-					return("Error in constructor compilatio() " . $this->soapcli);
107
-				}
108
-				$param = array($this->key, $compiHash);
109
-				$idDocument = $this->soapcli->__call('getDocument', $param);
110
-				return $idDocument;
111
-			}
112
-			catch (SoapFault $fault)
113
-			{
102
+        {
103
+            try
104
+            {
105
+                if (!is_object($this->soapcli)){
106
+                    return("Error in constructor compilatio() " . $this->soapcli);
107
+                }
108
+                $param = array($this->key, $compiHash);
109
+                $idDocument = $this->soapcli->__call('getDocument', $param);
110
+                return $idDocument;
111
+            }
112
+            catch (SoapFault $fault)
113
+            {
114 114
                 return("Erreur getDoc()" . $fault->faultcode . " " .$fault->faultstring);
115
-			}
116
-		}
115
+            }
116
+        }
117 117
 
118
-		/**
119
-		 * method for recover an url document's report
120
-		 * @param $compiHash
121
-		 * @return string
122
-		 */
118
+        /**
119
+         * method for recover an url document's report
120
+         * @param $compiHash
121
+         * @return string
122
+         */
123 123
         function getReportUrl($compiHash)
124
-		{
125
-			try
126
-			{
127
-				if (!is_object($this->soapcli)){
128
-					return("Error in constructor compilatio() " . $this->soapcli);
129
-				}
130
-				$param = array($this->key,$compiHash);
131
-				$idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
132
-				return $idDocument;
133
-			}
134
-			catch (SoapFault $fault)
135
-			{
124
+        {
125
+            try
126
+            {
127
+                if (!is_object($this->soapcli)){
128
+                    return("Error in constructor compilatio() " . $this->soapcli);
129
+                }
130
+                $param = array($this->key,$compiHash);
131
+                $idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
132
+                return $idDocument;
133
+            }
134
+            catch (SoapFault $fault)
135
+            {
136 136
                 return("Erreur  getReportUrl()" . $fault->faultcode ." " .$fault->faultstring);
137
-			}
138
-		}
137
+            }
138
+        }
139 139
 
140
-		/**
141
-		 *  Method for deleting a Compialtio's account document
142
-		 * @param $compiHash
143
-		 * @return string
144
-		 */
140
+        /**
141
+         *  Method for deleting a Compialtio's account document
142
+         * @param $compiHash
143
+         * @return string
144
+         */
145 145
         function deldoc($compiHash)
146
-		{
147
-			try
148
-			{
149
-				if (!is_object($this->soapcli)){
150
-					return("Error in constructor compilatio() " . $this->soapcli);
151
-				}
152
-				$param = array($this->key,$compiHash);
153
-				$this->soapcli->__call('deleteDocument', $param);
154
-			}
155
-			catch (SoapFault $fault)
156
-			{
146
+        {
147
+            try
148
+            {
149
+                if (!is_object($this->soapcli)){
150
+                    return("Error in constructor compilatio() " . $this->soapcli);
151
+                }
152
+                $param = array($this->key,$compiHash);
153
+                $this->soapcli->__call('deleteDocument', $param);
154
+            }
155
+            catch (SoapFault $fault)
156
+            {
157 157
                 return("Erreur  deldoc()" . $fault->faultcode . " " .$fault->faultstring);
158
-			}
159
-		}
158
+            }
159
+        }
160 160
 
161
-		/**
162
-		 * Method for start the analysis for a document
163
-		 * @param $compiHash
164
-		 * @return string
165
-		 */
161
+        /**
162
+         * Method for start the analysis for a document
163
+         * @param $compiHash
164
+         * @return string
165
+         */
166 166
         function startAnalyse($compiHash)
167
-		{
168
-			try
169
-			{
170
-				if (!is_object($this->soapcli)){
171
-					return("Error in constructor compilatio() " . $this->soapcli);
172
-				}
173
-				$param = array($this->key,$compiHash);
167
+        {
168
+            try
169
+            {
170
+                if (!is_object($this->soapcli)){
171
+                    return("Error in constructor compilatio() " . $this->soapcli);
172
+                }
173
+                $param = array($this->key,$compiHash);
174 174
                 $this->soapcli->__call('startDocumentAnalyse', $param);
175
-			}
176
-			catch (SoapFault $fault)
177
-			{
175
+            }
176
+            catch (SoapFault $fault)
177
+            {
178 178
                 return("Erreur  startAnalyse()" . $fault->faultcode ." " .$fault->faultstring);
179
-			}
180
-		}
179
+            }
180
+        }
181 181
 
182
-		/**
183
-		 * Method for recover the account's quota
184
-		 * @return string
185
-		 */
182
+        /**
183
+         * Method for recover the account's quota
184
+         * @return string
185
+         */
186 186
         function getQuotas()
187
-		{
188
-			try
189
-			{
190
-				if (!is_object($this->soapcli)){
191
-					return("Error in constructor compilatio() " . $this->soapcli);
192
-				}
193
-				$param=array($this->key);
187
+        {
188
+            try
189
+            {
190
+                if (!is_object($this->soapcli)){
191
+                    return("Error in constructor compilatio() " . $this->soapcli);
192
+                }
193
+                $param=array($this->key);
194 194
                 $resultat=$this->soapcli->__call('getAccountQuotas', $param);
195
-				return $resultat;
196
-			}
197
-			catch (SoapFault $fault)
198
-			{
195
+                return $resultat;
196
+            }
197
+            catch (SoapFault $fault)
198
+            {
199 199
                 return("Erreur  getQuotas()" . $fault->faultcode ." " .$fault->faultstring);
200
-			}
201
-		}
200
+            }
201
+        }
202 202
 
203
-	}
203
+    }
204 204
 
205
-	/**
206
-	 * Method for identify a file extension and the possibility that the document can be managed by Compilatio
207
-	 * @param $filename
208
-	 * @return bool
209
-	 */
205
+    /**
206
+     * Method for identify a file extension and the possibility that the document can be managed by Compilatio
207
+     * @param $filename
208
+     * @return bool
209
+     */
210 210
     function verifiFileType($filename)
211
-	{
212
-		$types = array("doc","docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html");
213
-		$extension = substr($filename, strrpos($filename, ".")+1);
214
-		$extension = strtolower($extension);
215
-		if (in_array($extension, $types)) {
216
-			return true;
217
-		} else {
218
-			return false;
219
-		}
220
-	}
211
+    {
212
+        $types = array("doc","docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html");
213
+        $extension = substr($filename, strrpos($filename, ".")+1);
214
+        $extension = strtolower($extension);
215
+        if (in_array($extension, $types)) {
216
+            return true;
217
+        } else {
218
+            return false;
219
+        }
220
+    }
221 221
 
222
-	/**
223
-	 * Fonction  affichage de la barre de progression d'analyse version 3.1
224
-	 *
225
-	 * @param $statut From the document
226
-	 * @param $pour
227
-	 * @param $imagesPath
228
-	 * @param $text  Array includes the extract from the text
229
-	 * @return unknown_type
230
-	 */
231
-	function getProgressionAnalyseDocv31($status, $pour = 0, $imagesPath = '', $text = '')
232
-	{
222
+    /**
223
+     * Fonction  affichage de la barre de progression d'analyse version 3.1
224
+     *
225
+     * @param $statut From the document
226
+     * @param $pour
227
+     * @param $imagesPath
228
+     * @param $text  Array includes the extract from the text
229
+     * @return unknown_type
230
+     */
231
+    function getProgressionAnalyseDocv31($status, $pour = 0, $imagesPath = '', $text = '')
232
+    {
233 233
 
234
-		$refreshReturn = "<a href='javascript:window.location.reload(false);'><img src='"
235
-			.$imagesPath
236
-			."ajax-loader_green.gif' title='"
237
-			. $text['refresh']
238
-			. "' alt='"
239
-			. $text['refresh']
240
-			. "'/></a> ";
234
+        $refreshReturn = "<a href='javascript:window.location.reload(false);'><img src='"
235
+            .$imagesPath
236
+            ."ajax-loader_green.gif' title='"
237
+            . $text['refresh']
238
+            . "' alt='"
239
+            . $text['refresh']
240
+            . "'/></a> ";
241 241
         $startReturn = "<table cellpadding='0' cellspacing='0' style='border:0;margin:0;padding:0;'><tr>";
242 242
         $startReturn .= "<td width='25' style='border:0;margin:0;padding:0;'>&nbsp;</td>";
243 243
         $startReturn .= "<td valign='middle' align='right' style='border:0;margin:0;padding-right:10px;'>"
244
-			.$refreshReturn
245
-			."</td>";
244
+            .$refreshReturn
245
+            ."</td>";
246 246
         $startReturn .= "<td style='border:0;margin:0;padding:0;'>";
247 247
         $startReturnLittleWidth = "<table cellpadding='0' cellspacing='0' style='border:0;margin:0;padding:0;'><tr>";
248 248
         $startReturnLittleWidth .= "<td width='25' valign='middle' align='right' style='border:0;margin:0;padding:0;'>"
249
-			.$refreshReturn
250
-			."</td>";
251
-		$finretour = "</td></tr></table>";
252
-		if($status == "ANALYSE_IN_QUEUE" ){
253
-			return $startReturn . "<span style='font-size:11px'>" . $text['analysisinqueue'] . "</span>" . $finretour;
254
-		}
255
-		if($status == "ANALYSE_PROCESSING" ){
256
-			if($pour == 100){
257
-				return $startReturn
258
-				. "<span style='font-size:11px'>"
259
-				. $text['analysisinfinalization']
260
-				. "</span>"
261
-				. $finretour;
262
-			} else {
263
-				return $startReturnLittleWidth
249
+            .$refreshReturn
250
+            ."</td>";
251
+        $finretour = "</td></tr></table>";
252
+        if($status == "ANALYSE_IN_QUEUE" ){
253
+            return $startReturn . "<span style='font-size:11px'>" . $text['analysisinqueue'] . "</span>" . $finretour;
254
+        }
255
+        if($status == "ANALYSE_PROCESSING" ){
256
+            if($pour == 100){
257
+                return $startReturn
258
+                . "<span style='font-size:11px'>"
259
+                . $text['analysisinfinalization']
260
+                . "</span>"
261
+                . $finretour;
262
+            } else {
263
+                return $startReturnLittleWidth
264 264
                     . "<td align=\"right\" style=\"border:0;margin:0;padding-right:10px;\">"
265
-				. $pour
265
+                . $pour
266 266
                     . "%</td><td style=\"border:0;margin:0;padding:0;\"><div style=\"background"
267
-				. ":transparent url("
268
-				. $imagesPath
269
-				. "mini-jauge_fond.png) no-repeat scroll 0;height:12px;padding:0 0 0 2px;width:55px;\"><div style=\""
270
-				. "background:transparent url("
271
-				. $imagesPath
272
-				. "mini-jauge_gris.png) no-repeat scroll 0;height:12px;width:"
273
-				. $pour/2
274
-				. "px;\"></div></div>"
275
-				. $finretour;
276
-			}
277
-		}
278
-	}
267
+                . ":transparent url("
268
+                . $imagesPath
269
+                . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;padding:0 0 0 2px;width:55px;\"><div style=\""
270
+                . "background:transparent url("
271
+                . $imagesPath
272
+                . "mini-jauge_gris.png) no-repeat scroll 0;height:12px;width:"
273
+                . $pour/2
274
+                . "px;\"></div></div>"
275
+                . $finretour;
276
+            }
277
+        }
278
+    }
279 279
 
280
-	/**
281
-	 * Method for display the PomprseuilmankBar (% de plagiat)
282
-	 *
283
-	 * @param $percentagePumping
284
-	 * @param $weakThreshold
285
-	 * @param $highThreshold
286
-	 * @param $imagesPath
287
-	 * @param $text : array  includes the extract from the text
288
-	 * @return unknown_type
289
-	 */
290
-	function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') {
280
+    /**
281
+     * Method for display the PomprseuilmankBar (% de plagiat)
282
+     *
283
+     * @param $percentagePumping
284
+     * @param $weakThreshold
285
+     * @param $highThreshold
286
+     * @param $imagesPath
287
+     * @param $text : array  includes the extract from the text
288
+     * @return unknown_type
289
+     */
290
+    function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') {
291 291
 
292
-		$pourcentagePompage = round($pourcentagePompage);
293
-		$pour = round((50*$pourcentagePompage)/100);
294
-		$return = "";
295
-		$couleur = "";
296
-		if($pourcentagePompage < $weakThreshold) {
297
-			$couleur = "vert";
298
-		} else if($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) {
299
-			$couleur = "orange";
300
-		} else {
301
-			$couleur = "rouge";
302
-		}
303
-		$return .= "<div style='float:left;margin-right:2px;'><img src='"
304
-			. $chemin_images."mini-drapeau_$couleur.png' title='"
305
-			. $texte['result']
306
-			. "' alt='faible' width='15' height='15' /></div>";
307
-		$return .= "<div style='float:left; margin-right:5px;width:45px;text-align:right;'>"
308
-			. $pourcentagePompage
309
-			. " %</div>";
310
-		$return .= "<div style='float:left;background:transparent url("
311
-			. $chemin_images
312
-			. "mini-jauge_fond.png) no-repeat scroll 0;height:12px;margin-top:5px;padding:0 0 0 2px;width:55px;'>";
313
-		$return .= "<div style='float:left;background:transparent url("
314
-			. $chemin_images
315
-			. "mini-jauge_"
316
-			. $couleur
317
-			. ".png) no-repeat scroll 0;height:12px;width:"
318
-			. $pour
319
-			. "px'></div></div>";
292
+        $pourcentagePompage = round($pourcentagePompage);
293
+        $pour = round((50*$pourcentagePompage)/100);
294
+        $return = "";
295
+        $couleur = "";
296
+        if($pourcentagePompage < $weakThreshold) {
297
+            $couleur = "vert";
298
+        } else if($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) {
299
+            $couleur = "orange";
300
+        } else {
301
+            $couleur = "rouge";
302
+        }
303
+        $return .= "<div style='float:left;margin-right:2px;'><img src='"
304
+            . $chemin_images."mini-drapeau_$couleur.png' title='"
305
+            . $texte['result']
306
+            . "' alt='faible' width='15' height='15' /></div>";
307
+        $return .= "<div style='float:left; margin-right:5px;width:45px;text-align:right;'>"
308
+            . $pourcentagePompage
309
+            . " %</div>";
310
+        $return .= "<div style='float:left;background:transparent url("
311
+            . $chemin_images
312
+            . "mini-jauge_fond.png) no-repeat scroll 0;height:12px;margin-top:5px;padding:0 0 0 2px;width:55px;'>";
313
+        $return .= "<div style='float:left;background:transparent url("
314
+            . $chemin_images
315
+            . "mini-jauge_"
316
+            . $couleur
317
+            . ".png) no-repeat scroll 0;height:12px;width:"
318
+            . $pour
319
+            . "px'></div></div>";
320 320
 
321
-		return $return;
322
-	}
323
-	/*
321
+        return $return;
322
+    }
323
+    /*
324 324
      * Method for validation of hash
325 325
      * @param $hash
326 326
      * @return bool
327 327
      *
328 328
      */
329
-	function isMd5($hash)
330
-	{
331
-		if(preg_match('`^[a-f0-9]{32}$`', $hash)) {
332
-			return true;
333
-		} else {
334
-			return false;
335
-		}
336
-	}
337
-	/*
329
+    function isMd5($hash)
330
+    {
331
+        if(preg_match('`^[a-f0-9]{32}$`', $hash)) {
332
+            return true;
333
+        } else {
334
+            return false;
335
+        }
336
+    }
337
+    /*
338 338
      * Method for identify Internet media type
339 339
      * @param $filename
340 340
      */
341
-	function typeMime($filename)
342
-	{
343
-		if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
344
-			$navigateur = "Opera";
345
-		} elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
346
-			$navigateur = "Internet Explorer";
347
-		} else {
348
-			$navigateur = "Mozilla";
349
-			$mime = parse_ini_file("mime.ini");
350
-			$extension = substr($filename, strrpos($filename, ".")+1);
351
-		}
352
-		if(array_key_exists($extension, $mime)) {
353
-			$type = $mime[$extension];
354
-		} else {
355
-			$type = ($navigateur!="Mozilla") ? 'application/octetstream' : 'application/octet-stream';
356
-		}
357
-		return $type;
358
-	}
341
+    function typeMime($filename)
342
+    {
343
+        if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
344
+            $navigateur = "Opera";
345
+        } elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
346
+            $navigateur = "Internet Explorer";
347
+        } else {
348
+            $navigateur = "Mozilla";
349
+            $mime = parse_ini_file("mime.ini");
350
+            $extension = substr($filename, strrpos($filename, ".")+1);
351
+        }
352
+        if(array_key_exists($extension, $mime)) {
353
+            $type = $mime[$extension];
354
+        } else {
355
+            $type = ($navigateur!="Mozilla") ? 'application/octetstream' : 'application/octet-stream';
356
+        }
357
+        return $type;
358
+    }
359 359
 ?>
360 360
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	class compilatio
12 12
 	{
13 13
 		/*Identification key for the Compilatio account*/
14
-		var $key  = null;
14
+		var $key = null;
15 15
 		/*Webservice connection*/
16 16
 		var $soapcli;
17 17
 
@@ -26,34 +26,34 @@  discard block
 block discarded – undo
26 26
 		{
27 27
 			try
28 28
 			{
29
-				if(!empty($key)){
29
+				if (!empty($key)) {
30 30
 					$this->key = $key;
31
-					if(!empty($urlsoap)){
32
-						if(!empty($proxyHost)) {
31
+					if (!empty($urlsoap)) {
32
+						if (!empty($proxyHost)) {
33 33
 							$param = array('trace' => false,
34 34
 								'soap_version' => SOAP_1_2,
35 35
 								'exceptions' => true,
36
-								'proxy_host' => '"' . $proxyHost . '"',
36
+								'proxy_host' => '"'.$proxyHost.'"',
37 37
 								'proxy_port' => $proxyPort);
38 38
 						} else {
39 39
 							$param = array('trace' => false,
40 40
 								'soap_version' => SOAP_1_2,
41 41
 								'exceptions' => true);
42 42
 						}
43
-						$this->soapcli = new SoapClient($urlsoap,$param);
44
-					}else{
45
-						$this->soapcli = 'WS urlsoap not available' ;
43
+						$this->soapcli = new SoapClient($urlsoap, $param);
44
+					} else {
45
+						$this->soapcli = 'WS urlsoap not available';
46 46
 					}
47
-				}else{
48
-					$this->soapcli ='API key not available';
47
+				} else {
48
+					$this->soapcli = 'API key not available';
49 49
 				}
50 50
 			}
51 51
 			catch (SoapFault $fault)
52 52
 			{
53
-				$this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ;
53
+				$this->soapcli = "Error constructor compilatio ".$fault->faultcode." ".$fault->faultstring;
54 54
 			}
55 55
 			catch (Exception $e) {
56
-				$this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap;
56
+				$this->soapcli = "Error constructor compilatio with urlsoap".$urlsoap;
57 57
 			}
58 58
 		}
59 59
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 			try
74 74
 			{
75 75
 				if (!is_object($this->soapcli))
76
-					return("Error in constructor compilatio() " . $this->soapcli);
76
+					return("Error in constructor compilatio() ".$this->soapcli);
77 77
 				$idDocument = $this->soapcli->__call('addDocumentBase64',
78 78
 					array(
79 79
 						$this->key,
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			}
89 89
 			catch (SoapFault $fault)
90 90
 			{
91
-                return("Erreur sendDoc()" . $fault->faultcode ." " .$fault->faultstring);
91
+                return("Erreur sendDoc()".$fault->faultcode." ".$fault->faultstring);
92 92
 			}
93 93
 		}
94 94
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		{
103 103
 			try
104 104
 			{
105
-				if (!is_object($this->soapcli)){
106
-					return("Error in constructor compilatio() " . $this->soapcli);
105
+				if (!is_object($this->soapcli)) {
106
+					return("Error in constructor compilatio() ".$this->soapcli);
107 107
 				}
108 108
 				$param = array($this->key, $compiHash);
109 109
 				$idDocument = $this->soapcli->__call('getDocument', $param);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			}
112 112
 			catch (SoapFault $fault)
113 113
 			{
114
-                return("Erreur getDoc()" . $fault->faultcode . " " .$fault->faultstring);
114
+                return("Erreur getDoc()".$fault->faultcode." ".$fault->faultstring);
115 115
 			}
116 116
 		}
117 117
 
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 		{
125 125
 			try
126 126
 			{
127
-				if (!is_object($this->soapcli)){
128
-					return("Error in constructor compilatio() " . $this->soapcli);
127
+				if (!is_object($this->soapcli)) {
128
+					return("Error in constructor compilatio() ".$this->soapcli);
129 129
 				}
130
-				$param = array($this->key,$compiHash);
130
+				$param = array($this->key, $compiHash);
131 131
 				$idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
132 132
 				return $idDocument;
133 133
 			}
134 134
 			catch (SoapFault $fault)
135 135
 			{
136
-                return("Erreur  getReportUrl()" . $fault->faultcode ." " .$fault->faultstring);
136
+                return("Erreur  getReportUrl()".$fault->faultcode." ".$fault->faultstring);
137 137
 			}
138 138
 		}
139 139
 
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 		{
147 147
 			try
148 148
 			{
149
-				if (!is_object($this->soapcli)){
150
-					return("Error in constructor compilatio() " . $this->soapcli);
149
+				if (!is_object($this->soapcli)) {
150
+					return("Error in constructor compilatio() ".$this->soapcli);
151 151
 				}
152
-				$param = array($this->key,$compiHash);
152
+				$param = array($this->key, $compiHash);
153 153
 				$this->soapcli->__call('deleteDocument', $param);
154 154
 			}
155 155
 			catch (SoapFault $fault)
156 156
 			{
157
-                return("Erreur  deldoc()" . $fault->faultcode . " " .$fault->faultstring);
157
+                return("Erreur  deldoc()".$fault->faultcode." ".$fault->faultstring);
158 158
 			}
159 159
 		}
160 160
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 		{
168 168
 			try
169 169
 			{
170
-				if (!is_object($this->soapcli)){
171
-					return("Error in constructor compilatio() " . $this->soapcli);
170
+				if (!is_object($this->soapcli)) {
171
+					return("Error in constructor compilatio() ".$this->soapcli);
172 172
 				}
173
-				$param = array($this->key,$compiHash);
173
+				$param = array($this->key, $compiHash);
174 174
                 $this->soapcli->__call('startDocumentAnalyse', $param);
175 175
 			}
176 176
 			catch (SoapFault $fault)
177 177
 			{
178
-                return("Erreur  startAnalyse()" . $fault->faultcode ." " .$fault->faultstring);
178
+                return("Erreur  startAnalyse()".$fault->faultcode." ".$fault->faultstring);
179 179
 			}
180 180
 		}
181 181
 
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 		{
188 188
 			try
189 189
 			{
190
-				if (!is_object($this->soapcli)){
191
-					return("Error in constructor compilatio() " . $this->soapcli);
190
+				if (!is_object($this->soapcli)) {
191
+					return("Error in constructor compilatio() ".$this->soapcli);
192 192
 				}
193
-				$param=array($this->key);
194
-                $resultat=$this->soapcli->__call('getAccountQuotas', $param);
193
+				$param = array($this->key);
194
+                $resultat = $this->soapcli->__call('getAccountQuotas', $param);
195 195
 				return $resultat;
196 196
 			}
197 197
 			catch (SoapFault $fault)
198 198
 			{
199
-                return("Erreur  getQuotas()" . $fault->faultcode ." " .$fault->faultstring);
199
+                return("Erreur  getQuotas()".$fault->faultcode." ".$fault->faultstring);
200 200
 			}
201 201
 		}
202 202
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
     function verifiFileType($filename)
211 211
 	{
212
-		$types = array("doc","docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html");
213
-		$extension = substr($filename, strrpos($filename, ".")+1);
212
+		$types = array("doc", "docx", "rtf", "xls", "xlsx", "ppt", "pptx", "odt", "pdf", "txt", "htm", "html");
213
+		$extension = substr($filename, strrpos($filename, ".") + 1);
214 214
 		$extension = strtolower($extension);
215 215
 		if (in_array($extension, $types)) {
216 216
 			return true;
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 			.$refreshReturn
250 250
 			."</td>";
251 251
 		$finretour = "</td></tr></table>";
252
-		if($status == "ANALYSE_IN_QUEUE" ){
253
-			return $startReturn . "<span style='font-size:11px'>" . $text['analysisinqueue'] . "</span>" . $finretour;
252
+		if ($status == "ANALYSE_IN_QUEUE") {
253
+			return $startReturn."<span style='font-size:11px'>".$text['analysisinqueue']."</span>".$finretour;
254 254
 		}
255
-		if($status == "ANALYSE_PROCESSING" ){
256
-			if($pour == 100){
255
+		if ($status == "ANALYSE_PROCESSING") {
256
+			if ($pour == 100) {
257 257
 				return $startReturn
258 258
 				. "<span style='font-size:11px'>"
259 259
 				. $text['analysisinfinalization']
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				. "background:transparent url("
271 271
 				. $imagesPath
272 272
 				. "mini-jauge_gris.png) no-repeat scroll 0;height:12px;width:"
273
-				. $pour/2
273
+				. $pour / 2
274 274
 				. "px;\"></div></div>"
275 275
 				. $finretour;
276 276
 			}
@@ -287,15 +287,15 @@  discard block
 block discarded – undo
287 287
 	 * @param $text : array  includes the extract from the text
288 288
 	 * @return unknown_type
289 289
 	 */
290
-	function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images='',$texte='') {
290
+	function getPomprankBarv31($pourcentagePompage, $weakThreshold, $highThreshold, $chemin_images = '', $texte = '') {
291 291
 
292 292
 		$pourcentagePompage = round($pourcentagePompage);
293
-		$pour = round((50*$pourcentagePompage)/100);
293
+		$pour = round((50 * $pourcentagePompage) / 100);
294 294
 		$return = "";
295 295
 		$couleur = "";
296
-		if($pourcentagePompage < $weakThreshold) {
296
+		if ($pourcentagePompage < $weakThreshold) {
297 297
 			$couleur = "vert";
298
-		} else if($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) {
298
+		} else if ($pourcentagePompage >= $weakThreshold && $pourcentagePompage < $highThreshold) {
299 299
 			$couleur = "orange";
300 300
 		} else {
301 301
 			$couleur = "rouge";
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      */
329 329
 	function isMd5($hash)
330 330
 	{
331
-		if(preg_match('`^[a-f0-9]{32}$`', $hash)) {
331
+		if (preg_match('`^[a-f0-9]{32}$`', $hash)) {
332 332
 			return true;
333 333
 		} else {
334 334
 			return false;
@@ -340,19 +340,19 @@  discard block
 block discarded – undo
340 340
      */
341 341
 	function typeMime($filename)
342 342
 	{
343
-		if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
343
+		if (preg_match("@Opera(/| )([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)) {
344 344
 			$navigateur = "Opera";
345
-		} elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)){
345
+		} elseif (preg_match("@MSIE ([0-9].[0-9]{1,2})@", $_SERVER['HTTP_USER_AGENT'], $resultats)) {
346 346
 			$navigateur = "Internet Explorer";
347 347
 		} else {
348 348
 			$navigateur = "Mozilla";
349 349
 			$mime = parse_ini_file("mime.ini");
350
-			$extension = substr($filename, strrpos($filename, ".")+1);
350
+			$extension = substr($filename, strrpos($filename, ".") + 1);
351 351
 		}
352
-		if(array_key_exists($extension, $mime)) {
352
+		if (array_key_exists($extension, $mime)) {
353 353
 			$type = $mime[$extension];
354 354
 		} else {
355
-			$type = ($navigateur!="Mozilla") ? 'application/octetstream' : 'application/octet-stream';
355
+			$type = ($navigateur != "Mozilla") ? 'application/octetstream' : 'application/octet-stream';
356 356
 		}
357 357
 		return $type;
358 358
 	}
Please login to merge, or discard this patch.
Braces   +13 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,18 +41,16 @@  discard block
 block discarded – undo
41 41
 								'exceptions' => true);
42 42
 						}
43 43
 						$this->soapcli = new SoapClient($urlsoap,$param);
44
-					}else{
44
+					} else{
45 45
 						$this->soapcli = 'WS urlsoap not available' ;
46 46
 					}
47
-				}else{
47
+				} else{
48 48
 					$this->soapcli ='API key not available';
49 49
 				}
50
-			}
51
-			catch (SoapFault $fault)
50
+			} catch (SoapFault $fault)
52 51
 			{
53 52
 				$this->soapcli = "Error constructor compilatio " . $fault->faultcode ." " .$fault->faultstring ;
54
-			}
55
-			catch (Exception $e) {
53
+			} catch (Exception $e) {
56 54
 				$this->soapcli = "Error constructor compilatio with urlsoap" . $urlsoap;
57 55
 			}
58 56
 		}
@@ -72,8 +70,9 @@  discard block
 block discarded – undo
72 70
 		{
73 71
 			try
74 72
 			{
75
-				if (!is_object($this->soapcli))
76
-					return("Error in constructor compilatio() " . $this->soapcli);
73
+				if (!is_object($this->soapcli)) {
74
+									return("Error in constructor compilatio() " . $this->soapcli);
75
+				}
77 76
 				$idDocument = $this->soapcli->__call('addDocumentBase64',
78 77
 					array(
79 78
 						$this->key,
@@ -85,8 +84,7 @@  discard block
 block discarded – undo
85 84
 					)
86 85
 				);
87 86
 				return $idDocument;
88
-			}
89
-			catch (SoapFault $fault)
87
+			} catch (SoapFault $fault)
90 88
 			{
91 89
                 return("Erreur sendDoc()" . $fault->faultcode ." " .$fault->faultstring);
92 90
 			}
@@ -108,8 +106,7 @@  discard block
 block discarded – undo
108 106
 				$param = array($this->key, $compiHash);
109 107
 				$idDocument = $this->soapcli->__call('getDocument', $param);
110 108
 				return $idDocument;
111
-			}
112
-			catch (SoapFault $fault)
109
+			} catch (SoapFault $fault)
113 110
 			{
114 111
                 return("Erreur getDoc()" . $fault->faultcode . " " .$fault->faultstring);
115 112
 			}
@@ -130,8 +127,7 @@  discard block
 block discarded – undo
130 127
 				$param = array($this->key,$compiHash);
131 128
 				$idDocument = $this->soapcli->__call('getDocumentReportUrl', $param);
132 129
 				return $idDocument;
133
-			}
134
-			catch (SoapFault $fault)
130
+			} catch (SoapFault $fault)
135 131
 			{
136 132
                 return("Erreur  getReportUrl()" . $fault->faultcode ." " .$fault->faultstring);
137 133
 			}
@@ -151,8 +147,7 @@  discard block
 block discarded – undo
151 147
 				}
152 148
 				$param = array($this->key,$compiHash);
153 149
 				$this->soapcli->__call('deleteDocument', $param);
154
-			}
155
-			catch (SoapFault $fault)
150
+			} catch (SoapFault $fault)
156 151
 			{
157 152
                 return("Erreur  deldoc()" . $fault->faultcode . " " .$fault->faultstring);
158 153
 			}
@@ -172,8 +167,7 @@  discard block
 block discarded – undo
172 167
 				}
173 168
 				$param = array($this->key,$compiHash);
174 169
                 $this->soapcli->__call('startDocumentAnalyse', $param);
175
-			}
176
-			catch (SoapFault $fault)
170
+			} catch (SoapFault $fault)
177 171
 			{
178 172
                 return("Erreur  startAnalyse()" . $fault->faultcode ." " .$fault->faultstring);
179 173
 			}
@@ -193,8 +187,7 @@  discard block
 block discarded – undo
193 187
 				$param=array($this->key);
194 188
                 $resultat=$this->soapcli->__call('getAccountQuotas', $param);
195 189
 				return $resultat;
196
-			}
197
-			catch (SoapFault $fault)
190
+			} catch (SoapFault $fault)
198 191
 			{
199 192
                 return("Erreur  getQuotas()" . $fault->faultcode ." " .$fault->faultstring);
200 193
 			}
Please login to merge, or discard this patch.
main/plagiarism/compilatio/upload.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -278,6 +278,9 @@  discard block
 block discarded – undo
278 278
 }
279 279
 
280 280
 
281
+/**
282
+ * @param string $txt
283
+ */
281 284
 function getFilename($txt) {
282 285
     $res = $txt;
283 286
     preg_match("|.*/([^/]+)|", $txt, $urlList);
@@ -287,6 +290,9 @@  discard block
 block discarded – undo
287 290
     return $res;
288 291
 }
289 292
 
293
+/**
294
+ * @param string $txt
295
+ */
290 296
 function getWorkFolder($txt) {
291 297
     $res = "";
292 298
     preg_match("|(.*/)[^/]+|", $txt, $urlList);
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -151,28 +151,28 @@  discard block
 block discarded – undo
151 151
 } else {
152 152
     //non multiple
153 153
 
154
-	$documentId = $_GET['doc'];
155
-	compilatioUpdateWorkDocument($documentId, $coursId);
156
-	$workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
157
-	$query = "SELECT * FROM "
154
+    $documentId = $_GET['doc'];
155
+    compilatioUpdateWorkDocument($documentId, $coursId);
156
+    $workTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
157
+    $query = "SELECT * FROM "
158 158
         . $workTable
159 159
         . " WHERE id='"
160 160
         . $documentId
161 161
         . "' AND c_id="
162 162
         . $coursId;
163
-	$sqlResult = Database::query($query);
164
-	$doc = Database::fetch_object($sqlResult);
165
-	$currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/";
166
-	$WrkUrl = $currentCourseRepositoryWeb . $doc->url;
167
-	$WrkTitle = $doc->title;
168
-	$LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"] . "/" . $doc->url;
169
-	$mime = typeMime($WrkTitle);
170
-	$compilatio = new compilatio(
163
+    $sqlResult = Database::query($query);
164
+    $doc = Database::fetch_object($sqlResult);
165
+    $currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"] . "/";
166
+    $WrkUrl = $currentCourseRepositoryWeb . $doc->url;
167
+    $WrkTitle = $doc->title;
168
+    $LocalWrkUrl = api_get_path(SYS_COURSE_PATH).$_course["path"] . "/" . $doc->url;
169
+    $mime = typeMime($WrkTitle);
170
+    $compilatio = new compilatio(
171 171
         $compilatioParameter['key'],
172 172
         $compilatioParameter['$urlsoap'],
173 173
         $compilatioParameter['proxy_host'],
174 174
         $compilatioParameter['proxy_port']);
175
-	if ($compilatioParameter['mode_transport'] == 'wget') {
175
+    if ($compilatioParameter['mode_transport'] == 'wget') {
176 176
 
177 177
         if (strlen($compilatioParameter['wget_uri']) > 2) {
178 178
             $filename = ereg_replace("/$",
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         $mime = "text/plain";
196 196
         $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, 'get_url');
197 197
     } else {
198
-		$pieces = explode("/", $doc->url);
199
-		$nbPieces = count($pieces);
200
-		$filename = $pieces[$nbPieces-1];
198
+        $pieces = explode("/", $doc->url);
199
+        $nbPieces = count($pieces);
200
+        $filename = $pieces[$nbPieces-1];
201 201
         $compilatioId = $compilatio->sendDoc($doc->title, '', $filename, $mime, file_get_contents($LocalWrkUrl));
202 202
     }
203
-	$compTable = Database::get_course_table("plagiarism_compilatio_docs");
203
+    $compTable = Database::get_course_table("plagiarism_compilatio_docs");
204 204
 
205
-	$sql4 = "INSERT INTO "
205
+    $sql4 = "INSERT INTO "
206 206
         . $compTable
207 207
         . "(c_id, id_doc, compilatio_id) VALUES ("
208 208
         . $coursId
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
         . "','"
212 212
         . $compilatioId
213 213
         . "')";
214
-	if (isMd5($compilatioId)) {
214
+    if (isMd5($compilatioId)) {
215 215
         Database::query($sql4);
216
-	} else {
217
-		$sql5 = "INSERT INTO "
216
+    } else {
217
+        $sql5 = "INSERT INTO "
218 218
             . $compTable
219 219
             . " (c_id, id_doc,compilatio_id) VALUES ("
220 220
             . $coursId
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
             ."','error')";
224 224
         Database::query($sql5);
225 225
 
226
-	}
227
-	if (isMd5($compilatioId)) {
226
+    }
227
+    if (isMd5($compilatioId)) {
228 228
         $soapRes = $compilatio->startAnalyse($compilatioId);
229 229
     } else {
230 230
         $typeMessage = 2;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }else{
240 240
         $message = $msgWait;
241 241
         Display::display_confirmation_message($message);
242
-	}
242
+    }
243 243
 
244 244
 }
245 245
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
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
     }
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
main/work/work.lib.php 2 patches
Doc Comments   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * Create a group of select from a date
159 159
  * @param FormValidator $form
160 160
  * @param string $prefix
161
- * @return array
161
+ * @return HTML_QuickForm_element[]
162 162
  */
163 163
 function create_group_date_select($form, $prefix = '')
164 164
 {
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
  * @author Bert Vanderkimpen
753 753
  * @author Yannick Warnier <[email protected]> Adaptation for work tool
754 754
  * @param   string $base_work_dir Base work dir (.../work)
755
- * @param   string $desiredDirName complete path of the desired name
755
+ * @param   string $desired_dir_name complete path of the desired name
756 756
  *
757 757
  * @return  string actual directory name if it succeeds, boolean false otherwise
758 758
  */
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 /**
775 775
  * Delete a work-tool directory
776 776
  * @param   int  $id work directory id to delete
777
- * @return  integer -1 on error
777
+ * @return  boolean|null -1 on error
778 778
  */
779 779
 function deleteDirWork($id)
780 780
 {
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
  * Update the url of a dir in the student_publication table
918 918
  * @param  array $work_data work original data
919 919
  * @param  string $newPath Example: "folder1"
920
- * @return bool
920
+ * @return boolean|null
921 921
  */
922 922
 function updateDirName($work_data, $newPath)
923 923
 {
@@ -974,6 +974,7 @@  discard block
 block discarded – undo
974 974
 /**
975 975
  * Transform an all directory structure (only directories) in an array
976 976
  * @param   string path of the directory
977
+ * @param string $directory
977 978
  * @return  array the directory structure into an array
978 979
  * @author  Julio Montoya Dokeos
979 980
  * @version April 2008
@@ -1043,7 +1044,7 @@  discard block
 block discarded – undo
1043 1044
  * @param   string the path of the directory
1044 1045
  * @param   boolean true if we want the total quantity of files
1045 1046
  * include in others child directories, false only  files in the directory
1046
- * @return  array the first element is an integer with the number of files
1047
+ * @return  integer[] the first element is an integer with the number of files
1047 1048
  * in the folder, the second element is the number of directories
1048 1049
  * @author  Julio Montoya
1049 1050
  * @version April 2008
@@ -2387,7 +2388,7 @@  discard block
 block discarded – undo
2387 2388
 }
2388 2389
 
2389 2390
 /**
2390
- * @param $name
2391
+ * @param string $name
2391 2392
  * @param $values
2392 2393
  * @param string $checked
2393 2394
  * @return string
@@ -2913,7 +2914,7 @@  discard block
 block discarded – undo
2913 2914
  * @param int $userId
2914 2915
  * @param int $workId
2915 2916
  * @param int $courseId
2916
- * @return bool
2917
+ * @return boolean|null
2917 2918
  */
2918 2919
 function allowOnlySubscribedUser($userId, $workId, $courseId)
2919 2920
 {
@@ -3031,7 +3032,7 @@  discard block
 block discarded – undo
3031 3032
 /**
3032 3033
  * Get total score from a work list
3033 3034
  * @param $workList
3034
- * @return int|null
3035
+ * @return integer
3035 3036
  */
3036 3037
 function getTotalWorkScore($workList)
3037 3038
 {
@@ -3047,7 +3048,7 @@  discard block
 block discarded – undo
3047 3048
  * Get comment count from a work list (docs sent by students)
3048 3049
  * @param array $workList
3049 3050
  * @param array $courseInfo
3050
- * @return int|null
3051
+ * @return integer
3051 3052
  */
3052 3053
 function getTotalWorkComment($workList, $courseInfo = array())
3053 3054
 {
@@ -3190,6 +3191,7 @@  discard block
 block discarded – undo
3190 3191
  * @param int $parentId
3191 3192
  * @param array $courseInfo
3192 3193
  * @param int $sessionId
3194
+ * @param integer $userId
3193 3195
  * @return int
3194 3196
  */
3195 3197
 function getLastWorkStudentFromParentByUser(
@@ -3826,12 +3828,11 @@  discard block
 block discarded – undo
3826 3828
 
3827 3829
 /**
3828 3830
  * Creates a new task (directory) in the assignment tool
3829
- * @param array $params
3830 3831
  * @param int $user_id
3831 3832
  * @param array $courseInfo
3832 3833
  * @param int $group_id
3833 3834
  * @param int $session_id
3834
- * @return bool|int
3835
+ * @return string|false
3835 3836
  * @note $params can have the following elements, but should at least have the 2 first ones: (
3836 3837
  *       'new_dir' => 'some-name',
3837 3838
  *       'description' => 'some-desc',
@@ -4327,7 +4328,7 @@  discard block
 block discarded – undo
4327 4328
 }
4328 4329
 
4329 4330
 /**
4330
- * @return array
4331
+ * @return string[]
4331 4332
  */
4332 4333
 function getUploadDocumentType()
4333 4334
 {
@@ -4699,7 +4700,7 @@  discard block
 block discarded – undo
4699 4700
  * @param int Session ID
4700 4701
  * @param $correction
4701 4702
  *
4702
- * @return array|bool
4703
+ * @return boolean
4703 4704
  */
4704 4705
 function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
4705 4706
 {
@@ -4817,7 +4818,7 @@  discard block
 block discarded – undo
4817 4818
  * @param int $userId
4818 4819
  * @param array $courseInfo
4819 4820
  * @param string $format
4820
- * @return bool
4821
+ * @return false|null
4821 4822
  */
4822 4823
 function exportAllWork($userId, $courseInfo, $format = 'pdf')
4823 4824
 {
@@ -4865,7 +4866,7 @@  discard block
 block discarded – undo
4865 4866
  * @param array $courseInfo
4866 4867
  * @param int $sessionId
4867 4868
  * @param string $format
4868
- * @return bool
4869
+ * @return false|null
4869 4870
  */
4870 4871
 function exportAllStudentWorkFromPublication(
4871 4872
     $workId,
@@ -5003,7 +5004,7 @@  discard block
 block discarded – undo
5003 5004
  * Downloads all user files per user
5004 5005
  * @param int $userId
5005 5006
  * @param array $courseInfo
5006
- * @return bool
5007
+ * @return false|null
5007 5008
  */
5008 5009
 function downloadAllFilesPerUser($userId, $courseInfo)
5009 5010
 {
@@ -5117,7 +5118,7 @@  discard block
 block discarded – undo
5117 5118
 /**
5118 5119
  * @param array $courseInfo
5119 5120
  * @param int $workId
5120
- * @return bool
5121
+ * @return boolean|null
5121 5122
  */
5122 5123
 function protectWork($courseInfo, $workId)
5123 5124
 {
@@ -5192,6 +5193,9 @@  discard block
 block discarded – undo
5192 5193
 /*
5193 5194
  * function for delete a document of the compilatio table if plagiarismTool is Compilatio
5194 5195
  */
5196
+/**
5197
+ * @param integer $itemId
5198
+ */
5195 5199
 function plagiarismDeleteDoc($courseId, $itemId)
5196 5200
 {
5197 5201
     if (plagiarismActive()) {
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 
36 36
     if (!empty($id)) {
37 37
         $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'&id='.$my_back_id.'">'.
38
-            Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
38
+            Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
39 39
     }
40 40
 
41 41
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
42 42
         // Create dir
43 43
         if (empty($id)) {
44 44
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=create_dir&origin='.$origin.'&gradebook='.$gradebook.'">';
45
-            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'),'',ICON_SIZE_MEDIUM).'</a>';
45
+            $display_output .= Display::return_icon('new_work.png', get_lang('CreateAssignment'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
         }
47 47
         if (empty($id)) {
48 48
             // Options
49 49
             $display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=settings&origin='.$origin.'&gradebook='.$gradebook.'">';
50
-            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'),'',ICON_SIZE_MEDIUM).'</a>';
50
+            $display_output .= Display::return_icon('settings.png', get_lang('EditToolOptions'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
         }
52
-        $display_output .= '<a id="open-view-list" href="#">' . Display::return_icon('listwork.png', get_lang('ViewStudents'),'',ICON_SIZE_MEDIUM) . '</a>';
52
+        $display_output .= '<a id="open-view-list" href="#">'.Display::return_icon('listwork.png', get_lang('ViewStudents'), '', ICON_SIZE_MEDIUM).'</a>';
53 53
 
54 54
     }
55 55
 
56 56
     if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath' && api_is_allowed_to_session_edit(false, true)) {
57 57
         // Delete all files
58
-        if (api_get_setting('permanently_remove_deleted_files') == 'true'){
58
+        if (api_get_setting('permanently_remove_deleted_files') == 'true') {
59 59
             $message = get_lang('ConfirmYourChoiceDeleteAllfiles');
60 60
         } else {
61 61
             $message = get_lang('ConfirmYourChoice');
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
  */
113 113
 function two_digits($number)
114 114
 {
115
-    $number = (int)$number;
115
+    $number = (int) $number;
116 116
     return ($number < 10) ? '0'.$number : $number;
117 117
 }
118 118
 
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
     );
548 548
 
549 549
     $columnModel = array(
550
-        array('name'=>'type', 'index'=>'type', 'width'=>'30',   'align'=>'center', 'sortable' => 'false'),
551
-        array('name'=>'title', 'index'=>'title', 'width'=>'250',   'align'=>'left'),
552
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
553
-        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center'),
554
-        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center'),
550
+        array('name'=>'type', 'index'=>'type', 'width'=>'30', 'align'=>'center', 'sortable' => 'false'),
551
+        array('name'=>'title', 'index'=>'title', 'width'=>'250', 'align'=>'left'),
552
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80', 'align'=>'center', 'sortable'=>'false'),
553
+        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80', 'align'=>'center'),
554
+        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125', 'align'=>'center'),
555 555
     );
556 556
 
557 557
     if ($courseInfo['show_score'] == 0) {
@@ -588,10 +588,10 @@  discard block
 block discarded – undo
588 588
 {
589 589
     $columnModel = array(
590 590
         array('name'=>'type', 'index'=>'type', 'width'=>'35', 'align'=>'center', 'sortable' => 'false'),
591
-        array('name'=>'title', 'index'=>'title',  'width'=>'300',   'align'=>'left', 'wrap_cell' => "true"),
592
-        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125',  'align'=>'center'),
593
-        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125',  'align'=>'center'),
594
-        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110',  'align'=>'center'),
591
+        array('name'=>'title', 'index'=>'title', 'width'=>'300', 'align'=>'left', 'wrap_cell' => "true"),
592
+        array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125', 'align'=>'center'),
593
+        array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125', 'align'=>'center'),
594
+        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110', 'align'=>'center'),
595 595
         array('name'=>'actions', 'index'=>'actions', 'width'=>'110', 'align'=>'left', 'sortable'=>'false')
596 596
     );
597 597
 
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
         return false;
794 794
     }
795 795
 
796
-    $base_work_dir = api_get_path(SYS_COURSE_PATH) .$_course['path'].'/work';
796
+    $base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/work';
797 797
     $work_data_url = $base_work_dir.$work_data['url'];
798 798
     $check = Security::check_abs_path($work_data_url.'/', $base_work_dir.'/');
799 799
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 function get_work_path($id)
864 864
 {
865 865
     $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
866
-    $course_id  = api_get_course_int_id();
866
+    $course_id = api_get_course_int_id();
867 867
     $sql = 'SELECT url FROM '.$table.'
868 868
             WHERE c_id = '.$course_id.' AND id='.intval($id);
869 869
     $res = Database::query($sql);
@@ -984,9 +984,9 @@  discard block
 block discarded – undo
984 984
     if ($handle = @opendir($directory)) {
985 985
         while (false !== ($file = readdir($handle))) {
986 986
             if ($file != '.' && $file != '..') {
987
-                if (is_dir($directory. '/' . $file)) {
988
-                    $array_items = array_merge($array_items, directory_to_array($directory. '/' . $file));
989
-                    $file = $directory . '/' . $file;
987
+                if (is_dir($directory.'/'.$file)) {
988
+                    $array_items = array_merge($array_items, directory_to_array($directory.'/'.$file));
989
+                    $file = $directory.'/'.$file;
990 990
                     $array_items[] = preg_replace("/\/\//si", '/', $file);
991 991
                 }
992 992
             }
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
1020 1020
 
1021
-    for($i = 0; $i < count($only_dir); $i++) {
1021
+    for ($i = 0; $i < count($only_dir); $i++) {
1022 1022
         $url = $only_dir[$i];
1023 1023
 
1024 1024
         $params = [
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
             if (is_dir($path_dir.'/'.$entry)) {
1059 1059
                 $count_dir++;
1060 1060
                 if ($recurse) {
1061
-                    $count += count_dir($path_dir . '/' . $entry, $recurse);
1061
+                    $count += count_dir($path_dir.'/'.$entry, $recurse);
1062 1062
                 }
1063 1063
             } else {
1064 1064
                 $count++;
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
         $courseInfo
1324 1324
     );
1325 1325
 
1326
-    if (!in_array($direction, array('asc','desc'))) {
1326
+    if (!in_array($direction, array('asc', 'desc'))) {
1327 1327
         $direction = 'desc';
1328 1328
     }
1329 1329
     if (!empty($where_condition)) {
1330
-        $where_condition = ' AND ' . $where_condition;
1330
+        $where_condition = ' AND '.$where_condition;
1331 1331
     }
1332 1332
 
1333 1333
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1470,7 +1470,7 @@  discard block
 block discarded – undo
1470 1470
         $direction = 'desc';
1471 1471
     }
1472 1472
     if (!empty($where_condition)) {
1473
-        $where_condition = ' AND ' . $where_condition;
1473
+        $where_condition = ' AND '.$where_condition;
1474 1474
     }
1475 1475
 
1476 1476
     $column = !empty($column) ? Database::escape_string($column) : 'sent_date';
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
             );
1529 1529
 
1530 1530
             $work['amount'] = Display::label(
1531
-                $countUniqueAttempts . '/' .
1531
+                $countUniqueAttempts.'/'.
1532 1532
                 $totalUsers,
1533 1533
                 'success'
1534 1534
             );
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
                         array(),
1578 1578
                         ICON_SIZE_SMALL
1579 1579
                     ),
1580
-                    api_get_path(WEB_CODE_PATH) . 'work/downloadfolder.inc.php?id=' . $workId . '&' . api_get_cidreq()
1580
+                    api_get_path(WEB_CODE_PATH).'work/downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq()
1581 1581
                 );
1582 1582
             } else {
1583 1583
                 $downloadLink = Display::url(
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
     $userCondition = " AND u.user_id = $studentId ";
1662 1662
     $sessionCondition = " AND w.session_id = $sessionId ";
1663 1663
     $workCondition = " AND w_rel.work_id = $workId";
1664
-    $workParentCondition  = " AND w.parent_id = $workId";
1664
+    $workParentCondition = " AND w.parent_id = $workId";
1665 1665
 
1666 1666
     $sql = "(
1667 1667
                 $select1 FROM $userTable u
@@ -1769,7 +1769,7 @@  discard block
 block discarded – undo
1769 1769
         }
1770 1770
 
1771 1771
         if ($allowEdition && !empty($itemId)) {
1772
-            $deleteLink  = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1772
+            $deleteLink = Display::url($deleteIcon, $urlDelete.'&item_id='.$itemId.'&id='.$workId);
1773 1773
         } else {
1774 1774
             $deleteLink = null;
1775 1775
         }
@@ -1851,8 +1851,8 @@  discard block
 block discarded – undo
1851 1851
     $limit = intval($limit);
1852 1852
 
1853 1853
     /*Call Compilatio's API*/
1854
-    require_once(api_get_path(SYS_CODE_PATH) . 'plagiarism/compilatio/config.php');
1855
-    require_once(api_get_path(SYS_CODE_PATH) . 'plagiarism/compilatio/compilatio.class.php');
1854
+    require_once(api_get_path(SYS_CODE_PATH).'plagiarism/compilatio/config.php');
1855
+    require_once(api_get_path(SYS_CODE_PATH).'plagiarism/compilatio/compilatio.class.php');
1856 1856
 
1857 1857
     $compilatio_web_folder = api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/';
1858 1858
     $compilatio = new compilatio(
@@ -1863,7 +1863,7 @@  discard block
 block discarded – undo
1863 1863
     );
1864 1864
 
1865 1865
 
1866
-    if (!in_array($direction, array('asc','desc'))) {
1866
+    if (!in_array($direction, array('asc', 'desc'))) {
1867 1867
         $direction = 'desc';
1868 1868
     }
1869 1869
 
@@ -1931,13 +1931,13 @@  discard block
 block discarded – undo
1931 1931
         $work_assignment = get_work_assignment_by_id($work_id);
1932 1932
 
1933 1933
         if (!empty($studentId)) {
1934
-            $where_condition.= " AND u.user_id = ".intval($studentId);
1934
+            $where_condition .= " AND u.user_id = ".intval($studentId);
1935 1935
         }
1936 1936
 
1937 1937
         $sql = " $select
1938 1938
                 FROM $work_condition  $user_condition
1939 1939
                 WHERE $extra_conditions $where_condition $condition_session
1940
-                    AND u.status != " . INVITEE . "
1940
+                    AND u.status != ".INVITEE."
1941 1941
                 ORDER BY $column $direction";
1942 1942
 
1943 1943
         if (!empty($start) && !empty($limit)) {
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
                     $qualification_string = Display::label('-');
1996 1996
                 } else {
1997 1997
                     $label = 'info';
1998
-                    $relativeScore = $work['qualification']/$work_data['qualification'];
1998
+                    $relativeScore = $work['qualification'] / $work_data['qualification'];
1999 1999
                     if ($relativeScore < 0.5) {
2000 2000
                         $label = 'important';
2001 2001
                     } elseif ($relativeScore < 0.75) {
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
                 // If URL is present then there's a file to download keep BC.
2052 2052
                 if ($work['contains_file'] || !empty($work['url'])) {
2053 2053
                     $link_to_download = '<a href="'.$url.'download.php?id='.$item_id.'&'.api_get_cidreq().'">'.
2054
-                        Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
2054
+                        Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_SMALL).'</a> ';
2055 2055
                 }
2056 2056
 
2057
-                $send_to = Portfolio::share('work', $work['id'],  array('style' => 'white-space:nowrap;'));
2057
+                $send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
2058 2058
 
2059 2059
                 $feedback = null;
2060 2060
                 $count = getWorkCommentCount($item_id, $course_info);
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
                 $work_date = api_convert_and_format_date($work['sent_date']);
2074 2074
 
2075 2075
                 $work['sent_date_from_db'] = $work['sent_date'];
2076
-                $work['sent_date'] = '<div class="date-time">' . date_to_str_ago(api_get_local_time($work['sent_date'])) . ' ' . $add_string . ' ' . $work_date . '</div>';
2076
+                $work['sent_date'] = '<div class="date-time">'.date_to_str_ago(api_get_local_time($work['sent_date'])).' '.$add_string.' '.$work_date.'</div>';
2077 2077
 
2078 2078
                 // Actions.
2079 2079
                 $correction = '';
@@ -2091,8 +2091,8 @@  discard block
 block discarded – undo
2091 2091
                         Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a> ';
2092 2092
 
2093 2093
                     if ($unoconv && empty($work['contains_file'])) {
2094
-                        $action .=  '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2095
-                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'),array(), ICON_SIZE_SMALL).'</a> ';
2094
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=export_to_doc&item_id='.$item_id.'" title="'.get_lang('ExportToDoc').'" >'.
2095
+                            Display::return_icon('export_doc.png', get_lang('ExportToDoc'), array(), ICON_SIZE_SMALL).'</a> ';
2096 2096
                     }
2097 2097
 
2098 2098
                     $correction = '
@@ -2144,9 +2144,9 @@  discard block
 block discarded – undo
2144 2144
 
2145 2145
                     if ($locked) {
2146 2146
                         if ($qualification_exists) {
2147
-                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'),array(), ICON_SIZE_SMALL);
2147
+                            $action .= Display::return_icon('rate_work_na.png', get_lang('CorrectAndRate'), array(), ICON_SIZE_SMALL);
2148 2148
                         } else {
2149
-                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'),array(), ICON_SIZE_SMALL);
2149
+                            $action .= Display::return_icon('edit_na.png', get_lang('Comment'), array(), ICON_SIZE_SMALL);
2150 2150
                         }
2151 2151
                     } else {
2152 2152
                         if ($qualification_exists) {
@@ -2160,45 +2160,45 @@  discard block
 block discarded – undo
2160 2160
 
2161 2161
                     if ($work['contains_file']) {
2162 2162
                         if ($locked) {
2163
-                            $action .= Display::return_icon('move_na.png', get_lang('Move'),array(), ICON_SIZE_SMALL);
2163
+                            $action .= Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL);
2164 2164
                         } else {
2165 2165
                             $action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=move&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Move').'">'.
2166
-                                Display::return_icon('move.png', get_lang('Move'),array(), ICON_SIZE_SMALL).'</a>';
2166
+                                Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>';
2167 2167
                         }
2168 2168
                     }
2169 2169
 
2170 2170
                     if ($work['accepted'] == '1') {
2171 2171
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_invisible&item_id='.$item_id.'" title="'.get_lang('Invisible').'" >'.
2172
-                            Display::return_icon('visible.png', get_lang('Invisible'),array(), ICON_SIZE_SMALL).'</a>';
2172
+                            Display::return_icon('visible.png', get_lang('Invisible'), array(), ICON_SIZE_SMALL).'</a>';
2173 2173
                     } else {
2174 2174
                         $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=make_visible&item_id='.$item_id.'" title="'.get_lang('Visible').'" >'.
2175
-                            Display::return_icon('invisible.png', get_lang('Visible'),array(), ICON_SIZE_SMALL).'</a> ';
2175
+                            Display::return_icon('invisible.png', get_lang('Visible'), array(), ICON_SIZE_SMALL).'</a> ';
2176 2176
                     }
2177 2177
 
2178 2178
                     if ($locked) {
2179 2179
                         $action .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
2180 2180
                     } else {
2181
-                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2182
-                            Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2181
+                        $action .= '<a href="'.$url.'work_list_all.php?'.api_get_cidreq().'&id='.$work_id.'&action=delete&item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.
2182
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2183 2183
                     }
2184 2184
                 } elseif ($is_author && (empty($work['qualificator_id']) || $work['qualificator_id'] == 0)) {
2185 2185
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2186
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2186
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2187 2187
 
2188 2188
                     if (api_get_course_setting('student_delete_own_publication') == 1) {
2189 2189
                         if (api_is_allowed_to_session_edit(false, true)) {
2190 2190
                             $action .= '<a href="'.$url.'edit.php?'.api_get_cidreq().'&item_id='.$item_id.'&id='.$work['parent_id'].'" title="'.get_lang('Modify').'">'.
2191
-                                Display::return_icon('edit.png', get_lang('Comment'),array(), ICON_SIZE_SMALL).'</a>';
2191
+                                Display::return_icon('edit.png', get_lang('Comment'), array(), ICON_SIZE_SMALL).'</a>';
2192 2192
                         }
2193
-                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2194
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
2193
+                        $action .= ' <a href="'.$url.'work_list.php?'.api_get_cidreq().'&action=delete&item_id='.$item_id.'&id='.$work['parent_id'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'"  >'.
2194
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
2195 2195
                     } else {
2196
-                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2196
+                        $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2197 2197
                     }
2198 2198
                 } else {
2199 2199
                     $action .= '<a href="'.$url.'view.php?'.api_get_cidreq().'&id='.$item_id.'" title="'.get_lang('View').'">'.
2200
-                        Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a>';
2201
-                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
2200
+                        Display::return_icon('default.png', get_lang('View'), array(), ICON_SIZE_SMALL).'</a>';
2201
+                    $action .= Display::return_icon('edit_na.png', get_lang('Modify'), array(), ICON_SIZE_SMALL);
2202 2202
                 }
2203 2203
 
2204 2204
                 // Status.
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
                     . $course_id;
2221 2221
                 $compiSqlResult = Database::query($compilatioQuery);
2222 2222
                 $compi = Database::fetch_object($compiSqlResult);
2223
-                $workDirectory = api_get_path(SYS_COURSE_PATH) . $course_info['directory'];
2223
+                $workDirectory = api_get_path(SYS_COURSE_PATH).$course_info['directory'];
2224 2224
                 if (isset($compi->compilatio_id)) {
2225 2225
                     $actionCompilatio = "<div id='id_avancement"
2226 2226
                         . $item_id
@@ -2235,8 +2235,8 @@  discard block
 block discarded – undo
2235 2235
                         $actionCompilatio = "<div style='font-style:italic'>"
2236 2236
                             . get_lang('compilatioFileisnotsupported')
2237 2237
                             ."</div>";
2238
-                    } elseif (filesize($workDirectory . "/" . $work['url']) > $compilatioParameter['max_filesize']) {
2239
-                        $sizeFile = round(filesize($workDirectory . "/" . $work['url']) / 1000000);
2238
+                    } elseif (filesize($workDirectory."/".$work['url']) > $compilatioParameter['max_filesize']) {
2239
+                        $sizeFile = round(filesize($workDirectory."/".$work['url']) / 1000000);
2240 2240
                         $status = "BAD_FILESIZE";
2241 2241
                         $actionCompilatio = "<div style='font-style:italic'>"
2242 2242
                             .get_lang('compilatioTooHeavyDocument')
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
     $_course = api_get_course_info();
2278 2278
     $task_id = $task_data['id'];
2279 2279
     $task_title = !empty($task_data['title']) ? $task_data['title'] : basename($task_data['url']);
2280
-    $subject = '[' . api_get_setting('siteName') . '] ';
2280
+    $subject = '['.api_get_setting('siteName').'] ';
2281 2281
 
2282 2282
     // The body can be as long as you wish, and any combination of text and variables
2283 2283
     $content = get_lang('ReminderToSubmitPendingTask')."\n".get_lang('CourseName').' : '.$_course['name']."\n";
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
     $mails_sent_to = array();
2289 2289
     foreach ($list_users as $user) {
2290 2290
         $name_user = api_get_person_name($user[1], $user[0], null, PERSON_NAME_EMAIL_ADDRESS);
2291
-        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]) .", \n\n";
2291
+        $dear_line = get_lang('Dear')." ".api_get_person_name($user[1], $user[0]).", \n\n";
2292 2292
         $body      = $dear_line.$content;
2293 2293
         MessageManager::send_message($user[3], $subject, $body);
2294 2294
         $mails_sent_to[] = $name_user;
@@ -2317,22 +2317,22 @@  discard block
 block discarded – undo
2317 2317
     } else {
2318 2318
         $students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
2319 2319
     }
2320
-    $emailsubject = '[' . api_get_setting('siteName') . '] '.get_lang('HomeworkCreated');
2320
+    $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('HomeworkCreated');
2321 2321
     $currentUser = api_get_user_info(api_get_user_id());
2322 2322
     if (!empty($students)) {
2323
-        foreach($students as $student) {
2323
+        foreach ($students as $student) {
2324 2324
             $user_info = api_get_user_info($student["user_id"]);
2325
-            if(!empty($user_info["mail"])) {
2325
+            if (!empty($user_info["mail"])) {
2326 2326
                 $name_user = api_get_person_name(
2327 2327
                     $user_info["firstname"],
2328 2328
                     $user_info["lastname"],
2329 2329
                     null,
2330 2330
                     PERSON_NAME_EMAIL_ADDRESS
2331 2331
                 );
2332
-                $link = api_get_path(WEB_CODE_PATH) . 'work/work_list_all.php?' . api_get_cidreq() . '&id=' . $workId;
2332
+                $link = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId;
2333 2333
                 $emailbody = get_lang('Dear')." ".$name_user.",\n\n";
2334 2334
                 $emailbody .= get_lang('HomeworkHasBeenCreatedForTheCourse')." ".$courseCode.". "."\n\n".
2335
-                    '<a href="'. $link . '">' . get_lang('PleaseCheckHomeworkPage') . '</a>';
2335
+                    '<a href="'.$link.'">'.get_lang('PleaseCheckHomeworkPage').'</a>';
2336 2336
                 $emailbody .= "\n\n".api_get_person_name($currentUser["firstname"], $currentUser["lastname"]);
2337 2337
 
2338 2338
                 $additionalParameters = array(
@@ -2374,7 +2374,7 @@  discard block
 block discarded – undo
2374 2374
     $url = Database::escape_string($url);
2375 2375
     $sql = "SELECT id FROM $work_table WHERE url='$url'";
2376 2376
     $result = Database::query($sql);
2377
-    if (Database::num_rows($result)> 0) {
2377
+    if (Database::num_rows($result) > 0) {
2378 2378
         $row = Database::fetch_row($result);
2379 2379
         if (empty($row)) {
2380 2380
             return false;
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
 {
2397 2397
     $output = '<select name="'.$name.'" id="'.$name.'">';
2398 2398
     foreach ($values as $key => $value) {
2399
-        $output .= '<option value="'.$key.'" '.(($checked==$key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2399
+        $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>';
2400 2400
     }
2401 2401
     $output .= '</select>';
2402 2402
     return $output;
@@ -2410,9 +2410,9 @@  discard block
 block discarded – undo
2410 2410
  */
2411 2411
 function make_checkbox($name, $checked = '', $label = null)
2412 2412
 {
2413
-    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked))?'checked="checked"':'').'/>';
2413
+    $check = '<input id ="'.$name.'" type="checkbox" value="1" name="'.$name.'" '.((!empty($checked)) ? 'checked="checked"' : '').'/>';
2414 2414
     if (!empty($label)) {
2415
-        $check .="<label for ='$name'>$label</label>";
2415
+        $check .= "<label for ='$name'>$label</label>";
2416 2416
     }
2417 2417
     return $check;
2418 2418
 }
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
     }
2567 2567
 
2568 2568
     if (!empty($studentId)) {
2569
-        $sql_users.= " AND u.user_id = ".intval($studentId);
2569
+        $sql_users .= " AND u.user_id = ".intval($studentId);
2570 2570
     }
2571 2571
 
2572 2572
     $group_id = api_get_group_id();
@@ -2576,7 +2576,7 @@  discard block
 block discarded – undo
2576 2576
     if ($group_id) {
2577 2577
         $group_user_list = GroupManager::get_subscribed_users($group_id);
2578 2578
         if (!empty($group_user_list)) {
2579
-            foreach($group_user_list as $group_user) {
2579
+            foreach ($group_user_list as $group_user) {
2580 2580
                 $new_group_user_list[] = $group_user['user_id'];
2581 2581
             }
2582 2582
         }
@@ -2997,7 +2997,7 @@  discard block
 block discarded – undo
2997 2997
 function getWorkComments($work)
2998 2998
 {
2999 2999
     $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT);
3000
-    $userTable= Database::get_main_table(TABLE_MAIN_USER);
3000
+    $userTable = Database::get_main_table(TABLE_MAIN_USER);
3001 3001
 
3002 3002
     $courseId = intval($work['c_id']);
3003 3003
     $workId = intval($work['id']);
@@ -3680,7 +3680,7 @@  discard block
 block discarded – undo
3680 3680
             null,
3681 3681
             PERSON_NAME_EMAIL_ADDRESS
3682 3682
         );
3683
-        $subject = "[" . api_get_setting('siteName') . "] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3683
+        $subject = "[".api_get_setting('siteName')."] ".get_lang('SendMailBody')."\n ".get_lang('CourseName').": ".$courseInfo['name']."  ";
3684 3684
         foreach ($user_list as $user_data) {
3685 3685
             $to_user_id = $user_data['user_id'];
3686 3686
             $user_info = api_get_user_info($to_user_id);
@@ -3729,7 +3729,7 @@  discard block
 block discarded – undo
3729 3729
 
3730 3730
     $title = $values['title'];
3731 3731
     $description = $values['description'];
3732
-    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']): 0;
3732
+    $contains_file = isset($values['contains_file']) && !empty($values['contains_file']) ? intval($values['contains_file']) : 0;
3733 3733
 
3734 3734
     $saveWork = true;
3735 3735
     $message = null;
@@ -4103,8 +4103,8 @@  discard block
 block discarded – undo
4103 4103
                     LINK_STUDENTPUBLICATION,
4104 4104
                     $workId,
4105 4105
                     $params['new_dir'],
4106
-                    (float)$params['weight'],
4107
-                    (float)$params['qualification'],
4106
+                    (float) $params['weight'],
4107
+                    (float) $params['qualification'],
4108 4108
                     $params['description'],
4109 4109
                     1,
4110 4110
                     api_get_session_id()
@@ -4364,15 +4364,15 @@  discard block
 block discarded – undo
4364 4364
     // changing the tool setting: is a student allowed to delete his/her own document
4365 4365
 
4366 4366
     // counting the number of occurrences of this setting (if 0 => add, if 1 => update)
4367
-    $query = "SELECT * FROM " . $table_course_setting . "
4367
+    $query = "SELECT * FROM ".$table_course_setting."
4368 4368
               WHERE c_id = $courseId AND variable = 'student_delete_own_publication'";
4369 4369
 
4370 4370
     $result = Database::query($query);
4371 4371
     $number_of_setting = Database::num_rows($result);
4372 4372
 
4373 4373
     if ($number_of_setting == 1) {
4374
-        $query = "UPDATE " . $table_course_setting . " SET
4375
-                  value='" . Database::escape_string($studentDeleteOwnPublication) . "'
4374
+        $query = "UPDATE ".$table_course_setting." SET
4375
+                  value='" . Database::escape_string($studentDeleteOwnPublication)."'
4376 4376
                   WHERE variable = 'student_delete_own_publication' AND c_id = $courseId";
4377 4377
         Database::query($query);
4378 4378
     } else {
@@ -4411,9 +4411,9 @@  discard block
 block discarded – undo
4411 4411
     $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4412 4412
     $item_id = intval($item_id);
4413 4413
     $course_id = $course_info['real_id'];
4414
-    $sql = "UPDATE  " . $work_table . "
4414
+    $sql = "UPDATE  ".$work_table."
4415 4415
             SET accepted = 0
4416
-            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4416
+            WHERE c_id = $course_id AND id = '".$item_id."'";
4417 4417
     Database::query($sql);
4418 4418
     api_item_property_update(
4419 4419
         $course_info,
@@ -4557,7 +4557,7 @@  discard block
 block discarded – undo
4557 4557
                 $courseCode,
4558 4558
                 $sessionId,
4559 4559
                 $limitString,
4560
-                $orderBy ,
4560
+                $orderBy,
4561 4561
                 STUDENT,
4562 4562
                 $getCount
4563 4563
             );
@@ -4894,8 +4894,8 @@  discard block
 block discarded – undo
4894 4894
     if (!empty($sessionId)) {
4895 4895
         $sessionInfo = api_get_session_info($sessionId);
4896 4896
         if (!empty($sessionInfo)) {
4897
-            $header .= ' - ' . $sessionInfo['name'];
4898
-            $header .= '<br />' . $sessionInfo['description'];
4897
+            $header .= ' - '.$sessionInfo['name'];
4898
+            $header .= '<br />'.$sessionInfo['description'];
4899 4899
             $teachers = SessionManager::getCoachesByCourseSessionToString(
4900 4900
                 $sessionId,
4901 4901
                 $courseInfo['real_id']
@@ -4911,12 +4911,12 @@  discard block
 block discarded – undo
4911 4911
     $expiresOn = null;
4912 4912
 
4913 4913
     if (!empty($assignment) && isset($assignment['expires_on'])) {
4914
-        $content .= '<br /><strong>' . get_lang('ExpirationDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
4914
+        $content .= '<br /><strong>'.get_lang('ExpirationDate').'</strong>: '.api_get_local_time($assignment['expires_on']);
4915 4915
         $expiresOn = api_get_local_time($assignment['expires_on']);
4916 4916
     }
4917 4917
 
4918 4918
     if (!empty($workData['description'])) {
4919
-        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
4919
+        $content .= '<br /><strong>'.get_lang('Description').'</strong>: '.$workData['description'];
4920 4920
     }
4921 4921
 
4922 4922
     $workList = get_work_user_list(null, null, null, null, $workId);
@@ -4937,7 +4937,7 @@  discard block
 block discarded – undo
4937 4937
                 );
4938 4938
 
4939 4939
                 $column = 0;
4940
-                foreach($headers as $header) {
4940
+                foreach ($headers as $header) {
4941 4941
                     $table->setHeaderContents(0, $column, $header);
4942 4942
                     $column++;
4943 4943
                 }
@@ -4985,7 +4985,7 @@  discard block
 block discarded – undo
4985 4985
 
4986 4986
                 if (!empty($content)) {
4987 4987
                     $params = array(
4988
-                        'filename' => $workData['title'] . '_' . api_get_local_time(),
4988
+                        'filename' => $workData['title'].'_'.api_get_local_time(),
4989 4989
                         'pdf_title' => api_replace_dangerous_char($workData['title']),
4990 4990
                         'course_code' => $courseInfo['code'],
4991 4991
                         'add_signatures' => false
@@ -5016,7 +5016,7 @@  discard block
 block discarded – undo
5016 5016
     $tempZipFile = api_get_path(SYS_ARCHIVE_PATH).api_get_unique_id().".zip";
5017 5017
     $coursePath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/work/';
5018 5018
 
5019
-    $zip  = new PclZip($tempZipFile);
5019
+    $zip = new PclZip($tempZipFile);
5020 5020
 
5021 5021
     $workPerUser = getWorkPerUser($userId);
5022 5022
 
@@ -5180,8 +5180,8 @@  discard block
 block discarded – undo
5180 5180
  */
5181 5181
 function compilatioDeleteDoc($courseId, $itemId)
5182 5182
 {
5183
-    $plagiarism_table   = Database :: get_course_table(TABLE_COMPILATIO);
5184
-    $queryString4   = "DELETE FROM "
5183
+    $plagiarism_table = Database :: get_course_table(TABLE_COMPILATIO);
5184
+    $queryString4 = "DELETE FROM "
5185 5185
         . $plagiarism_table
5186 5186
         . " WHERE c_id = "
5187 5187
         . $courseId
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string Optional help file name
56 56
      * @param string $page_header
57 57
      */
58
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
58
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
61 61
         $showHeader = true;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $grid_class = array(),
352 352
         $elementCount = 0
353 353
     ) {
354
-        $column =  0;
354
+        $column = 0;
355 355
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
356 356
 
357 357
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param bool	Filter (true) or not (false)
477 477
      * @return void
478 478
      */
479
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
479
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
480 480
     {
481 481
         $message = self::return_message($message, 'confirm', $filter);
482 482
         if ($returnValue) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param bool	Filter (true) or not (false)
494 494
      * @return void
495 495
      */
496
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
496
+    public static function display_error_message($message, $filter = true, $returnValue = false)
497 497
     {
498 498
         $message = self::return_message($message, 'error', $filter);
499 499
         if ($returnValue) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      * @param string $type
509 509
      * @param bool $filter
510 510
      */
511
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
511
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
512 512
     {
513 513
         $message = get_lang($message);
514 514
         echo self::return_message($message, $type, $filter);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         $class = "";
535
-        switch($type) {
535
+        switch ($type) {
536 536
             case 'warning':
537 537
                $class .= 'alert alert-warning';
538 538
                break;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      * @param string  optional, class from stylesheet
561 561
      * @return string encrypted mailto hyperlink
562 562
      */
563
-    public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '')
563
+    public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
564 564
     {
565 565
         if (is_null($clickable_text)) {
566 566
             $clickable_text = $email;
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
         }
576 576
         // Encrypt email
577 577
         $hmail = '';
578
-        for ($i = 0; $i < strlen($email); $i ++) {
578
+        for ($i = 0; $i < strlen($email); $i++) {
579 579
             $hmail .= '&#'.ord($email {
580 580
             $i }).';';
581 581
         }
582 582
         $hclickable_text = null;
583 583
         // Encrypt clickable text if @ is present
584 584
         if (strpos($clickable_text, '@')) {
585
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
585
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
586 586
                 $hclickable_text .= '&#'.ord($clickable_text {
587 587
                 $i }).';';
588 588
             }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         }
615 615
         // Encrypt email
616 616
         $hmail = '';
617
-        for ($i = 0; $i < strlen($email); $i ++) {
617
+        for ($i = 0; $i < strlen($email); $i++) {
618 618
             $hmail .= '&#'.ord($email {
619 619
             $i }).';';
620 620
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     public static function get_alphabet_options($selected_letter = '')
648 648
     {
649 649
         $result = '';
650
-        for ($i = 65; $i <= 90; $i ++) {
650
+        for ($i = 65; $i <= 90; $i++) {
651 651
             $letter = chr($i);
652 652
             $result .= '<option value="'.$letter.'"';
653 653
             if ($selected_letter == $letter) {
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     public static function get_numeric_options($min, $max, $selected_num = 0)
669 669
     {
670 670
         $result = '';
671
-        for ($i = $min; $i <= $max; $i ++) {
671
+        for ($i = $min; $i <= $max; $i++) {
672 672
             $result .= '<option value="'.$i.'"';
673 673
             if (is_int($selected_num))
674 674
                 if ($selected_num == $i) {
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
             $size = ICON_SIZE_SMALL;
746 746
         }
747 747
 
748
-        $size_extra = $size . '/';
748
+        $size_extra = $size.'/';
749 749
 
750 750
         // Checking the img/ folder
751 751
         $icon = $w_code_path.'img/'.$image;
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
         $theme = 'themes/chamilo/icons/';
754 754
 
755 755
         if ($loadThemeIcon) {
756
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
756
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
757 757
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
758 758
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
759 759
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
         // ask for the SVG version directly
776 776
         $testServer = api_get_setting('server_type');
777 777
         if ($testServer == 'test' && $return_only_path == false) {
778
-            $svgImage = substr($image, 0, -3) . 'svg';
779
-            if (is_file($code_path . $theme . 'svg/' . $svgImage)) {
780
-                $icon = $w_code_path . $theme . 'svg/' . $svgImage;
781
-            } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) {
782
-                $icon = $w_code_path . 'img/icons/svg/' . $svgImage;
778
+            $svgImage = substr($image, 0, -3).'svg';
779
+            if (is_file($code_path.$theme.'svg/'.$svgImage)) {
780
+                $icon = $w_code_path.$theme.'svg/'.$svgImage;
781
+            } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) {
782
+                $icon = $w_code_path.'img/icons/svg/'.$svgImage;
783 783
             }
784 784
 
785 785
             if (empty($additional_attributes['height'])) {
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
             }
860 860
         }
861 861
         //some tags don't have this </XXX>
862
-        if (in_array($tag, array('img','input','br'))) {
862
+        if (in_array($tag, array('img', 'input', 'br'))) {
863 863
             $return_value = '<'.$tag.' '.$attribute_list.' />';
864 864
         } else {
865 865
             $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>';
@@ -912,13 +912,13 @@  discard block
 block discarded – undo
912 912
     public static function input($type, $name, $value, $attributes = array())
913 913
     {
914 914
          if (isset($type)) {
915
-             $attributes['type']= $type;
915
+             $attributes['type'] = $type;
916 916
          }
917 917
          if (isset($name)) {
918
-             $attributes['name']= $name;
918
+             $attributes['name'] = $name;
919 919
          }
920 920
          if (isset($value)) {
921
-             $attributes['value']= $value;
921
+             $attributes['value'] = $value;
922 922
         }
923 923
         return self::tag('input', '', $attributes);
924 924
     }
@@ -951,14 +951,14 @@  discard block
 block discarded – undo
951 951
     ) {
952 952
         $html = '';
953 953
         $extra = '';
954
-        $default_id = 'id="' . $name . '" ';
954
+        $default_id = 'id="'.$name.'" ';
955 955
         foreach ($extra_attributes as $key => $parameter) {
956 956
             if ($key == 'id') {
957 957
                 $default_id = '';
958 958
             }
959
-            $extra .= $key . '="' . $parameter . '" ';
959
+            $extra .= $key.'="'.$parameter.'" ';
960 960
         }
961
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
961
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
962 962
 
963 963
         if ($show_blank_item) {
964 964
             if (empty($blank_item_text)) {
@@ -966,14 +966,14 @@  discard block
 block discarded – undo
966 966
             } else {
967 967
                 $blank_item_text = Security::remove_XSS($blank_item_text);
968 968
             }
969
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
969
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
970 970
         }
971 971
         if ($values) {
972 972
             foreach ($values as $key => $value) {
973 973
                 if (is_array($value) && isset($value['name'])) {
974 974
                     $value = $value['name'];
975 975
                 }
976
-                $html .= '<option value="' . $key . '"';
976
+                $html .= '<option value="'.$key.'"';
977 977
 
978 978
                 if (is_array($default)) {
979 979
                     foreach ($default as $item) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
                     }
989 989
                 }
990 990
 
991
-                $html .= '>' . $value . '</option>';
991
+                $html .= '>'.$value.'</option>';
992 992
             }
993 993
         }
994 994
         $html .= '</select>';
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
      */
1015 1015
     public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array())
1016 1016
     {
1017
-        if (empty($header_list) || count($header_list) == 0 ) {
1017
+        if (empty($header_list) || count($header_list) == 0) {
1018 1018
             return '';
1019 1019
         }
1020 1020
 
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1053 1053
 
1054
-        return $main_div ;
1054
+        return $main_div;
1055 1055
     }
1056 1056
 
1057 1057
     /**
@@ -1099,8 +1099,8 @@  discard block
 block discarded – undo
1099 1099
      */
1100 1100
     public static function grid_html($div_id)
1101 1101
     {
1102
-        $table  = self::tag('table','', array('id' => $div_id));
1103
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1102
+        $table  = self::tag('table', '', array('id' => $div_id));
1103
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1104 1104
         return $table;
1105 1105
     }
1106 1106
 
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
         $obj->colNames      = $column_names;
1162 1162
         $obj->colModel      = $column_model;
1163 1163
         $obj->pager         = '#'.$div_id.'_pager';
1164
-        $obj->datatype  = 'json';
1164
+        $obj->datatype = 'json';
1165 1165
         $obj->viewrecords = 'true';
1166 1166
 
1167 1167
         $all_value = 10000000;
@@ -1224,10 +1224,10 @@  discard block
 block discarded – undo
1224 1224
         // Adding static data.
1225 1225
         if (!empty($data)) {
1226 1226
             $data_var = $div_id.'_data';
1227
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1227
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1228 1228
             $obj->data = $data_var;
1229 1229
             $obj->datatype = 'local';
1230
-            $json.="\n";
1230
+            $json .= "\n";
1231 1231
         }
1232 1232
 
1233 1233
         $obj->end = 'end';
@@ -1241,20 +1241,20 @@  discard block
 block discarded – undo
1241 1241
         }
1242 1242
 
1243 1243
         // Fixing true/false js values that doesn't need the ""
1244
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1244
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1245 1245
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1246 1246
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1247
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1247
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1248 1248
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1249
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1249
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1250 1250
         if (
1251 1251
             plagiarismActive()
1252 1252
             && plagiarismTool()
1253 1253
             == TOOL_COMPILATIO
1254
-            && ( strpos($_SERVER['REQUEST_URI'], 'work/work.php')
1254
+            && (strpos($_SERVER['REQUEST_URI'], 'work/work.php')
1255 1255
                 !== false
1256 1256
                 || strpos($_SERVER['REQUEST_URI'], 'work/work_list_all.php')
1257
-                != false )
1257
+                != false)
1258 1258
         ) {
1259 1259
             $json_encode = str_replace('"function () { compilatioInit() }"',
1260 1260
                 'function () { compilatioInit() }',
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
         }
1264 1264
 
1265 1265
         // Creating the jqgrid element.
1266
-        $json .= '$("#' . $div_id . '").jqGrid({';
1266
+        $json .= '$("#'.$div_id.'").jqGrid({';
1267 1267
         //$json .= $beforeSelectRow;
1268 1268
 
1269 1269
         $json .= $json_encode;
@@ -1275,22 +1275,22 @@  discard block
 block discarded – undo
1275 1275
             $groups = '';
1276 1276
             foreach ($extra_params['groupHeaders'] as $group) {
1277 1277
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1278
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1278
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1279 1279
 
1280 1280
             }
1281 1281
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1282 1282
                 "useColSpanStyle" : false,
1283 1283
                 "groupHeaders"    : [
1284
-                    ' . $groups . '
1284
+                    ' . $groups.'
1285 1285
                 ]
1286 1286
             });';
1287 1287
         }
1288 1288
 
1289 1289
         $all_text = addslashes(get_lang('All'));
1290 1290
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1291
-        $json.= "\n";
1291
+        $json .= "\n";
1292 1292
         // Adding edit/delete icons.
1293
-        $json.= $formatter;
1293
+        $json .= $formatter;
1294 1294
 
1295 1295
         return $json;
1296 1296
     }
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
         }
1322 1322
 
1323 1323
         if (!empty($rows)) {
1324
-	        foreach($rows as $content) {
1324
+	        foreach ($rows as $content) {
1325 1325
 	            $table->setCellContents($row, $column, $content);
1326 1326
                 $row++;
1327 1327
             }
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 
1484 1484
         // Show all tool icons where there is something new.
1485 1485
         $return = '&nbsp;';
1486
-        foreach($notifications as $notification) {
1486
+        foreach ($notifications as $notification) {
1487 1487
             $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
1488 1488
             $type = $notification['lastedit_type'];
1489 1489
             $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
@@ -1526,9 +1526,9 @@  discard block
 block discarded – undo
1526 1526
             $tbl_session            = Database :: get_main_table(TABLE_MAIN_SESSION);
1527 1527
             $active = false;
1528 1528
             // Request for the name of the general coach
1529
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1529
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1530 1530
                     FROM '.$tbl_session.' ts
1531
-                    LEFT JOIN '.$main_user_table .' tu
1531
+                    LEFT JOIN '.$main_user_table.' tu
1532 1532
                     ON ts.id_coach = tu.user_id
1533 1533
                     WHERE ts.id = '.intval($session_id);
1534 1534
             $rs = Database::query($sql);
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
             $session = array();
1539 1539
             $session['title'] = $session_info['name'];
1540 1540
             $session['coach'] = '';
1541
-            $session['dates'] =  '';
1541
+            $session['dates'] = '';
1542 1542
 
1543 1543
             if (
1544 1544
                 (
@@ -1620,8 +1620,8 @@  discard block
 block discarded – undo
1620 1620
                     );
1621 1621
                 }
1622 1622
 
1623
-                if ( api_get_setting('show_session_coach') === 'true' ) {
1624
-                    $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name(
1623
+                if (api_get_setting('show_session_coach') === 'true') {
1624
+                    $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name(
1625 1625
                         $session_info['firstname'],
1626 1626
                         $session_info['lastname']
1627 1627
                     );
@@ -1673,9 +1673,9 @@  discard block
 block discarded – undo
1673 1673
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1674 1674
 
1675 1675
 		if (!empty($percentage)) {
1676
-            $percentage = $percentage*125/100;
1676
+            $percentage = $percentage * 125 / 100;
1677 1677
         }
1678
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1678
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1679 1679
 
1680 1680
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1681 1681
 
@@ -1690,19 +1690,19 @@  discard block
 block discarded – undo
1690 1690
 
1691 1691
 		$labels = array();
1692 1692
 
1693
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1694
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1693
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1694
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1695 1695
 		if (!empty($number_of_users_who_voted)) {
1696
-			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1696
+			$labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5';
1697 1697
 		}
1698 1698
 
1699
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1699
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1700 1700
 
1701 1701
 		if (!$add_div_wrapper && api_is_anonymous()) {
1702
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1702
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1703 1703
 		}
1704 1704
 
1705
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1705
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1706 1706
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1707 1707
 
1708 1708
         if ($add_div_wrapper) {
@@ -1780,8 +1780,8 @@  discard block
 block discarded – undo
1780 1780
         if (!empty($list)) {
1781 1781
             $html = '<dl class="dl-horizontal">';
1782 1782
             foreach ($list as $item) {
1783
-                $html .= '<dt>' . $item['title'] . '</dt>';
1784
-                $html .= '<dd>' . $item['content'] . '</dd>';
1783
+                $html .= '<dt>'.$item['title'].'</dt>';
1784
+                $html .= '<dd>'.$item['content'].'</dd>';
1785 1785
             }
1786 1786
             $html .= '</dl>';
1787 1787
         }
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
      * @param string $type
1824 1824
      * @return null|string
1825 1825
      */
1826
-    public static function badge($count, $type ="warning")
1826
+    public static function badge($count, $type = "warning")
1827 1827
     {
1828 1828
         $class = '';
1829 1829
 
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
         if (!empty($content)) {
1900 1900
             $html = '<span class="label '.$class.'">';
1901 1901
             $html .= $content;
1902
-            $html .='</span>';
1902
+            $html .= '</span>';
1903 1903
         }
1904 1904
 
1905 1905
         return $html;
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
                     $class = 'class ="active"';
1921 1921
                 }
1922 1922
 
1923
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1923
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1924 1924
                     $class = 'class ="active"';
1925 1925
                 }
1926 1926
                 $html .= "<li $class >";
@@ -2171,7 +2171,7 @@  discard block
 block discarded – undo
2171 2171
         }
2172 2172
         $label = $nextValue + $localCounter + 1;
2173 2173
         if ($isMedia) {
2174
-            $label = ($fixedValue + 1) .' '.chr(97 + $localCounter);
2174
+            $label = ($fixedValue + 1).' '.chr(97 + $localCounter);
2175 2175
             $link_to_show = $link.$fixedValue.'#questionanchor'.$itemId;
2176 2176
         }
2177 2177
         $link = Display::url($label.' ', $link_to_show, $linkAttributes);
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
      */
2284 2284
     public static function getVCardUserLink($userId)
2285 2285
     {
2286
-        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
2286
+        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ;
2287 2287
 
2288 2288
         return $vCardUrl;
2289 2289
     }
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
     {
2302 2302
         $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : '';
2303 2303
         $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : '';
2304
-        $styles = ['primary','success','info','warning','danger'];
2304
+        $styles = ['primary', 'success', 'info', 'warning', 'danger'];
2305 2305
         $style = !in_array($style, $styles) ? 'default' : $style;
2306 2306
 
2307 2307
         return '
@@ -2346,7 +2346,7 @@  discard block
 block discarded – undo
2346 2346
         $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
2347 2347
 
2348 2348
         if (!$includeText) {
2349
-            $text = '<span class="sr-only">' . $text . '</span>';
2349
+            $text = '<span class="sr-only">'.$text.'</span>';
2350 2350
         }
2351 2351
 
2352 2352
         return self::url("$icon $text", $url, $attributes);
@@ -2361,16 +2361,16 @@  discard block
 block discarded – undo
2361 2361
      */
2362 2362
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2363 2363
     {
2364
-        $columns = 12/$col;
2364
+        $columns = 12 / $col;
2365 2365
         $html = '';
2366
-        $html .= '<div id="' . $id . '" class="actions">';
2366
+        $html .= '<div id="'.$id.'" class="actions">';
2367 2367
         $html .= '<div class="row">';
2368 2368
         if ($col > 4) {
2369 2369
             $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>';
2370 2370
         } else {
2371
-            for ( $i = 0; $i < $col; $i++ ) {
2372
-                $html .= '<div class="col-md-' . $columns . '">';
2373
-                if ( $col == 2 && $i == 1 ) {
2371
+            for ($i = 0; $i < $col; $i++) {
2372
+                $html .= '<div class="col-md-'.$columns.'">';
2373
+                if ($col == 2 && $i == 1) {
2374 2374
                     if ($right === true) {
2375 2375
                         $html .= '<div class="pull-right">';
2376 2376
                         $html .= (isset($content[$i]) ? $content[$i] : '');
@@ -2485,9 +2485,9 @@  discard block
 block discarded – undo
2485 2485
             $params['class'] = 'panel panel-default';
2486 2486
             $html = null;
2487 2487
             if (!empty($title)) {
2488
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2488
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2489 2489
             }
2490
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2490
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2491 2491
             $html = Display::div($html, $params);
2492 2492
         }
2493 2493
         return $html;
Please login to merge, or discard this patch.
main/work/work_list_all.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use ChamiloSession as Session;
5 5
 
6 6
 require_once '../inc/global.inc.php';
7
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
7
+$current_course_tool = TOOL_STUDENTPUBLICATION;
8 8
 
9 9
 api_protect_course_script(true);
10 10
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 $user_id = api_get_user_id();
45 45
 
46 46
 if (!empty($group_id)) {
47
-    $group_properties  = GroupManager :: get_group_properties($group_id);
47
+    $group_properties = GroupManager :: get_group_properties($group_id);
48 48
     $show_work = false;
49 49
 
50 50
     if (api_is_allowed_to_edit(false, true)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
162 162
     $actionsLeft .= Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
163 163
 
164
-    $actionsLeft .=  '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
164
+    $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
165 165
     $actionsLeft .= Display::return_icon('addworkuser.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>';
166 166
 
167 167
     $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId.'&action=export_pdf">';
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 $plagiarismListJqgridLine = array();
191 191
 if (plagiarismActive()) {
192 192
     if (plagiarismTool() == TOOL_COMPILATIO) {
193
-        require_once(api_get_path(SYS_CODE_PATH) . "/plagiarism/compilatio/config.php");
193
+        require_once(api_get_path(SYS_CODE_PATH)."/plagiarism/compilatio/config.php");
194 194
         $plagiarismTable = Database :: get_course_table(TABLE_COMPILATIO);
195 195
         $plagiarismListJqgridColumn = array('Compilatio');
196 196
         $plagiarismListJqgridLine = array(
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             . "gbox_results"
450 450
             .  '&amp;'
451 451
             . 'selectall=1" onclick="javascript: setCheckbox(true, \''
452
-            . "gbox_results". '\'); return false;">'
452
+            . "gbox_results".'\'); return false;">'
453 453
             . get_lang('SelectAll')
454 454
             . '</a>';
455 455
         $html .= '<a class="btn btn-default" href="?'
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 //            $html .= '<li><a data-action ="' . $action . '" href="#" onclick="javascript:action_click(this, \'' . "gbox_results" . '\');">' . $label . '</a></li>';
473 473
 //        }
474 474
         /*fin original*/
475
-        foreach ($form_action as $action ) {
475
+        foreach ($form_action as $action) {
476 476
             $html .= '<li><a data-action ="'
477 477
                 . $action["data-action"]
478 478
                 . '" href="#" '
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
                 . '</a></li>';
483 483
         }
484 484
         $html .= '</ul>';
485
-        $html .= '</div>';//btn-group
485
+        $html .= '</div>'; //btn-group
486 486
         $html .= '</div>'; //toolbar
487 487
     }
488 488
     echo $html;
@@ -491,19 +491,19 @@  discard block
 block discarded – undo
491 491
     $compTable = Database::get_course_table("plagiarism_compilatio_docs");
492 492
 
493 493
     $listCompilatioDocId = array();
494
-    $compilatioQuery = "SELECT * FROM " . $compTable . " WHERE c_id= " . $courseId;
494
+    $compilatioQuery = "SELECT * FROM ".$compTable." WHERE c_id= ".$courseId;
495 495
     $compilatioResult = Database::query($compilatioQuery);
496 496
     while ($compilatioData = Database::fetch_array($compilatioResult)) {
497 497
         array_push($listCompilatioDocId, $compilatioData['id_doc']);
498 498
     }
499 499
     $javascriptWorkId = "";
500
-    $sql = "SELECT * FROM " . $workTable . " WHERE c_id= " . $courseId . " AND parent_id= ". $workId. " AND active=1";
500
+    $sql = "SELECT * FROM ".$workTable." WHERE c_id= ".$courseId." AND parent_id= ".$workId." AND active=1";
501 501
     file_put_contents("/tmp/aaaSql", print_r($sql, 1)); // IDZ
502 502
     $res = Database::query($sql);
503 503
 
504 504
     while ($data = Database::fetch_array($res)) {
505 505
         if (in_array($data['id'], $listCompilatioDocId)) {
506
-            $javascriptWorkId .= $data['id'] . "a";
506
+            $javascriptWorkId .= $data['id']."a";
507 507
         }
508 508
     }
509 509
 }
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
     var refreshDelaisAfter = 30000;
528 528
     var allWorkId = "<?php echo $javascriptWorkId?>";
529 529
     var workFolderId = "<?php echo $workId; ?>";
530
-    var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH) . 'plagiarism/compilatio/' ?>";
530
+    var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/' ?>";
531 531
     var divExisteTimer = null;
532 532
     var msgWaitJS = '<?php echo Display::display_confirmation_message(get_lang('PleaseWaitThisCouldTakeAWhile')); ?>';
533 533
     var div = document.createElement('div');
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
             type: "get",
657 657
             dataType: "html",
658 658
             error: function(){
659
-                showData("<?php echo get_lang('compilatioComunicationAjaxImpossible');?>");
659
+                showData("<?php echo get_lang('compilatioComunicationAjaxImpossible'); ?>");
660 660
             },
661 661
             success: function( strData ){
662 662
                 showData( strData );
Please login to merge, or discard this patch.
main/work/work.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use ChamiloSession as Session;
9 9
 
10 10
 require_once '../inc/global.inc.php';
11
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
11
+$current_course_tool = TOOL_STUDENTPUBLICATION;
12 12
 
13 13
 api_protect_course_script(true);
14 14
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 $item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
40 40
 $origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
41 41
 $course_dir = api_get_path(SYS_COURSE_PATH).$_course['path'];
42
-$base_work_dir = $course_dir . '/work';
42
+$base_work_dir = $course_dir.'/work';
43 43
 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'list';
44 44
 
45 45
 //Download folder
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
77 77
         'name' => get_lang('StudentPublications'),
78 78
     );
79
-    $url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?&id=' . $work_id.'&'.api_get_cidreq();
79
+    $url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?&id='.$work_id.'&'.api_get_cidreq();
80 80
     if (!empty($my_folder_data)) {
81 81
         $interbreadcrumb[] = array('url' => $url_dir, 'name' =>  $my_folder_data['title']);
82 82
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditToolOptions'));
120 120
         }
121 121
         if ($action == 'create_dir') {
122
-            $interbreadcrumb[] = array('url' => '#','name' => get_lang('CreateAssignment'));
122
+            $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateAssignment'));
123 123
         }
124 124
     }
125 125
 }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         $form = new FormValidator(
171 171
             'form1',
172 172
             'post',
173
-            api_get_path(WEB_CODE_PATH) . 'work/work.php?action=create_dir&' . api_get_cidreq()
173
+            api_get_path(WEB_CODE_PATH).'work/work.php?action=create_dir&'.api_get_cidreq()
174 174
         );
175 175
         $form->addElement('header', get_lang('CreateAssignment'));
176 176
         $form->addElement('hidden', 'action', 'add');
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             $result = deleteDirWork($_REQUEST['id']);
208 208
             if ($result) {
209 209
                 $message = Display::return_message(
210
-                    get_lang('DirDeleted') . ': ' . $work_to_delete['title'],
210
+                    get_lang('DirDeleted').': '.$work_to_delete['title'],
211 211
                     'success'
212 212
                 );
213 213
                 Session::write('message', $message);
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
         if ($is_allowed_to_edit) {
236 236
             $move_to_path = get_work_path($_REQUEST['move_to_id']);
237 237
 
238
-            if ($move_to_path==-1) {
238
+            if ($move_to_path == -1) {
239 239
                 $move_to_path = '/';
240 240
             } elseif (substr($move_to_path, -1, 1) != '/') {
241
-                $move_to_path = $move_to_path .'/';
241
+                $move_to_path = $move_to_path.'/';
242 242
             }
243 243
 
244 244
             // Security fix: make sure they can't move files that are not in the document table
245 245
             if ($path = get_work_path($item_id)) {
246
-                if (move($course_dir.'/'.$path, $base_work_dir . $move_to_path)) {
246
+                if (move($course_dir.'/'.$path, $base_work_dir.$move_to_path)) {
247 247
                     // Update db
248 248
                     updateWorkUrl(
249 249
                         $item_id,
250
-                        'work' . $move_to_path,
250
+                        'work'.$move_to_path,
251 251
                         $_REQUEST['move_to_id']
252 252
                     );
253 253
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             $content .= '</div>';
346 346
             $content .= '</div>';
347 347
             $content .= '<div id="student-list-work" style="display: none" class="table-responsive">';
348
-            $content .= '<div class="toolbar"><a id="closed-view-list" href="#"><em class="fa fa-times-circle"></em> ' .get_lang('Close'). '</a></div>';
348
+            $content .= '<div class="toolbar"><a id="closed-view-list" href="#"><em class="fa fa-times-circle"></em> '.get_lang('Close').'</a></div>';
349 349
             $content .= showStudentList($work_id);
350 350
             $content .= '</div>';
351 351
         } else {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     var refreshDelaisAfter = 30000; // en ms pour chercher le % avancement de la detection
391 391
     var allWorkId = "<?php echo $javascriptWorkId?>";	// list of workid to check 1a5a6a7a8a9a10a11
392 392
     var workFolderId = "<?php echo $workId; ?>";
393
-    var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH) . 'plagiarism/compilatio/' ?>";
393
+    var compilationWebUrl = "<?php echo api_get_path(WEB_CODE_PATH).'plagiarism/compilatio/' ?>";
394 394
     var divExisteTimer = null;
395 395
 
396 396
     function compilatioInit() {
Please login to merge, or discard this patch.
main/admin/configure_extensions.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@  discard block
 block discarded – undo
4 4
  * Edition of extensions configuration
5 5
  * @package chamilo.admin
6 6
  */
7
-$cidReset=true;
7
+$cidReset = true;
8 8
 require_once '../inc/global.inc.php';
9
-$this_section=SECTION_PLATFORM_ADMIN;
9
+$this_section = SECTION_PLATFORM_ADMIN;
10 10
 api_protect_admin_script();
11
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
11
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
12 12
 // Database Table Definitions
13 13
 $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
14 14
 $message = '';
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 					WHERE variable="service_visio"
22 22
 					AND subkey="active"';
23 23
 			$rs = Database::query($sql);
24
-			if (Database::affected_rows($rs)>0) {
24
+			if (Database::affected_rows($rs) > 0) {
25 25
 				// select all the courses and insert the tool inside
26 26
 				$sql = 'SELECT id FROM '.Database::get_main_table(TABLE_MAIN_COURSE);
27 27
 				$rs = Database::query($sql);
28
-				while($row = Database::fetch_array($rs)){
29
-					if(!empty($_POST['visio_host'])) {
28
+				while ($row = Database::fetch_array($rs)) {
29
+					if (!empty($_POST['visio_host'])) {
30 30
 						$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
31 31
 						$select = "SELECT id FROM $tool_table WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CONFERENCE."'";
32 32
 						$selectres = Database::query($select);
33
-						if (Database::num_rows($selectres)<1) {
33
+						if (Database::num_rows($selectres) < 1) {
34 34
 							$sql = 'INSERT INTO '.$tool_table.' SET
35 35
 							        c_id =  '.$row['id'].',
36 36
 									name="'.TOOL_VISIO_CONFERENCE.'",
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 						}
46 46
 						$select = "SELECT id FROM $tool_table WHERE c_id =".$row['id']." AND name='".TOOL_VISIO_CLASSROOM."'";
47 47
 						$selectres = Database::query($select);
48
-						if(Database::num_rows($selectres)<1) {
48
+						if (Database::num_rows($selectres) < 1) {
49 49
 							$sql = 'INSERT INTO '.$tool_table.' SET
50 50
 							        c_id =  '.$row['id'].',
51 51
 									name="'.TOOL_VISIO_CLASSROOM.'",
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 			$rs = Database::query($sql);
83 83
 
84 84
 			$sql = 'UPDATE '.$tbl_settings_current.' SET
85
-					selected_value="'.($_POST['visio_use_rtmpt']=='true'?'true':'false').'"
85
+					selected_value="'.($_POST['visio_use_rtmpt'] == 'true' ? 'true' : 'false').'"
86 86
 					WHERE variable="service_visio"
87 87
 					AND subkey="visio_use_rtmpt"';
88 88
 			$rs = Database::query($sql);
89 89
 
90
-			if(empty($message)) {
90
+			if (empty($message)) {
91 91
 				$message = get_lang('ServiceReconfigured');
92 92
 			}
93 93
 			break;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 			$rs = Database::query($sql);
102 102
 
103
-			if (Database::affected_rows($rs)>0){
103
+			if (Database::affected_rows($rs) > 0) {
104 104
 				$message = get_lang('ServiceActivated');
105 105
 			}
106 106
 
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
 		WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
154 154
 
155 155
 $rs = Database::query($sql);
156
-while($row = Database::fetch_array($rs)){
156
+while ($row = Database::fetch_array($rs)) {
157 157
 	$listActiveServices[] = $row['variable'];
158 158
 }
159 159
 
160 160
 // javascript to handle accordion behaviour
161 161
 $javascript_message = '';
162
-if(!empty($message)){
162
+if (!empty($message)) {
163 163
 	$javascript_message =
164 164
 	'
165 165
 	document.getElementById("message").style.display = "block";
166 166
 	var timer = setTimeout(hideMessage,5000);
167 167
 	';
168 168
 }
169
-$htmlHeadXtra[]= '
169
+$htmlHeadXtra[] = '
170 170
 <script type="text/javascript">
171 171
 var listeDiv;
172 172
 var extensionsHeader = new Array();
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 ?>
216 216
 <div id="message" style="display: none">
217 217
 	<?php
218
-	if(!empty($message))
218
+	if (!empty($message))
219 219
 		Display::display_normal_message($message)
220 220
 	?>
221 221
 </div>
@@ -330,13 +330,13 @@  discard block
 block discarded – undo
330 330
 						$renderer = $form -> defaultRenderer();
331 331
 						$renderer -> setElementTemplate('<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>');
332 332
 						//$form -> addElement('html','<br /><br />');
333
-						if(in_array('service_ppt2lp',$listActiveServices))
333
+						if (in_array('service_ppt2lp', $listActiveServices))
334 334
 						{
335 335
 							$sql = 'SELECT subkey, selected_value FROM '.$tbl_settings_current.'
336 336
 									WHERE variable = "service_ppt2lp"
337 337
 									AND subkey <> "active"';
338 338
 							$rs = Database::query($sql);
339
-							while($row = Database::fetch_array($rs,'ASSOC'))
339
+							while ($row = Database::fetch_array($rs, 'ASSOC'))
340 340
 							{
341 341
 								$defaults[$row['subkey']] = $row['selected_value'];
342 342
 							}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 <!-- COMPILATIO -->
503 503
 <div id="main_compilatio">
504 504
     <div id="extension_header_compilatio" class="accordion_header">
505
-        <a href="#"><?php echo get_lang('compilatioPlagiarismDetector');?></a>
505
+        <a href="#"><?php echo get_lang('compilatioPlagiarismDetector'); ?></a>
506 506
     </div>
507 507
     <div id="extension_content_compilatio" style="display:none;padding:0;width:780px;" class="accordion_content">
508 508
         <table width="100%" cellpadding="0" cellspacing="0">
Please login to merge, or discard this patch.
main/plagiarism/compilatio/download.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,31 +29,31 @@
 block discarded – undo
29 29
 $course_info = api_get_course_info();
30 30
 
31 31
 if (empty($course_info)) {
32
-	api_not_allowed(true);
32
+    api_not_allowed(true);
33 33
 }
34 34
 
35 35
 $tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
36 36
 
37 37
 if (!empty($course_info['real_id'])) {    
38
-	$sql = 'SELECT * FROM '.$tbl_student_publication.' WHERE c_id = '.$course_info['real_id'].' AND id = "'.$id.'"';
39
-	$result = Database::query($sql);
40
-	if ($result && Database::num_rows($result)) {
41
-	    $row = Database::fetch_array($result, 'ASSOC');        
38
+    $sql = 'SELECT * FROM '.$tbl_student_publication.' WHERE c_id = '.$course_info['real_id'].' AND id = "'.$id.'"';
39
+    $result = Database::query($sql);
40
+    if ($result && Database::num_rows($result)) {
41
+        $row = Database::fetch_array($result, 'ASSOC');        
42 42
         $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$row['url'];
43 43
            
44 44
         $item_info = api_get_item_property_info(api_get_course_int_id(), 'work', $row['id']);           
45 45
         if (empty($item_info)) {
46 46
             exit;
47 47
         }          	    
48
-	    if ($course_info['show_score'] == 0 || $item_info['visibility'] == 1 && $row['accepted'] == 1 && ($row['user_id'] == api_get_user_id() || api_is_allowed_to_edit())) {
49
-		    $title = str_replace(' ', '_', $row['title']);
48
+        if ($course_info['show_score'] == 0 || $item_info['visibility'] == 1 && $row['accepted'] == 1 && ($row['user_id'] == api_get_user_id() || api_is_allowed_to_edit())) {
49
+            $title = str_replace(' ', '_', $row['title']);
50 50
             event_download($title);
51
-		    if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/')) {
52
-		        DocumentManager::file_send_for_download($full_file_name, true, $title);
53
-		    }
54
-	    } else {
51
+            if (Security::check_abs_path($full_file_name, api_get_path(SYS_COURSE_PATH).api_get_course_path().'/')) {
52
+                DocumentManager::file_send_for_download($full_file_name, true, $title);
53
+            }
54
+        } else {
55 55
             api_not_allowed();
56 56
         }	    
57
-	}
57
+    }
58 58
 }
59 59
 exit;
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 session_cache_limiter('public');
14 14
 require_once '../inc/global.inc.php';
15
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
15
+$current_course_tool = TOOL_STUDENTPUBLICATION;
16 16
 
17 17
 $this_section = SECTION_COURSES;
18 18
 
Please login to merge, or discard this patch.
main/plagiarism/compilatio/compiladmin.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,62 +1,62 @@  discard block
 block discarded – undo
1 1
 <?php
2
-  /*
2
+    /*
3 3
   Module Compilatio v0.9 pour Dokeos
4 4
   */
5
-  /*
5
+    /*
6 6
    * admin's section:  allow to see the credit's quota and do a SOAP's connection test
7 7
    * Partie admin: permet de voir le quotas de cr?dit et de faire un test de connexion SOAP
8 8
   */
9
-  ini_set('soap.wsdl_cache_enabled', 0);
10
-  ini_set('default_socket_timeout', '1000');
9
+    ini_set('soap.wsdl_cache_enabled', 0);
10
+    ini_set('default_socket_timeout', '1000');
11 11
 
12
-  require_once '../../inc/lib/api.lib.php';
13
-  require_once '../compilatio/compilatio.class.php';
14
-  require_once '../compilatio/config.php';
12
+    require_once '../../inc/lib/api.lib.php';
13
+    require_once '../compilatio/compilatio.class.php';
14
+    require_once '../compilatio/config.php';
15 15
 
16
-  $compilatio = new compilatio(
17
-      $compilatioParameter['key'],
18
-      $compilatioParameter['$urlsoap'],
19
-      $compilatioParameter['proxy_host'],
20
-      $compilatioParameter['proxy_port']
21
-  );
22
-  $use_space = number_format($quotas->usedSpace/1000000, 2);
23
-  $total_space=$quotas->space/1000000;
16
+    $compilatio = new compilatio(
17
+        $compilatioParameter['key'],
18
+        $compilatioParameter['$urlsoap'],
19
+        $compilatioParameter['proxy_host'],
20
+        $compilatioParameter['proxy_port']
21
+    );
22
+    $use_space = number_format($quotas->usedSpace/1000000, 2);
23
+    $total_space=$quotas->space/1000000;
24 24
 
25
-  echo "<h3>" . get_lang('compilatioDescription') . "</h3>";
25
+    echo "<h3>" . get_lang('compilatioDescription') . "</h3>";
26 26
 
27
-  echo "<b>"
28
-      . get_lang('compilatioQuota')
29
-      . ":"
30
-      . " </b><br>"
31
-      . get_lang('compilatioCredit')
32
-      . ": "
33
-      . $quotas->usedCredits
34
-      . get_lang('compilatioOn')
35
-      . $quotas->credits;
27
+    echo "<b>"
28
+        . get_lang('compilatioQuota')
29
+        . ":"
30
+        . " </b><br>"
31
+        . get_lang('compilatioCredit')
32
+        . ": "
33
+        . $quotas->usedCredits
34
+        . get_lang('compilatioOn')
35
+        . $quotas->credits;
36 36
 
37 37
 ?>
38 38
 <br><br>
39 39
 <?
40
-  if(!isset($_GET['action']))
41
-  {
40
+    if(!isset($_GET['action']))
41
+    {
42 42
 ?>
43 43
 <body style="margin:0px;padding:0px">
44 44
 <form style="margin:0px;" method="GET">
45 45
   <input type="submit" name="action" value="Test de Connexion SOAP">
46 46
 </form>
47 47
 <?
48
-  } else {
49
-  echo get_lang('compilatioConnectionTestSoap')."<br>";
50
-  echo "1) ".get_lang('compilatioServerConnection')."<br>";
51
-  $compilatio = new compilatio(
52
-      $compilatioParameter['key'],
53
-      $compilatioParameter['$urlsoap'],
54
-      $compilatioParameter['proxy_host'],
55
-      $compilatioParameter['proxy_port']
56
-  );
48
+    } else {
49
+    echo get_lang('compilatioConnectionTestSoap')."<br>";
50
+    echo "1) ".get_lang('compilatioServerConnection')."<br>";
51
+    $compilatio = new compilatio(
52
+        $compilatioParameter['key'],
53
+        $compilatioParameter['$urlsoap'],
54
+        $compilatioParameter['proxy_host'],
55
+        $compilatioParameter['proxy_port']
56
+    );
57 57
 
58
-  if ($compilatio)
59
-  {
58
+    if ($compilatio)
59
+    {
60 60
     echo get_lang('compilatioConnectionAccomplished')."<br>";
61 61
     echo "2) ".get_lang('compilatioSendTextToServer')."<br>";
62 62
     $text = get_lang('compilatioTestSendText'). $compilatioParameter['key'];
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         $text
69 69
     );
70 70
     if (isMd5($id_compi)) {
71
-      echo get_lang('compilatioSuccessfulTransfer')."<br>";
71
+        echo get_lang('compilatioSuccessfulTransfer')."<br>";
72 72
     } else {
73
-      echo get_lang('compilatioFailedTransfer')."<br>";
73
+        echo get_lang('compilatioFailedTransfer')."<br>";
74 74
     }
75
-  } else {
75
+    } else {
76 76
     echo get_lang('compilatioNotConnection')."<br>";
77 77
     echo get_lang('compilatioParamVerification')."<br>";
78
-  }
78
+    }
79 79
 }
80 80
 ?>
81 81
 </body>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
       $compilatioParameter['proxy_host'],
20 20
       $compilatioParameter['proxy_port']
21 21
   );
22
-  $use_space = number_format($quotas->usedSpace/1000000, 2);
23
-  $total_space=$quotas->space/1000000;
22
+  $use_space = number_format($quotas->usedSpace / 1000000, 2);
23
+  $total_space = $quotas->space / 1000000;
24 24
 
25
-  echo "<h3>" . get_lang('compilatioDescription') . "</h3>";
25
+  echo "<h3>".get_lang('compilatioDescription')."</h3>";
26 26
 
27 27
   echo "<b>"
28 28
       . get_lang('compilatioQuota')
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 ?>
38 38
 <br><br>
39 39
 <?
40
-  if(!isset($_GET['action']))
40
+  if (!isset($_GET['action']))
41 41
   {
42 42
 ?>
43 43
 <body style="margin:0px;padding:0px">
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
   {
60 60
     echo get_lang('compilatioConnectionAccomplished')."<br>";
61 61
     echo "2) ".get_lang('compilatioSendTextToServer')."<br>";
62
-    $text = get_lang('compilatioTestSendText'). $compilatioParameter['key'];
62
+    $text = get_lang('compilatioTestSendText').$compilatioParameter['key'];
63 63
     $id_compi = $compilatio->SendDoc(
64 64
         'Doc de test',
65 65
         'test',
Please login to merge, or discard this patch.