Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/document/slideshow.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 if ($slide_id != 'all') {
65 65
 	$image = null;
66 66
 	if (isset($image_files_only[$slide])) {
67
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
67
+		$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
68 68
 	}
69 69
 	if (file_exists($image)) {
70 70
 		echo '<div class="actions-pagination">';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
106 106
 		} else {
107 107
 			$imgn = 'action_next.png';
108
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
108
+			$last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'">
109 109
 			        '.Display::return_icon('action_last.png', get_lang('LastSlide')).'
110 110
                 </a>';
111 111
 		}
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 
123 123
 // Exit the slideshow
124 124
 echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
125
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
125
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
126 126
 
127 127
 // Show thumbnails
128 128
 if ($slide_id != 'all') {
129 129
 	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
130
-        Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>';
130
+        Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>';
131 131
 } else {
132
-	echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
132
+	echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM);
133 133
 }
134 134
 // Slideshow options
135 135
 echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
136
-    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>';
136
+    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>';
137 137
 
138 138
 echo '</div>';
139 139
 echo '<br />';
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 }
158 158
 $target_width = $target_height = null;
159 159
 // The target height and width depends if we choose resizing or no resizing
160
-if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
160
+if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") {
161 161
 	$target_width = $_SESSION["image_resizing_width"];
162 162
 	$target_height = $_SESSION["image_resizing_height"];
163 163
 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 /*	THUMBNAIL VIEW */
166 166
 
167 167
 // This is for viewing all the images in the slideshow as thumbnails.
168
-$image_tag = array ();
168
+$image_tag = array();
169 169
 $html = '';
