Completed
Pull Request — 1.11.x (#1628)
by José
97:30 queued 69:06
created
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.
main/tracking/lp_results_by_user.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
55
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+	$form->addElement('hidden', 'view', 'admin');
58 58
 } else {
59 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/admin/specific_fields.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 api_protect_admin_script();
16 16
 
17 17
 // Breadcrumb
18
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
-$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
+$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
20 20
 
21 21
 $libpath = api_get_path(LIBRARY_PATH);
22 22
 
23 23
 include_once $libpath.'specific_fields_manager.lib.php';
24 24
 
25 25
 // Create an add-field box
26
-$form = new FormValidator('add_field','post','','',null,false);
27
-$renderer =& $form->defaultRenderer();
26
+$form = new FormValidator('add_field', 'post', '', '', null, false);
27
+$renderer = & $form->defaultRenderer();
28 28
 $renderer->setCustomElementTemplate('<span>{element}</span> ');
29
-$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
29
+$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
30 30
 
31 31
 // Create a sortable table with specific fields data
32
-$column_show = array(1,1,1);
33
-$column_order = array(3,2,1);
32
+$column_show = array(1, 1, 1);
33
+$column_order = array(3, 2, 1);
34 34
 $extra_fields = get_specific_field_list();
35 35
 $number_of_extra_fields = count($extra_fields);
36 36
 
37
-$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order);
38
-$table->set_header(0, '&nbsp;', false,null,'width="2%"', 'style="display:none"');
37
+$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order);
38
+$table->set_header(0, '&nbsp;', false, null, 'width="2%"', 'style="display:none"');
39 39
 $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"');
40 40
 $table->set_header(2, get_lang('Name'));
41
-$table->set_header(3, get_lang('Modify'),false,'width="10%"');
41
+$table->set_header(3, get_lang('Modify'), false, 'width="10%"');
42 42
 $table->set_column_filter(3, 'edit_filter');
43 43
 
44
-function edit_filter($id,$url_params,$row) {
44
+function edit_filter($id, $url_params, $row) {
45 45
 	global $charset;
46
-	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>';
47
-	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
46
+	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
47
+	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
48 48
 	return $return;
49 49
 }
50 50
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 Display::display_header(get_lang('SpecificSearchFields'));
61 61
 echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro'));
62 62
 
63
-if(!empty($_GET['message'])) {
63
+if (!empty($_GET['message'])) {
64 64
   Display::display_confirmation_message($_GET['message']);
65 65
 }
66 66
 
Please login to merge, or discard this patch.
main/admin/specific_fields_add.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 // Create the form
33 33
 $form = new FormValidator('specific_fields_add');
34 34
 // Field variable name
35
-$form->addElement('hidden','field_id', $fieldId);
36
-$form->addElement('text','field_name',get_lang('FieldName'));
37
-$form->applyFilter('field_name','html_filter');
38
-$form->applyFilter('field_name','trim');
35
+$form->addElement('hidden', 'field_id', $fieldId);
36
+$form->addElement('text', 'field_name', get_lang('FieldName'));
37
+$form->applyFilter('field_name', 'html_filter');
38
+$form->applyFilter('field_name', 'trim');
39 39
 $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required');
40 40
 $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
41
-$form->addRule('field_name', '', 'maxlength',20);
41
+$form->addRule('field_name', '', 'maxlength', 20);
42 42
 
43 43
 // Set default values (only not empty when editing)
44 44
 $defaults = array();
45 45
 if ($fieldId) {
46
-    $form_information = get_specific_field_list(array( 'id' => $fieldId ));
46
+    $form_information = get_specific_field_list(array('id' => $fieldId));
47 47
     $defaults['field_name'] = $form_information[0]['name'];
48 48
 }
49 49
 $form->setDefaults($defaults);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 if ($form->validate()) {
55 55
     $field = $form->exportValues();
56 56
     $field_name = $field['field_name'];
57
-    if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) {
57
+    if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) {
58 58
         edit_specific_field($field['field_id'], $field['field_name']);
59 59
         $message = get_lang('FieldEdited');
60 60
     } else {
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Code
9 9
  */
10
-require_once dirname(__FILE__) . '/IndexableChunk.class.php';
10
+require_once dirname(__FILE__).'/IndexableChunk.class.php';
11 11
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
12 12
 
13 13
 /**
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Get one term html select
31 31
  */
32
-function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') {
32
+function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') {
33 33
 	global $charset;
34
-    $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">';
34
+    $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">';
35 35
 
36 36
     $all_selected = '';
37
-    if (!empty($_REQUEST['sf_'. $prefix]) ) {
38
-        if (in_array('__all__', $_REQUEST['sf_'. $prefix])) {
37
+    if (!empty($_REQUEST['sf_'.$prefix])) {
38
+        if (in_array('__all__', $_REQUEST['sf_'.$prefix])) {
39 39
             $all_selected = 'selected="selected"';
40 40
         }
41 41
     }
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     } else if ($op == 'or') {
45 45
         $all_selected_name = get_lang('Any');
46 46
     }
47
-    $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>';
47
+    $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>';
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51 51
         if (empty($term)) continue;
52 52
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 53
         $selected = '';
54
-        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
54
+        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) {
55 55
             $selected = 'selected="selected"';
56 56
         }
57
-        $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>';
57
+        $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>';
58 58
     }
59 59
     $multiple_select .= '</select>';
60 60
     return $multiple_select;
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 /**
64 64
  * Get terms html selects
65 65
  */
66
-function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') {
66
+function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') {
67 67
     // Process each prefix type term
68 68
     $i = 0;
69 69
     $max = count($sf_terms);
70
-    $multiple_selects ='';
70
+    $multiple_selects = '';
71 71
     foreach ($sf_terms as $prefix => $sf_term_array) {
72 72
         if ($prefix == $prefilter_prefix) continue;
73 73
         $multiple_select = '';
74
-        if ($i>0) {
74
+        if ($i > 0) {
75 75
             //print "+" image
76 76
             $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>';
77 77
         }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
         $sf_copy = $sf_term_array;
91 91
         // get specific field name
92
-        $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" ));
92
+        $sf_value = get_specific_field_list(array('code' => "'$prefix'"));
93 93
         $sf_value = array_shift($sf_value);
94
-        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />';
94
+        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />';
95 95
         $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"');
96 96
         $multiple_select .= '</td>';
97 97
         $multiple_selects .= $multiple_select;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) {
109 109
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
110
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
111
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
112
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
113
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
114
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
110
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
111
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
112
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
113
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
114
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
115 115
 
116 116
     /**
117 117
      * POST avoid long urls, but we are using GET because
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
      * could not send a form in pagination
120 120
      */
121 121
 
122
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
-		$action='index.php';
122
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
123
+		$action = 'index.php';
124 124
 	}
125 125
 	$navigator_info = api_get_navigator();
126 126
 
127
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
-		$submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
-		$submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
130
-        $reset_button 	= '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />';
127
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
128
+		$submit_button1	= '<input type="submit" id="submit" value="'.get_lang('Search').'" />';
129
+		$submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />';
130
+        $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />';
131 131
 	} else {
132
-		$submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
-		$submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
134
-        $reset_button 	= '<button class="save"   type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> ';
132
+		$submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>';
133
+		$submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>';
134
+        $reset_button = '<button class="save"   type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> ';
135 135
 	}
136 136
 
137 137
     $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null;
138 138
 
139
-    $form = '<form id="chamilo_search" action="'. $action .'" method="GET">
140
-            <input type="text" id="query" name="query" size="40" value="' . $query . '" />
141
-            <input type="hidden" name="mode" value="'. $mode .'"/>
142
-            <input type="hidden" name="type" value="'. $type .'"/>
139
+    $form = '<form id="chamilo_search" action="'.$action.'" method="GET">
140
+            <input type="text" id="query" name="query" size="40" value="' . $query.'" />
141
+            <input type="hidden" name="mode" value="'. $mode.'"/>
142
+            <input type="hidden" name="type" value="'. $type.'"/>
143 143
             <input type="hidden" name="tablename_page_nr" value="1" />
144 144
           	'.$submit_button1.'
145 145
             <br /><br />';
146 146
     $list = get_specific_field_list();
147 147
 
148
-    if(!empty($list)) {
149
-        $form .= '<span class="search-links-box">'. $advanced_options .'&nbsp;</span>
150
-            <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
151
-                <div class="search-help-box">'. $help .'</div>
148
+    if (!empty($list)) {
149
+        $form .= '<span class="search-links-box">'.$advanced_options.'&nbsp;</span>
150
+            <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
151
+                <div class="search-help-box">'. $help.'</div>
152 152
                 <table>
153 153
                 <tr>';
154 154
         $form .= format_specific_fields_selects($sf_terms, $op);
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $form .= '</tr>
163 163
                     <tr>
164 164
                         <td id="operator-select">
165
-                            '. get_lang('SearchCombineSearchWith') .':<br />
166
-                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
167
-                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
165
+                            '. get_lang('SearchCombineSearchWith').':<br />
166
+                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
167
+                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
168 168
                         </td>
169 169
                         <td></td>
170 170
                         <td>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </table>
177 177
                 </div>';
178 178
     }
179
-    $form .='</form>
179
+    $form .= '</form>
180 180
     <br style="clear: both;"/>';
181 181
     return $form;
182 182
 }
@@ -186,36 +186,36 @@  discard block
 block discarded – undo
186 186
  *
187 187
  * This type allow filter all other multiple select terms by one term in a dinamic way
188 188
  */
189
-function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) {
189
+function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) {
190 190
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
191
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
192
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
193
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
194
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
195
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
191
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
192
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
193
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
194
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
195
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
196 196
 
197 197
     /**
198 198
      * POST avoid long urls, but we are using GET because
199 199
      * SortableTableFromArray pagination is done with simple links, so now we
200 200
      * could not send a form in pagination
201 201
      */
202
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
203
-		$action='index.php';
202
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
203
+		$action = 'index.php';
204 204
 	}
205 205
 
206 206
     $form = '
207
-        <form id="chamilo_search" action="'. $action .'" method="GET">
207
+        <form id="chamilo_search" action="'. $action.'" method="GET">
208 208
             <input type="text" id="query" name="query" size="40" />
209
-            <input type="hidden" name="mode" value="'. $mode .'"/>
210
-            <input type="hidden" name="type" value="'. $type .'"/>
209
+            <input type="hidden" name="mode" value="'. $mode.'"/>
210
+            <input type="hidden" name="type" value="'. $type.'"/>
211 211
             <input type="hidden" name="tablename_page_nr" value="1" />
212
-            <input type="submit" id="submit" value="'. get_lang("Search") .'" />
212
+            <input type="submit" id="submit" value="'. get_lang("Search").'" />
213 213
             <br /><br />';
214 214
         $list = get_specific_field_list();
215
-        if(!empty($list)) {
216
-            $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .'&nbsp;</span>
217
-                    <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
218
-                        <div class="search-help-box">'. $help .'</div>
215
+        if (!empty($list)) {
216
+            $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.'&nbsp;</span>
217
+                    <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
218
+                        <div class="search-help-box">'. $help.'</div>
219 219
                         <table>
220 220
                         <tr>';
221 221
             if (!is_null($prefilter_prefix)) {
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
                 $sf_term_array = $temp;
231 231
 
232 232
                 // get specific field name
233
-                $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" ));
233
+                $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'"));
234 234
                 $sf_value = array_shift($sf_value);
235
-                $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
235
+                $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
236 236
 
237 237
                 $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"');
238 238
                 $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix);
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
                         </tr>
253 253
                         <tr>
254 254
                             <td id="operator-select">
255
-                                '. get_lang('SearchCombineSearchWith') .':<br />
256
-                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
257
-                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
255
+                                '. get_lang('SearchCombineSearchWith').':<br />
256
+                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
257
+                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
258 258
                             </td>
259 259
                             <td></td>
260 260
                             <td>
261 261
                                 <br />
262
-                                <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />
263
-                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />
262
+                                <input class="lower-submit" type="submit" value="'. get_lang('Search').'" />
263
+                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" />
264 264
                             </td>
265 265
                         </tr>
266 266
                         </table>
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  * Show search form
278 278
  */
279 279
 function display_search_form($action, $show_thesaurus, $sf_terms, $op) {
280
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
280
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
281 281
 
282 282
     switch ($type) {
283 283
         case 'prefilter':
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
  * @param   string $action     Just in case your action is not
305 305
  * index.php
306 306
  */
307
-function search_widget_show($action='index.php')
307
+function search_widget_show($action = 'index.php')
308 308
 {
309 309
     require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
310 310
     // TODO: load images dinamically when they're avalaible from specific field ui to add
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
     if (($cid = api_get_course_id()) != -1) { // with cid
318 318
 
319 319
         // get search engine terms
320
-        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
320
+        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
321 321
         $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter));
322 322
 
323 323
         //prepare specific fields names (and also get possible URL param names)
324 324
         foreach ($specific_fields as $specific_field) {
325 325
             $temp = array();
326
-            if (is_array($dkterms) && count($dkterms)>0) {
327
-            	foreach($dkterms[1] as $obj) {
326
+            if (is_array($dkterms) && count($dkterms) > 0) {
327
+            	foreach ($dkterms[1] as $obj) {
328 328
                 	$temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
329 329
             	}
330 330
         	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     }
353 353
 
354 354
     $op = 'or';
355
-    if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) {
355
+    if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) {
356 356
         $op = $_REQUEST['operator'];
357 357
     }
358 358
 
Please login to merge, or discard this patch.
main/admin/course_category.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     if ($action == 'delete') {
27 27
         CourseCategory::deleteNode($categoryId);
28 28
         Display::addFlash(Display::return_message(get_lang('Deleted')));
29
-        header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
29
+        header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
30 30
         exit();
31 31
     } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
32 32
         if ($action == 'add') {
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         }
55 55
     } elseif ($action == 'moveUp') {
56 56
         CourseCategory::moveNodeUp($categoryId, $_GET['tree_pos'], $category);
57
-        header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
57
+        header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
58 58
         Display::addFlash(Display::return_message(get_lang('Updated')));
59 59
         exit();
60 60
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     $form_title = ($action == 'add') ? get_lang('AddACategory') : get_lang('EditNode');
80 80
     if (!empty($category)) {
81
-        $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
81
+        $form_title .= ' '.get_lang('Into').' '.Security::remove_XSS($category);
82 82
     }
83 83
     $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.Security::remove_XSS($categoryId);
84 84
     $form = new FormValidator('course_category', 'post', $url);
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]);
62 62
         $googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]);
63 63
         $slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]);
64
-        $platformDomain = preg_match('#src="https?://(.+\.)?' . $hostName[1] . '#i', $matches[1]);
64
+        $platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]);
65 65
 
66 66
         if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) {
67 67
             $extra = ' frameborder="0"';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             } elseif ($vimeoMatch) {
71 71
                 $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
72 72
             }
73
-            return '<iframe ' . $matches[1] . $extra . '></iframe>';
73
+            return '<iframe '.$matches[1].$extra.'></iframe>';
74 74
         } else {
75 75
             return '';
76 76
         }
Please login to merge, or discard this patch.