170 170
 if ($slide_id == 'all') {
171 171
 
@@ -173,16 +173,16 @@  discard block
 block discarded – undo
173 173
     $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
174 174
 	$max_thumbnail_width     = 250;
175 175
 	$max_thumbnail_height    = 250;
176
-	$png_compression	     = 0;//0(none)-9
177
-	$jpg_quality  	         = 75;//from 0 to 100 (default is 75). More quality less compression
176
+	$png_compression	     = 0; //0(none)-9
177
+	$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
178 178
 
179 179
 	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
180 180
 
181 181
 	//Other parameters only for show tumbnails
182
-	$row_items 			     = 4;//only in slideshow.php
183
-	$number_image 			 = 7;//num icons cols to show
184
-	$thumbnail_width_frame=$max_thumbnail_width;//optional $max_thumbnail_width+x
185
-	$thumbnail_height_frame=$max_thumbnail_height;
182
+	$row_items = 4; //only in slideshow.php
183
+	$number_image = 7; //num icons cols to show
184
+	$thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x
185
+	$thumbnail_height_frame = $max_thumbnail_height;
186 186
 
187 187
 	// Create the template_thumbnails folder (if no exist)
188 188
 
@@ -195,20 +195,20 @@  discard block
 block discarded – undo
195 195
 
196 196
 		foreach ($image_files_only as $one_image_file) {
197 197
 			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
198
+			$image_thumbnail = $directory_thumbnails.'.'.$one_image_file;
199 199
 
200 200
 			if (file_exists($image)) {
201 201
 				//check thumbnail
202 202
 				$imagetype = explode(".", $image);
203 203
                 //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
204
-				$imagetype = strtolower($imagetype[count($imagetype)-1]);
204
+				$imagetype = strtolower($imagetype[count($imagetype) - 1]);
205 205
 
206
-				if(in_array($imagetype,$allowed_thumbnail_types)) {
207
-					if (!file_exists($image_thumbnail)){
206
+				if (in_array($imagetype, $allowed_thumbnail_types)) {
207
+					if (!file_exists($image_thumbnail)) {
208 208
                         //run each once we view thumbnails is too heavy, then need move into  !file_exists($image_thumbnail, and only run when haven't the thumbnail
209 209
 						$original_image_size = api_getimagesize($image);
210 210
 
211
-						switch($imagetype) {
211
+						switch ($imagetype) {
212 212
 							case 'gif':
213 213
 								$source_img = imagecreatefromgif($image);
214 214
 								break;
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
                             $max_thumbnail_height
231 231
                         );
232 232
 
233
-						if($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
234
-							$new_thumbnail_size['width']=$original_image_size['width'];
235
-							$new_thumbnail_size['height']=$original_image_size['height'];
233
+						if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) {
234
+							$new_thumbnail_size['width'] = $original_image_size['width'];
235
+							$new_thumbnail_size['height'] = $original_image_size['height'];
236 236
 						}
237 237
 
238 238
 						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
239 239
 
240 240
 						// preserve transparency
241
-						if($imagetype == "png"){
241
+						if ($imagetype == "png") {
242 242
 							imagesavealpha($crop, true);
243
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
+							$color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127);
244 244
 							imagefill($crop, 0, 0, $color);
245 245
 						}
246 246
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 							$transindex = imagecolortransparent($source_img);
249 249
                             $palletsize = imagecolorstotal($source_img);
250 250
 							 //GIF89a for transparent and anim (first clip), either GIF87a
251
-							 if ($transindex >= 0 && $transindex < $palletsize){
251
+							 if ($transindex >= 0 && $transindex < $palletsize) {
252 252
 								 $transcol = imagecolorsforindex($source_img, $transindex);
253 253
 								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
254 254
 								 imagefill($crop, 0, 0, $transindex);
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 
273 273
 						switch ($imagetype) {
274 274
 							case 'gif':
275
-								imagegif($crop,$image_thumbnail);
275
+								imagegif($crop, $image_thumbnail);
276 276
 								break;
277 277
 							case 'jpg':
278
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
279 279
 								break;
280 280
 							case 'jpeg':
281
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
282 282
 								break;
283 283
 							case 'png':
284
-								imagepng($crop,$image_thumbnail,$png_compression);
284
+								imagepng($crop, $image_thumbnail, $png_compression);
285 285
 								break;
286 286
 						}
287 287
 
@@ -291,26 +291,26 @@  discard block
 block discarded – undo
291 291
 
292 292
 					//show thumbnail and link
293 293
 
294
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
+					$one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail
295 295
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
296 296
 					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
297 297
 				} else {
298 298
 					//if images aren't support by gd (not gif, jpg, jpeg, png)
299
-					if ($imagetype=="bmp") {
299
+					if ($imagetype == "bmp") {
300 300
                         // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
301 301
 						$original_image_size = getimagesize($image);
302
-						if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
303
-							$thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
302
+						if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) {
303
+							$thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files
304 304
 							$image_height = $thumbnail_size['height'];
305 305
 							$image_width  = $thumbnail_size['width'];
306 306
 						} else {
307
-							$image_height=$original_image_size[0];
308
-							$image_width=$original_image_size[1];
307
+							$image_height = $original_image_size[0];
308
+							$image_width = $original_image_size[1];
309 309
 						}
310 310
 					} else {
311 311
 						//example for svg files,...
312
-						$image_width=$max_thumbnail_width;
313
-						$image_height=$max_thumbnail_height;
312
+						$image_width = $max_thumbnail_width;
313
+						$image_height = $max_thumbnail_height;
314 314
 					}
315 315
 
316 316
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
 	$i = 0;
328 328
 	$count_image = count($image_tag);
329
-	$number_iteration = ceil($count_image/$number_image);
329
+	$number_iteration = ceil($count_image / $number_image);
330 330
 	$p = 0;
331 331
     $html = '';
332 332
     $html .= '<div class="gallery">';
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
339 339
                             $html .= '<div class="frame">';
340 340
                             $html .= '<div class="photo">';
341
-                            $html .=  $image_tag[$p];
341
+                            $html .= $image_tag[$p];
342 342
                             $html .= '</div>';
343 343
                             $html .= '</div>';
344 344
                             $html .= '</a>';
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 		list($width, $height) = getimagesize($image);
395 395
 		// Auto resize
396
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
396
+		if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
397 397
 		?>
398 398
 
399 399
 		<script type="text/javascript">
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				start_height=initial_height;
411 411
 			}
412 412
 
413
-			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide] ;?>">');
413
+			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide]; ?>">');
414 414
 
415 415
 			function resizeImage() {
416 416
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		echo '</a>';
455 455
         echo '<div class="caption text-center">';
456 456
         echo Display::tag('h3', $row['title']);
457
-        echo '<p>' . $row['comment'] . '</p>';
457
+        echo '<p>'.$row['comment'].'</p>';
458 458
         echo '</div>';
459 459
         echo '</div>';
460 460
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                 $resize_info = get_lang('Resizing').'<br />';
468 468
                 $resize_width = $_SESSION["image_resizing_width"].' x ';
469 469
                 $resize_height = $_SESSION['image_resizing_height'];
470
-            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){
470
+            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') {
471 471
                 $resize_info = get_lang('Resizing').'<br />';
472 472
                 $resize_width = get_lang('Auto').' x ';
473 473
                 $resize_height = get_lang('Auto');
@@ -478,10 +478,10 @@  discard block
 block discarded – undo
478 478
             }
479 479
 
480 480
             echo '<li class="text-center">';
481
-            echo $image_files_only[$slide] . ' ';
481
+            echo $image_files_only[$slide].' ';
482 482
             echo Display::toolbarButton(
483 483
                 get_lang('Modify'),
484
-                'edit_document.php?' . api_get_cidreq() . '&' . http_build_query([
484
+                'edit_document.php?'.api_get_cidreq().'&'.http_build_query([
485 485
                     'id' => $row['id'],
486 486
                     'origin' => 'slideshow',
487 487
                     'origin_opt' => $edit_slide_id,
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
                 false
494 494
             );
495 495
             echo '</li>';
496
-            echo '<li class="text-center">' . $width.' x '.$height . '</li>';
497
-			echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
498
-            echo '<li class="text-center">' . $resize_info . '</li>';
499
-			echo '<li class="text-center">' . $resize_width . '</li>';
500
-			echo '<li class="text-center">' . $resize_height . '</li>';
496
+            echo '<li class="text-center">'.$width.' x '.$height.'</li>';
497
+			echo '<li class="text-center">'.round((filesize($image) / 1024), 2).' KB - '.$ext.'</li>';
498
+            echo '<li class="text-center">'.$resize_info.'</li>';
499
+			echo '<li class="text-center">'.$resize_width.'</li>';
500
+			echo '<li class="text-center">'.$resize_height.'</li>';
501 501
             echo '</ul>';
502 502
 		}
503 503
 
Please login to merge, or discard this patch.
main/admin/languages.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 SubLanguageManager::make_unavailable_language($_POST['id']);
36 36
                 echo 'set_hidden';
37 37
             } else {
38
-                echo 'confirm:' . intval($_POST['id']);
38
+                echo 'confirm:'.intval($_POST['id']);
39 39
             }
40 40
         }
41 41
     }
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
     var disabledLang = "'.$disabledLang.'"
58 58
 
59 59
     if (msgLang == 1) {
60
-        $("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually') . ' <br /> " + disabledLang + "</div");
60
+        $("#id_content_message").html("<div class=\"warning-message alert alert-warning\">' . get_lang('ThereAreUsersUsingThisLanguagesDisableItManually').' <br /> " + disabledLang + "</div");
61 61
     }
62 62
 
63 63
     $("#disable_all_except_default").click(function () {
64
-        if(confirm("'. get_lang('ConfirmYourChoice') .'")) {
64
+        if(confirm("'. get_lang('ConfirmYourChoice').'")) {
65 65
             $.ajax({
66 66
                 contentType: "application/x-www-form-urlencoded",
67 67
                 beforeSend: function(objeto) {
68
-                    $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading') . '</div>");
68
+                    $("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading').'</div>");
69 69
                 },
70 70
                 type: "GET",
71 71
                 url: "../admin/languages.php",
72 72
                 data: "action=disable_all_except_default",
73 73
                 success: function(datos) {
74
-                    window.location.href = "' . api_get_self() . '";
74
+                    window.location.href = "' . api_get_self().'";
75 75
                 }
76 76
             });
77 77
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$.ajax({
108 108
 			contentType: "application/x-www-form-urlencoded",
109 109
 			beforeSend: function(objeto) {
110
-				$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading') . '</div>");
110
+				$("#id_content_message").html("<div class=\"warning-message alert alert-warning\"><em class=\"fa fa-refresh fa-spin\"></em>  ' . get_lang('Loading').'</div>");
111 111
 			},
112 112
 			type: "POST",
113 113
 			url: "../admin/languages.php",
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
                     $("#"+id_img_link_tool).attr("src",path_name_of_imglinktool);
119 119
 
120 120
                     if (my_image_tool=="visible.png") {
121
-                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '') . '");
122
-                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeAvailable', '') . '");
121
+                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeAvailable', '').'");
122
+                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeAvailable', '').'");
123 123
                     } else {
124
-                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeUnavailable', '') . '");
125
-                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeUnavailable', '') . '");
124
+                        $("#"+id_img_link_tool).attr("alt","' . get_lang('MakeUnavailable', '').'");
125
+                        $("#"+id_img_link_tool).attr("title","' . get_lang('MakeUnavailable', '').'");
126 126
                     }
127 127
 
128 128
                     if (datos=="set_visible") {
129
-                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowVisible', '') . '</div>");
129
+                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowVisible', '').'</div>");
130 130
                     }
131 131
 
132 132
                     if (datos=="set_hidden") {
133
-                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowHidden', '') . '</div>");
133
+                        $("#id_content_message").html("<div class=\"confirmation-message alert alert-success\">' . get_lang('LanguageIsNowHidden', '').'</div>");
134 134
                     }
135 135
                 }
136 136
 
137 137
                 var action = datos.split(":")[0];
138 138
                 if (action && action == "confirm") {
139 139
                     var id = datos.split(":")[1];
140
-                    var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'<br /><br /><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> ' . get_lang('MakeUnavailable') . '</a></div>";
140
+                    var sure = "<div class=\"warning-message alert alert-warning\">'.get_lang('ThereAreUsersUsingThisLanguageYouWantToDisableThisLanguageAndSetUsersWithTheDefaultPortalLanguage').'<br /><br /><a href=\"languages.php?action=make_unavailable_confirmed&id="+id+"\" class=\"btn btn-default\"><em class=\"fa fa-eye\"></em> '.get_lang('MakeUnavailable').'</a></div>";
141 141
                     $("#id_content_message").html(sure);
142 142
                     $("html, body").animate({ scrollTop: 0 }, 200);
143 143
 				}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
             SubLanguageManager::make_unavailable_language($language['id']);
183 183
         } else {
184 184
             if (intval(SubLanguageManager::get_platform_language_id()) !== intval($language['id'])) {
185
-                $failedDisabledLanguages .= ' - ' .$language['english_name'] . '<br />';
185
+                $failedDisabledLanguages .= ' - '.$language['english_name'].'<br />';
186 186
                 $checkFailed = true;
187 187
             }
188 188
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 foreach ($_POST['id'] as $index => $id) {
214 214
                     $ids[] = intval($id);
215 215
                 }
216
-                $sql = "UPDATE $tbl_admin_languages SET available='1' WHERE id IN ('" . implode("','", $ids) . "')";
216
+                $sql = "UPDATE $tbl_admin_languages SET available='1' WHERE id IN ('".implode("','", $ids)."')";
217 217
                 Database::query($sql);
218 218
             }
219 219
             break;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                 foreach ($_POST['id'] as $index => $id) {
224 224
                     $ids[] = intval($id);
225 225
                 }
226
-                $sql = "UPDATE $tbl_admin_languages SET available='0' WHERE id IN ('" . implode("','", $ids) . "')";
226
+                $sql = "UPDATE $tbl_admin_languages SET available='0' WHERE id IN ('".implode("','", $ids)."')";
227 227
                 Database::query($sql);
228 228
             }
229 229
             break;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 // displaying the explanation for this tool
253 253
 Display::display_normal_message(get_lang('PlatformLanguagesExplanation'));
254 254
 
255
-echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> ' . get_lang('LanguagesDisableAllExceptDefault') . '</a><br /><br />';
255
+echo '<a id="disable_all_except_default" href="javascript:void(0)" class="btn btn-primary"><em class="fa fa-eye"></em> '.get_lang('LanguagesDisableAllExceptDefault').'</a><br /><br />';
256 256
 
257 257
 // selecting all the languages
258 258
 $sql_select = "SELECT * FROM $tbl_admin_languages";
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
             $checked = ' checked="checked" ';
274 274
         }
275 275
 
276
-        $row_td[] = '<input type="hidden" name="edit_id" value="' . Security::remove_XSS($_GET['id']) . '" /><input type="text" name="txt_name" value="' . $row['original_name'] . '" /> '
277
-                . '<input type="checkbox" ' . $checked . 'name="platformlanguage" id="platformlanguage" value="' . $row['english_name'] . '" /><label for="platformlanguage">' . $row['original_name'] . ' ' . get_lang('AsPlatformLanguage') . '</label> <input type="submit" name="Submit" value="' . get_lang('Ok') . '" /><a name="value" />';
276
+        $row_td[] = '<input type="hidden" name="edit_id" value="'.Security::remove_XSS($_GET['id']).'" /><input type="text" name="txt_name" value="'.$row['original_name'].'" /> '
277
+                . '<input type="checkbox" '.$checked.'name="platformlanguage" id="platformlanguage" value="'.$row['english_name'].'" /><label for="platformlanguage">'.$row['original_name'].' '.get_lang('AsPlatformLanguage').'</label> <input type="submit" name="Submit" value="'.get_lang('Ok').'" /><a name="value" />';
278 278
     } else {
279 279
         $row_td[] = $row['original_name'];
280 280
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     if ($row['english_name'] == $row_lang['selected_value']) {
289 289
         $setplatformlanguage = Display::return_icon('languages.png', get_lang('CurrentLanguagesPortal'), '', ICON_SIZE_SMALL);
290 290
     } else {
291
-        $setplatformlanguage = "<a href=\"javascript:if (confirm('" . addslashes(get_lang('AreYouSureYouWantToSetThisLanguageAsThePortalDefault')) . "')) { location.href='" . api_get_self() . "?action=setplatformlanguage&id=" . $row['id'] . "'; }\">" . Display::return_icon('languages_na.png', get_lang('SetLanguageAsDefault'), '', ICON_SIZE_SMALL) . "</a>";
291
+        $setplatformlanguage = "<a href=\"javascript:if (confirm('".addslashes(get_lang('AreYouSureYouWantToSetThisLanguageAsThePortalDefault'))."')) { location.href='".api_get_self()."?action=setplatformlanguage&id=".$row['id']."'; }\">".Display::return_icon('languages_na.png', get_lang('SetLanguageAsDefault'), '', ICON_SIZE_SMALL)."</a>";
292 292
     }
293 293
 
294 294
     $allow_delete_sub_language = null;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
         if ($verified_if_is_sub_language === false) {
302 302
             $verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']);
303
-            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=" . $row['id'] . "'>" . Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL) . "</a>";
303
+            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL)."</a>";
304 304
             if ($verified_if_is_father === true) {
305 305
                 //$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".$row['id']."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'),array('width'=>ICON_SIZE_SMALL,'height'=>ICON_SIZE_SMALL))."</a>";
306 306
                 $allow_add_term_sub_language = '';
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
         } else {
311 311
             $allow_use_sub_language = '';
312 312
             $all_information_of_sub_language = SubLanguageManager::get_all_information_of_language($row['id']);
313
-            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>";
314
-            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=" . Security::remove_XSS($all_information_of_sub_language['parent_id']) . "&sub_language_id=" . Security::remove_XSS($row['id']) . "'>" . Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL)) . "</a>";
313
+            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
314
+            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
315 315
         }
316 316
     } else {
317 317
         $allow_use_sub_language = '';
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
     }
320 320
 
321 321
     if ($row['english_name'] == $row_lang['selected_value']) {
322
-        $row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>
323
-                     &nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language;
322
+        $row_td[] = Display::return_icon('visible.png', get_lang('Visible'))."<a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>
323
+                     &nbsp;" . $setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
324 324
     } else {
325 325
         if ($row['available'] == 1) {
326
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_" . $row['id'] . "\" href='" . api_get_self() . "?action=makeunavailable&id=" . $row['id'] . "'>" . Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_' . $row['id']), ICON_SIZE_SMALL) . "</a> <a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>&nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language;
326
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
327 327
         } else {
328
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_" . $row['id'] . "\" href='" . api_get_self() . "?action=makeavailable&id=" . $row['id'] . "'>" . Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_' . $row['id']), ICON_SIZE_SMALL) . "</a> <a href='" . api_get_self() . "?action=edit&id=" . $row['id'] . "#value'>" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>&nbsp;" . $setplatformlanguage . $allow_use_sub_language . $allow_add_term_sub_language . $allow_delete_sub_language;
328
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
329 329
         }
330 330
     }
331 331
     $language_data[] = $row_td;
Please login to merge, or discard this patch.
main/gradebook/lib/fe/exportgradebook.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @param	string	View to print as a title for the table
13 13
  * @param	string	Course name to print as title for the table
14 14
  */
15
-function print_table($data_array,$header_names,$view,$coursename)
15
+function print_table($data_array, $header_names, $view, $coursename)
16 16
 {
17 17
 	$printdata = '<!DOCTYPE html
18 18
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 	$count_pages = ceil(count($data_table) / $items_per_page);
162 162
     $content_table = '';
163
-    for ($x = 0; $x<$count_pages; $x++) {
163
+    for ($x = 0; $x < $count_pages; $x++) {
164 164
         $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
165 165
         // header table
166 166
         $content_table .= '<tr>';
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
             foreach ($headers_table as $head_table) {
171 171
                 if (!empty($head_table[0])) {
172
-                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
172
+                    $width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
173 173
                     $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
174 174
                     $i++;
175 175
                 }
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
         $content_table .= '</tr>';
179 179
         // body table
180 180
         if (is_array($data_table) && count($data_table) > 0) {
181
-            $offset = $x*$items_per_page;
182
-            $data_table = array_slice ($data_table, $offset, count($data_table));
181
+            $offset = $x * $items_per_page;
182
+            $data_table = array_slice($data_table, $offset, count($data_table));
183 183
             $i = 1;
184
-            $item = $offset+1;
184
+            $item = $offset + 1;
185 185
             foreach ($data_table as $data) {
186 186
                 $content_table .= '<tr>';
187
-                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
187
+                $content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
188 188
                 foreach ($data as  $key => $content) {
189 189
                     if (isset($content)) {
190
-                        $key == 1 ? $align='align="left"':$align='align="center"';
190
+                        $key == 1 ? $align = 'align="left"' : $align = 'align="center"';
191 191
                         $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
192 192
                     }
193 193
                 }
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
                             <h1>'.$title_pdf.'</h1></td></tr>';
241 241
         foreach ($headers_pdf as $header_pdf) {
242 242
             if (!empty($header_pdf[0]) && !empty($header_pdf[1])) {
243
-                $header.= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
243
+                $header .= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
244 244
             }
245 245
         }
246
-        $header.='</table><br />';
246
+        $header .= '</table><br />';
247 247
     }
248 248
 
249 249
     // preparing footer pdf
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     }
268 268
     $items_per_page = 30;
269 269
     $count_pages = ceil(count($data_table) / $items_per_page);
270
-    for ($x = 0; $x<$count_pages; $x++) {
270
+    for ($x = 0; $x < $count_pages; $x++) {
271 271
         $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
272 272
         // header table
273 273
         $content_table .= '<tr>';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         if (is_array($headers_table)) {
276 276
             foreach ($headers_table as $head_table) {
277 277
                 if (!empty($head_table[0])) {
278
-                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
278
+                    $width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
279 279
                     $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
280 280
                     $i++;
281 281
                 }
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
         // body table
286 286
 
287 287
         if (is_array($data_table) && count($data_table) > 0) {
288
-            $offset = $x*$items_per_page;
289
-            $data_table = array_slice ($data_table, $offset, count($data_table));
288
+            $offset = $x * $items_per_page;
289
+            $data_table = array_slice($data_table, $offset, count($data_table));
290 290
             $i = 1;
291
-            $item = $offset+1;
291
+            $item = $offset + 1;
292 292
             foreach ($data_table as $data) {
293 293
                 $content_table .= '<tr>';
294
-                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
294
+                $content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
295 295
                 foreach ($data as  $key => $content) {
296 296
                     if (isset($content)) {
297
-                        $key == 1 ? $align='align="left"':$align='align="center"';
297
+                        $key == 1 ? $align = 'align="left"' : $align = 'align="center"';
298 298
                         $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
299 299
                     }
300 300
                 }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     $pdf = new PDF();
313 313
     $pdf->set_custom_footer($footer);
314 314
     $pdf->set_custom_header($headers_in_pdf);
315
-    $pdf->content_to_pdf($header.$content_table, $css, $title_pdf );
315
+    $pdf->content_to_pdf($header.$content_table, $css, $title_pdf);
316 316
     exit;
317 317
 
318 318
 }
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 function export_pdf($pdf, $newarray, $header_names, $format)
328 328
 {
329 329
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
330
-	$pdf->ezSetCmMargins(0,0,0,0);
331
-	$pdf->ezSetY(($format=='portrait')?'820':'570');
330
+	$pdf->ezSetCmMargins(0, 0, 0, 0);
331
+	$pdf->ezSetY(($format == 'portrait') ? '820' : '570');
332 332
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
333 333
     if ($format == 'portrait') {
334 334
         $pdf->line(40, 790, 540, 790);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $pdf->line(40, 540, 790, 540);
338 338
         $pdf->line(40, 40, 790, 40);
339 339
     }
340
-    $pdf->ezSetY(($format=='portrait')?'750':'520');
340
+    $pdf->ezSetY(($format == 'portrait') ? '750' : '520');
341 341
     $pdf->ezTable($newarray, $header_names, '', array(
342 342
         'showHeadings' => 1,
343 343
         'shaded' => 1,
Please login to merge, or discard this patch.
main/session/session_user_edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 }
29 29
 
30 30
 
31
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
31
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
32 32
 $interbreadcrumb[] = array(
33 33
     'url' => "resume_session.php?id_session=".$sessionId,
34 34
     "name" => get_lang('SessionOverview')
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     if ($days > 0) {
61 61
         $msg = sprintf(get_lang('FirstAccessWasXSessionDurationYEndDateInZDays'), $firstAccessString, $duration, $days);
62 62
     } else {
63
-        $endDateInSeconds = $firstAccess + $duration * 24*60*60;
63
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
64 64
         $last = api_convert_and_format_date($endDateInSeconds, DATE_FORMAT_SHORT);
65 65
         $msg = sprintf(get_lang('FirstAccessWasXSessionDurationYEndDateWasZ'), $firstAccessString, $duration, $last);
66 66
     }
Please login to merge, or discard this patch.
main/session/resume_session.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 $tool_name = get_lang('SessionOverview');
30 30
 
31 31
 //$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
32
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
32
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
33 33
 
34 34
 $orig_param = '&origin=resume_session';
35 35
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$coachs = array();
185 185
 		if (Database::num_rows($rs) > 0) {
186
-			while($info_coach = Database::fetch_array($rs)) {
186
+			while ($info_coach = Database::fetch_array($rs)) {
187 187
                 $coachs[] = api_get_person_name(
188 188
                         $info_coach['firstname'],
189 189
                         $info_coach['lastname']
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		if (count($coachs) > 0) {
197
-			$coach = implode('<br />',$coachs);
197
+			$coach = implode('<br />', $coachs);
198 198
 		} else {
199 199
 			$coach = get_lang('None');
200 200
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         $downIcon = 'down.png';
218 218
         $downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_down';
219 219
 
220
-        if ($count +1 == count($courses)) {
220
+        if ($count + 1 == count($courses)) {
221 221
             $downIcon = 'down_na.png';
222 222
             $downUrl = '#';
223 223
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			<td>'.$coach.'</td>
245 245
 			<td>'.$numberOfUsers.'</td>
246 246
 			<td>
247
-                <a href="'. $courseUrl . '">'.
247
+                <a href="'. $courseUrl.'">'.
248 248
                 Display::return_icon('course_home.gif', get_lang('Course')).'</a>
249 249
                 '.$orderButtons.'
250 250
                 <a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course->getCode().'">'.
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             array('onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;")
310 310
         );
311 311
 
312
-        $addUserToUrlLink= '';
312
+        $addUserToUrlLink = '';
313 313
         if ($multiple_url_is_on) {
314 314
             if ($user['access_url_id'] != $url_id) {
315 315
                 $userLink .= ' '.Display::return_icon(
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
             ],
109 109
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
110 110
             ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
111
-            [   'Styles',
111
+            ['Styles',
112 112
                 'Format',
113 113
                 'Font',
114 114
                 'FontSize',
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function createHtmlStyle()
56 56
     {
57 57
         $style = '';
58
-        if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '' ) {
58
+        if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '') {
59 59
             $cssFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/editor.css';
60 60
             if (!is_file($cssFile)) {
61 61
                 $cssFile = api_get_path(WEB_CSS_PATH).'editor.css';
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
         return [[
148 148
             'title' => get_lang('EmptyTemplate'),
149 149
             'description' => null,
150
-            'image' => api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/empty.gif',
150
+            'image' => api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/empty.gif',
151 151
             'html' => '
152 152
                 <!DOCYTPE html>
153 153
                 <html>
154 154
                     <head>
155
-                        <meta charset="' . api_get_system_encoding() . '" />
155
+                        <meta charset="' . api_get_system_encoding().'" />
156 156
                     </head>
157
-                    <body  dir="' . api_get_text_direction() . '">
157
+                    <body  dir="' . api_get_text_direction().'">
158 158
                         <p>
159 159
                             <br/>
160 160
                         </p>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $search = array('{CSS}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}');
178 178
         $replace = array(
179 179
             '',
180
-            api_get_path(REL_CODE_PATH) . 'img/',
180
+            api_get_path(REL_CODE_PATH).'img/',
181 181
             api_get_path(REL_PATH),
182 182
             api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH),
183 183
             api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH)
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         foreach ($systemTemplates as $template) {
189 189
             $image = $template->getImage();
190 190
             $image = !empty($image) ? $image : 'empty.gif';
191
-            $image = api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $image;
191
+            $image = api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$image;
192 192
 
193 193
             /*$image = $this->urlGenerator->generate(
194 194
                 'get_document_template_action',
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
             $templateItem['image'] = api_get_path(WEB_APP_PATH)
241 241
                 . 'home/default_platform_document/template_thumb/noimage.gif';
242 242
             $templateItem['html'] = file_get_contents(api_get_path(SYS_COURSE_PATH)
243
-                . $courseDirectory . '/document' . $templateData['path']);
243
+                . $courseDirectory.'/document'.$templateData['path']);
244 244
 
245 245
             $image = $template->getImage();
246 246
             if (!empty($image)) {
247 247
                 $templateItem['image'] = api_get_path(WEB_COURSE_PATH)
248
-                    . $courseDirectory . '/upload/template_thumbnails/' . $template->getImage();
248
+                    . $courseDirectory.'/upload/template_thumbnails/'.$template->getImage();
249 249
             }
250 250
 
251 251
             $templateList[] = $templateItem;
Please login to merge, or discard this patch.
main/permissions/permissions_functions.inc.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -26,34 +26,34 @@  discard block
 block discarded – undo
26 26
     $course_id = api_get_course_int_id();
27 27
     
28 28
 	// Which database are we using (depending on the $content parameter)
29
-	if ($content=='user')
29
+	if ($content == 'user')
30 30
 	{
31
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
31
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
32 32
 		$id_field = user_id;
33 33
 	}
34
-	if ($content=='group')
34
+	if ($content == 'group')
35 35
 	{
36
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
36
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
37 37
 		$id_field = group_id;
38 38
 	}
39
-	if ($content=='role')
39
+	if ($content == 'role')
40 40
 	{
41
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
41
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
42 42
 		$id_field = role_id;
43 43
 	}
44 44
 
45 45
 	// We first delete all the existing permissions for that user/group/role
46
-	$sql="DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
47
-	$result=Database::query($sql);
46
+	$sql = "DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
47
+	$result = Database::query($sql);
48 48
 
49 49
 	// looping through the post values to find the permission (containing the string permission* )
50 50
 	foreach ($_POST as $key => $value)
51 51
 	{
52
-		if (strstr($key,"permission*"))
52
+		if (strstr($key, "permission*"))
53 53
 		{
54
-			list($brol,$tool,$action)=explode("*",$key);
55
-			$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
56
-			$result=Database::query($sql);
54
+			list($brol, $tool, $action) = explode("*", $key);
55
+			$sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
56
+			$result = Database::query($sql);
57 57
 		}
58 58
 	}
59 59
 	return get_lang('PermissionsStored');
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 * @author Patrick Cool <[email protected]>, Ghent University
70 70
 * @version 1.0
71 71
 */
72
-function store_one_permission($content, $action, $id, $tool,$permission) {
72
+function store_one_permission($content, $action, $id, $tool, $permission) {
73 73
 	global $rights_full;
74 74
     $course_id = api_get_course_int_id();
75 75
 	// for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out.
@@ -82,35 +82,35 @@  discard block
 block discarded – undo
82 82
 
83 83
 	// Which database are we using (depending on the $content parameter)
84 84
     
85
-	if ($content=='user') {
86
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
85
+	if ($content == 'user') {
86
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
87 87
 		$id_field = user_id;
88 88
 	}
89
-	if ($content=='group')
89
+	if ($content == 'group')
90 90
 	{
91
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
91
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
92 92
 		$id_field = group_id;
93 93
 	}
94
-	if ($content=='role')
94
+	if ($content == 'role')
95 95
 	{
96
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
96
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
97 97
 		$id_field = role_id;
98 98
 	}
99 99
 
100 100
 	// grating a right
101
-	if ($action=='grant') {
102
-		$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
103
-		$result=Database::query($sql);
104
-		if($result) {
105
-			$result_message=get_lang('PermissionGranted');
101
+	if ($action == 'grant') {
102
+		$sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
103
+		$result = Database::query($sql);
104
+		if ($result) {
105
+			$result_message = get_lang('PermissionGranted');
106 106
 		}
107 107
 	}
108
-	if ($action=='revoke')
108
+	if ($action == 'revoke')
109 109
 	{
110
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
111
-		$result=Database::query($sql);
112
-		if($result) {
113
-			$result_message=get_lang('PermissionRevoked');
110
+		$sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
111
+		$result = Database::query($sql);
112
+		if ($result) {
113
+			$result_message = get_lang('PermissionRevoked');
114 114
 		}
115 115
 	}
116 116
 	return $result_message;
@@ -125,44 +125,44 @@  discard block
 block discarded – undo
125 125
 */
126 126
 function get_permissions($content, $id) {
127 127
     $course_id = api_get_course_int_id();
128
-	$currentpermissions=array();
128
+	$currentpermissions = array();
129 129
 	// Which database are we using (depending on the $content parameter)
130 130
     $course_id_condition = " c_id = $course_id AND ";
131 131
 	if ($content == 'user')
132 132
 	{
133
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
133
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
134 134
 		$id_field = 'user_id';
135 135
 	}
136 136
 	elseif ($content == 'group')
137 137
 	{
138
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
138
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
139 139
 		$id_field = 'group_id';
140 140
 	}
141 141
 	elseif ($content == 'role')
142 142
 	{
143
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
143
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
144 144
 		$id_field = 'role_id';
145 145
 	}
146 146
 	elseif ($content == 'platform_role')
147 147
 	{
148
-		$table=Database::get_main_table(TABLE_ROLE_PERMISSION);
148
+		$table = Database::get_main_table(TABLE_ROLE_PERMISSION);
149 149
 		$id_field = 'role_id';
150 150
         $course_id_condition = '';
151 151
 	}
152 152
 	elseif ($content == 'task')
153 153
 	{
154
-		$table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
154
+		$table = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
155 155
 		$id_field = 'task_id';
156 156
 	}
157 157
 
158 158
 	// finding all the permissions. We store this in a multidimensional array
159 159
 	// where the first dimension is the tool.
160
-	$sql="
161
-		SELECT * FROM " . $table . "
162
-		WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'";
160
+	$sql = "
161
+		SELECT * FROM " . $table."
162
+		WHERE $course_id_condition ".$id_field."='".Database::escape_string($id)."'";
163 163
 	$result = Database::query($sql);
164 164
 
165
-	while($row = Database::fetch_array($result))
165
+	while ($row = Database::fetch_array($result))
166 166
 		$currentpermissions[$row['tool']][] = $row['action'];
167 167
 
168 168
 	return $currentpermissions;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 */
180 180
 function limited_or_full($current_permissions)
181 181
 {
182
-	if (api_get_setting('permissions')=='limited')
182
+	if (api_get_setting('permissions') == 'limited')
183 183
 	{
184 184
 		foreach ($current_permissions as $tool=>$tool_rights)
185 185
 		{
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 			// if it is visibility or move we have to grant the edit right
188 188
 			foreach ($tool_rights as $key=>$value)
189 189
 			{
190
-				if ($value=='View')
190
+				if ($value == 'View')
191 191
 				{
192 192
 					unset($current_permissions[$tool][$key]);
193 193
 				}
194
-				if ($value=='Visibility' OR $value=='Move')
194
+				if ($value == 'Visibility' OR $value == 'Move')
195 195
 				{
196
-					if (!in_array('Edit',$current_permissions[$tool]))
196
+					if (!in_array('Edit', $current_permissions[$tool]))
197 197
 					{
198
-						$current_permissions[$tool][]='Edit';
198
+						$current_permissions[$tool][] = 'Edit';
199 199
 					}
200 200
 					unset($current_permissions[$tool][$key]);
201 201
 				}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 		return $current_permissions;
209 209
 	}
210
-	if (api_get_setting('permissions')=='full')
210
+	if (api_get_setting('permissions') == 'full')
211 211
 	{
212 212
 		return $current_permissions;
213 213
 	}
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 * @author Patrick Cool <[email protected]>, Ghent University
223 223
 * @version 1.0
224 224
 */
225
-function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array())
225
+function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array())
226 226
 {
227
-	$checked="";
228
-	if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
227
+	$checked = "";
228
+	if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool]))
229 229
 	{
230
-		$checked="checked";
230
+		$checked = "checked";
231 231
 	}
232 232
 	echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n";
233 233
 
@@ -243,28 +243,28 @@  discard block
 block discarded – undo
243 243
 * @author Patrick Cool <[email protected]>, Ghent University
244 244
 * @version 1.0
245 245
 */
246
-function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
246
+function display_image_matrix($permission_array, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true)
247 247
 {
248 248
 	if ($course_admin) {
249 249
 		echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
250 250
 	} else {
251
-		if (in_array($permission,$inherited_permissions[$tool])) {
251
+		if (in_array($permission, $inherited_permissions[$tool])) {
252 252
 			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
253 253
 		} else {
254
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) {
254
+			if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) {
255 255
 				if ($editable) {
256
-					$url=api_get_self();
256
+					$url = api_get_self();
257 257
 					$urlparameters = '';
258
-					foreach($_GET as $key=>$value) {
259
-						$parameter[$key]=$value;
258
+					foreach ($_GET as $key=>$value) {
259
+						$parameter[$key] = $value;
260 260
 					}
261
-					$parameter['action']='revoke';
262
-					$parameter['permission']=$permission;
263
-					$parameter['tool']=$tool;
261
+					$parameter['action'] = 'revoke';
262
+					$parameter['permission'] = $permission;
263
+					$parameter['tool'] = $tool;
264 264
 					foreach ($parameter as $key=>$value) {
265
-						$urlparameters.=$key.'='.$value.'&amp;';
265
+						$urlparameters .= $key.'='.$value.'&amp;';
266 266
 					}
267
-					$url=$url.'?'.$urlparameters;
267
+					$url = $url.'?'.$urlparameters;
268 268
 
269 269
 					echo "\t\t\t <a href=\"".$url."\">";
270 270
 				}
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
 			} else {
276 276
 				if ($editable)
277 277
 				{
278
-					$url=api_get_self();
278
+					$url = api_get_self();
279 279
 					$urlparameters = '';
280 280
 					foreach ($_GET as $key=>$value)
281 281
 					{
282
-						$parameter[$key]=$value;
282
+						$parameter[$key] = $value;
283 283
 					}
284
-					$parameter['action']='grant';
285
-					$parameter['permission']=$permission;
286
-					$parameter['tool']=$tool;
284
+					$parameter['action'] = 'grant';
285
+					$parameter['permission'] = $permission;
286
+					$parameter['tool'] = $tool;
287 287
 					foreach ($parameter as $key=>$value)
288 288
 					{
289
-						$urlparameters.=$key.'='.$value.'&amp;';
289
+						$urlparameters .= $key.'='.$value.'&amp;';
290 290
 					}
291
-					$url=$url.'?'.$urlparameters;
291
+					$url = $url.'?'.$urlparameters;
292 292
 
293 293
 					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
294 294
 					echo "\t\t\t <a href=\"".$url."\">";
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 * @author Patrick Cool <[email protected]>, Ghent University
316 316
 * @version 1.0
317 317
 */
318
-function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
318
+function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true)
319 319
 {
320 320
 
321 321
 	if ($course_admin)
@@ -324,32 +324,32 @@  discard block
 block discarded – undo
324 324
 	}
325 325
 	else
326 326
 	{
327
-		if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool]))
327
+		if (!empty($inherited_permissions) and in_array($permission, $inherited_permissions[$tool]))
328 328
 		{
329 329
 			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
330 330
 		}
331 331
 		else
332 332
 		{
333
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
333
+			if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool]))
334 334
 			{
335 335
 				if ($editable)
336 336
 				{
337 337
 					$url = api_get_self();
338 338
 					$urlparameters = '';
339
-					foreach($_GET as $key => $value)
339
+					foreach ($_GET as $key => $value)
340 340
 					{
341 341
 						$parameter[$key] = $value;
342 342
 					}
343
-					$parameter['action']='manage_rights';
344
-					$parameter['do']='revoke';
345
-					$parameter['permission']=$permission;
346
-					$parameter['tool']=$tool;
347
-					$parameter['user_id']=$user_id;
343
+					$parameter['action'] = 'manage_rights';
344
+					$parameter['do'] = 'revoke';
345
+					$parameter['permission'] = $permission;
346
+					$parameter['tool'] = $tool;
347
+					$parameter['user_id'] = $user_id;
348 348
 					foreach ($parameter as $key=>$value)
349 349
 					{
350
-						$urlparameters .= $key . '=' . $value . '&amp;';
350
+						$urlparameters .= $key.'='.$value.'&amp;';
351 351
 					}
352
-					$url = $url . '?' . $urlparameters;
352
+					$url = $url.'?'.$urlparameters;
353 353
 
354 354
 					echo "\t\t\t <a href=\"".$url."\">";
355 355
 				}
@@ -362,17 +362,17 @@  discard block
 block discarded – undo
362 362
 					$url = api_get_self();
363 363
 					$urlparameters = '';
364 364
 					foreach ($_GET as $key=>$value) {
365
-						$parameter[$key]=$value;
365
+						$parameter[$key] = $value;
366 366
 					}
367
-					$parameter['action']='manage_rights';
368
-					$parameter['do']='grant';
369
-					$parameter['permission']=$permission;
370
-					$parameter['tool']=$tool;
371
-					$parameter['user_id']=$user_id;
367
+					$parameter['action'] = 'manage_rights';
368
+					$parameter['do'] = 'grant';
369
+					$parameter['permission'] = $permission;
370
+					$parameter['tool'] = $tool;
371
+					$parameter['user_id'] = $user_id;
372 372
 					foreach ($parameter as $key=>$value) {
373
-						$urlparameters .= $key . '=' . $value . '&amp;';
373
+						$urlparameters .= $key.'='.$value.'&amp;';
374 374
 					}
375
-					$url=$url.'?'.$urlparameters;
375
+					$url = $url.'?'.$urlparameters;
376 376
 
377 377
 					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
378 378
 					echo "\t\t\t <a href=\"".$url."\">";
@@ -397,30 +397,30 @@  discard block
 block discarded – undo
397 397
 	global $setting_visualisation;
398 398
     $course_id = api_get_course_int_id();
399 399
 
400
-	$coures_roles_table=Database::get_course_table(TABLE_ROLE);
400
+	$coures_roles_table = Database::get_course_table(TABLE_ROLE);
401 401
 
402 402
 	// course roles
403
-	$sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
404
-	$result=Database::query($sql);
405
-	while ($row=Database::fetch_array($result))
403
+	$sql = "SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
404
+	$result = Database::query($sql);
405
+	while ($row = Database::fetch_array($result))
406 406
 	{
407 407
 		if (in_array($row['role_id'], $current_course_roles))
408 408
 		{
409
-			$checked='checked';
410
-			$image='checkbox_on2.gif';
411
-			$action='revoke';
409
+			$checked = 'checked';
410
+			$image = 'checkbox_on2.gif';
411
+			$action = 'revoke';
412 412
 		}
413 413
 		else
414 414
 		{
415
-			$checked='';
416
-			$image='wrong.gif';
417
-			$action='grant';
415
+			$checked = '';
416
+			$image = 'wrong.gif';
417
+			$action = 'grant';
418 418
 		}
419
-		if ($setting_visualisation=='checkbox')
419
+		if ($setting_visualisation == 'checkbox')
420 420
 		{
421 421
 			echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>";
422 422
 		}
423
-		if ($setting_visualisation=='image')
423
+		if ($setting_visualisation == 'image')
424 424
 		{
425 425
 			echo "<a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=$action&amp;role=".$row['role_id']."&amp;scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>";
426 426
 		}
@@ -440,24 +440,24 @@  discard block
 block discarded – undo
440 440
 * @author Patrick Cool <[email protected]>, Ghent University
441 441
 * @version 1.0
442 442
 */
443
-function get_roles($content,$id, $scope='course') {
444
-    $course_id  = api_get_course_int_id();    
445
-	if ($content=='user') {
446
-		$table=Database::get_course_table(TABLE_ROLE_USER);
443
+function get_roles($content, $id, $scope = 'course') {
444
+    $course_id = api_get_course_int_id();    
445
+	if ($content == 'user') {
446
+		$table = Database::get_course_table(TABLE_ROLE_USER);
447 447
 		$id_field = user_id;
448 448
 	}
449
-	if ($content=='group') {
450
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
449
+	if ($content == 'group') {
450
+		$table = Database::get_course_table(TABLE_ROLE_GROUP);
451 451
 		$id_field = 'group_id';
452 452
 	}
453
-	$table_role=Database::get_course_table(TABLE_ROLE);
453
+	$table_role = Database::get_course_table(TABLE_ROLE);
454 454
 
455
-	$current_roles=array();
455
+	$current_roles = array();
456 456
 	//$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
457
-	$sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
458
-	$result=Database::query($sql);
459
-	while ($row=Database::fetch_array($result)) {
460
-		$current_roles[]=$row['role_id'];
457
+	$sql = "SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
458
+	$result = Database::query($sql);
459
+	while ($row = Database::fetch_array($result)) {
460
+		$current_roles[] = $row['role_id'];
461 461
 	}
462 462
 	return $current_roles;
463 463
 }
@@ -468,26 +468,26 @@  discard block
 block discarded – undo
468 468
 * @author Patrick Cool <[email protected]>, Ghent University
469 469
 * @version 1.0
470 470
 */
471
-function get_all_roles($content='course') {
471
+function get_all_roles($content = 'course') {
472 472
     $course_id = api_get_course_int_id();
473 473
     $course_id_condition = " WHERE c_id = $course_id ";
474 474
     
475
-	if ($content=='course')
475
+	if ($content == 'course')
476 476
 	{
477
-		$table_role=Database::get_course_table(TABLE_ROLE);
477
+		$table_role = Database::get_course_table(TABLE_ROLE);
478 478
 	}
479
-	if ($content=='platform')
479
+	if ($content == 'platform')
480 480
 	{
481
-		$table_role=Database::get_main_table(TABLE_ROLE);
481
+		$table_role = Database::get_main_table(TABLE_ROLE);
482 482
 		$course_id_condition = '';
483 483
 	}
484 484
 
485
-	$current_roles=array();
486
-	$sql="SELECT * FROM $table_role $course_id_condition ";
487
-	$result=Database::query($sql);
488
-	while ($row=Database::fetch_array($result))
485
+	$current_roles = array();
486
+	$sql = "SELECT * FROM $table_role $course_id_condition ";
487
+	$result = Database::query($sql);
488
+	while ($row = Database::fetch_array($result))
489 489
 	{
490
-		$roles[]=$row;
490
+		$roles[] = $row;
491 491
 	}
492 492
 
493 493
 	return $roles;
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 * @author Patrick Cool <[email protected]>, Ghent University
505 505
 * @version 1.0
506 506
 */
507
-function get_roles_permissions($content,$id, $scope='course') {
507
+function get_roles_permissions($content, $id, $scope = 'course') {
508 508
     $course_id = api_get_course_int_id();
509 509
 	if ($content == 'user') {
510
-		$table=Database::get_course_table(TABLE_ROLE_USER);
510
+		$table = Database::get_course_table(TABLE_ROLE_USER);
511 511
 		$id_field = 'user_id';
512 512
 	}
513 513
 
@@ -536,21 +536,21 @@  discard block
 block discarded – undo
536 536
 	$sql = "
537 537
 		SELECT *
538 538
 		FROM
539
-			" . $table . " role_group_user,
540
-			" . $table_role . " role,
541
-			" . $table_role_permissions . " role_permissions
539
+			" . $table." role_group_user,
540
+			" . $table_role." role,
541
+			" . $table_role_permissions." role_permissions
542 542
 		WHERE
543 543
 		    role_group_user.c_id = $course_id AND
544 544
 		    $role_condition
545
-			role_group_user.scope = '" . $scope . "' AND
546
-			role_group_user." . $id_field . " = '" . $id . "' AND
545
+			role_group_user.scope = '".$scope."' AND
546
+			role_group_user." . $id_field." = '".$id."' AND
547 547
 			role_group_user.role_id = role.role_id AND
548 548
 			role.role_id = role_permissions.role_id";
549 549
 
550 550
 	$result = Database::query($sql);
551 551
     $current_role_permissions = array();
552
-	while ($row=Database::fetch_array($result)) {
553
-		$current_role_permissions[$row['tool']][]=$row['action'];
552
+	while ($row = Database::fetch_array($result)) {
553
+		$current_role_permissions[$row['tool']][] = $row['action'];
554 554
     }
555 555
 	return $current_role_permissions;
556 556
 }
@@ -564,33 +564,33 @@  discard block
 block discarded – undo
564 564
 * @author Patrick Cool <[email protected]>, Ghent University
565 565
 */
566 566
 
567
-function assign_role($content, $action, $id, $role_id, $scope='course') {
567
+function assign_role($content, $action, $id, $role_id, $scope = 'course') {
568 568
     $course_id = api_get_course_int_id();
569 569
 	// Which database are we using (depending on the $content parameter)
570
-	if ($content=='user') {
571
-		$table=Database::get_course_table(TABLE_ROLE_USER);
570
+	if ($content == 'user') {
571
+		$table = Database::get_course_table(TABLE_ROLE_USER);
572 572
 		$id_field = 'user_id';
573
-	} elseif($content=='group') {
574
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
573
+	} elseif ($content == 'group') {
574
+		$table = Database::get_course_table(TABLE_ROLE_GROUP);
575 575
 		$id_field = 'group_id';
576 576
 	} else {
577 577
 		return  get_lang('Error');
578 578
 	}
579 579
 
580 580
 	// grating a right
581
-	if ($action=='grant') {
582
-		$sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
583
-		$result=Database::query($sql);
581
+	if ($action == 'grant') {
582
+		$sql = "INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
583
+		$result = Database::query($sql);
584 584
 		if ($result) {
585
-			$result_message=get_lang('RoleGranted');
585
+			$result_message = get_lang('RoleGranted');
586 586
 		}
587 587
 	}
588 588
     
589
-	if ($action=='revoke') {
590
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
591
-		$result=Database::query($sql);
589
+	if ($action == 'revoke') {
590
+		$sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
591
+		$result = Database::query($sql);
592 592
 		if ($result) {
593
-			$result_message=get_lang('RoleRevoked');
593
+			$result_message = get_lang('RoleRevoked');
594 594
 		}
595 595
 	}
596 596
 	return $result_message;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	{
608 608
 		foreach ($permissions as $permissionkey=>$permissionvalue)
609 609
 		{
610
-			$array1[$tool][]=$permissionvalue;
610
+			$array1[$tool][] = $permissionvalue;
611 611
 		}
612 612
 	}
613 613
 	return $array1;
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='".Display::returnIconPath('bar_1m.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='".Display::returnIconPath('bar_1r.gif')."' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='".Display::returnIconPath('bar_1.gif')."' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.