Completed
Push — 1.11.x ( a69e20...60645e )
by José
113:03 queued 73:51
created
main/document/create_document.php 1 patch
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 $is_certificate_mode = false;
62 62
 
63 63
 if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
64
-	$is_certificate_mode = true;
64
+    $is_certificate_mode = true;
65 65
 }
66 66
 
67 67
 if ($is_certificate_mode) {
68
-	$nameTools = get_lang('CreateCertificate');
68
+    $nameTools = get_lang('CreateCertificate');
69 69
 } else {
70
-	$nameTools = get_lang('CreateDocument');
70
+    $nameTools = get_lang('CreateDocument');
71 71
 }
72 72
 
73 73
 /*	Constants and variables */
@@ -119,26 +119,26 @@  discard block
 block discarded – undo
119 119
 
120 120
 // Please, do not modify this dirname formatting
121 121
 if (strstr($dir, '..')) {
122
-	$dir = '/';
122
+    $dir = '/';
123 123
 }
124 124
 
125 125
 if ($dir[0] == '.') {
126
-	$dir = substr($dir, 1);
126
+    $dir = substr($dir, 1);
127 127
 }
128 128
 
129 129
 if ($dir[0] != '/') {
130
-	$dir = '/'.$dir;
130
+    $dir = '/'.$dir;
131 131
 }
132 132
 
133 133
 if ($dir[strlen($dir) - 1] != '/') {
134
-	$dir .= '/';
134
+    $dir .= '/';
135 135
 }
136 136
 
137 137
 if ($is_certificate_mode) {
138
-	$document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
139
-	$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
140
-	$folder_id = $document_data['id'];
141
-	$dir = '/certificates/';
138
+    $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
139
+    $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
140
+    $folder_id = $document_data['id'];
141
+    $dir = '/certificates/';
142 142
 }
143 143
 
144 144
 $doc_tree  = explode('/', $dir);
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 
150 150
     // Level correction for group documents.
151 151
     if (!empty($group_properties['directory'])) {
152
-    	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
152
+        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
153 153
     }
154 154
 }
155 155
 $relative_url = '';
156 156
 for ($i = 0; $i < ($count_dir); $i++) {
157
-	$relative_url .= '../';
157
+    $relative_url .= '../';
158 158
 }
159 159
 
160 160
 if ($relative_url== '') {
161
-	$relative_url = '/';
161
+    $relative_url = '/';
162 162
 }
163 163
 
164 164
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
     'cols-size' => [2, 10, 0],
171 171
     'FullPage' => true,
172 172
     'InDocument' => true,
173
-	'CreateDocumentDir' => $relative_url,
174
-	'CreateDocumentWebDir' => (empty($group_properties['directory']))
175
-                        		? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
176
-                        		: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
177
-	'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
173
+    'CreateDocumentDir' => $relative_url,
174
+    'CreateDocumentWebDir' => (empty($group_properties['directory']))
175
+                                ? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
176
+                                : api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
177
+    'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
178 178
 );
179 179
 
180 180
 if ($is_certificate_mode) {
@@ -186,42 +186,42 @@  discard block
 block discarded – undo
186 186
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
187 187
 
188 188
 if (!is_dir($filepath)) {
189
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
190
-	$dir = '/';
189
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
190
+    $dir = '/';
191 191
 }
192 192
 
193 193
 $to_group_id = 0;
194 194
 
195 195
 if (!$is_certificate_mode) {
196
-	if (api_is_in_group()) {
196
+    if (api_is_in_group()) {
197 197
         $interbreadcrumb[] = array(
198 198
             "url" => "../group/group_space.php?".api_get_cidreq(),
199 199
             "name" => get_lang('GroupSpace'),
200 200
         );
201
-		$noPHP_SELF = true;
202
-		$to_group_id = api_get_group_id();
203
-		$path = explode('/', $dir);
204
-		if ('/'.$path[1] != $group_properties['directory']) {
205
-			api_not_allowed(true);
206
-		}
207
-	}
201
+        $noPHP_SELF = true;
202
+        $to_group_id = api_get_group_id();
203
+        $path = explode('/', $dir);
204
+        if ('/'.$path[1] != $group_properties['directory']) {
205
+            api_not_allowed(true);
206
+        }
207
+    }
208 208
     $interbreadcrumb[] = array(
209 209
         "url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(),
210 210
         "name" => get_lang('Documents'),
211 211
     );
212 212
 } else {
213
-	$interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
213
+    $interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
214 214
 }
215 215
 
216 216
 if (!$is_allowed_in_course) {
217
-	api_not_allowed(true);
217
+    api_not_allowed(true);
218 218
 }
219 219
 
220 220
 if (!($is_allowed_to_edit ||
221 221
     $groupRights ||
222 222
     DocumentManager::is_my_shared_folder($userId, $dir, api_get_session_id()))
223 223
 ) {
224
-	api_not_allowed(true);
224
+    api_not_allowed(true);
225 225
 }
226 226
 
227 227
 /*	Header */
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 
230 230
 $display_dir = $dir;
231 231
 if (isset($group_properties)) {
232
-	$display_dir = explode('/', $dir);
233
-	unset($display_dir[0]);
234
-	unset($display_dir[1]);
235
-	$display_dir = implode('/', $display_dir);
232
+    $display_dir = explode('/', $dir);
233
+    unset($display_dir[0]);
234
+    unset($display_dir[1]);
235
+    $display_dir = implode('/', $display_dir);
236 236
 }
237 237
 
238 238
 $select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 $form->addElement('header', $nameTools);
250 250
 
251 251
 if ($is_certificate_mode) {//added condition for certicate in gradebook
252
-	$form->addElement('hidden','certificate','true',array('id'=>'certificate'));
253
-	if (isset($_GET['selectcat'])) {
254
-		$form->addElement('hidden','selectcat', $select_cat);
252
+    $form->addElement('hidden','certificate','true',array('id'=>'certificate'));
253
+    if (isset($_GET['selectcat'])) {
254
+        $form->addElement('hidden','selectcat', $select_cat);
255 255
     }
256 256
 }
257 257
 
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
 // new document created
307 307
 
308 308
 if (!$is_certificate_mode &&
309
-	!DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
309
+    !DocumentManager::is_my_shared_folder($userId, $dir, $current_session_id)
310 310
 ) {
311
-	$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
311
+    $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
312 312
 
313
-	//$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
313
+    //$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
314 314
         $parent_select = $form->addSelect('curdirpath', get_lang('DestinationDirectory'),null, array('cols-size' => [2, 10, 0]) );
315
-	// Following two conditions copied from document.inc.php::build_directory_selector()
316
-	$folder_titles = array();
315
+    // Following two conditions copied from document.inc.php::build_directory_selector()
316
+    $folder_titles = array();
317 317
 
318 318
     if (is_array($folders)) {
319 319
         $escaped_folders = array();
@@ -351,22 +351,22 @@  discard block
 block discarded – undo
351 351
         }
352 352
     }
353 353
 
354
-	if (empty($group_dir)) {
355
-		$parent_select -> addOption(get_lang('HomeDirectory'), '/');
356
-		if (is_array($folders)) {
357
-			foreach ($folders as & $folder) {
358
-				//Hide some folders
359
-				if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
354
+    if (empty($group_dir)) {
355
+        $parent_select -> addOption(get_lang('HomeDirectory'), '/');
356
+        if (is_array($folders)) {
357
+            foreach ($folders as & $folder) {
358
+                //Hide some folders
359
+                if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css') {
360 360
                     continue;
361
-				}
362
-				//Admin setting for Hide/Show the folders of all users
363
-				if (api_get_setting('show_users_folders') == 'false' &&
361
+                }
362
+                //Admin setting for Hide/Show the folders of all users
363
+                if (api_get_setting('show_users_folders') == 'false' &&
364 364
                     (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))
365 365
                 ){
366
-					continue;
367
-				}
368
-				//Admin setting for Hide/Show Default folders to all users
369
-				if (api_get_setting('show_default_folders') == 'false' &&
366
+                    continue;
367
+                }
368
+                //Admin setting for Hide/Show Default folders to all users
369
+                if (api_get_setting('show_default_folders') == 'false' &&
370 370
                     (
371 371
                         $folder == '/images' ||
372 372
                         $folder == '/flash' ||
@@ -376,82 +376,82 @@  discard block
 block discarded – undo
376 376
                         $folder == '/video/flv'
377 377
                     )
378 378
                 ){
379
-					continue;
380
-				}
381
-				//Admin setting for Hide/Show chat history folder
382
-				if (api_get_setting('show_chat_folder') == 'false' &&
379
+                    continue;
380
+                }
381
+                //Admin setting for Hide/Show chat history folder
382
+                if (api_get_setting('show_chat_folder') == 'false' &&
383 383
                     $folder=='/chat_files'
384 384
                 ){
385
-					continue;
386
-				}
385
+                    continue;
386
+                }
387 387
 
388
-				$selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
389
-				$path_parts = explode('/', $folder);
390
-				$folder_titles[$folder] = cut($folder_titles[$folder], 80);
388
+                $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
389
+                $path_parts = explode('/', $folder);
390
+                $folder_titles[$folder] = cut($folder_titles[$folder], 80);
391 391
                 $space_counter =count($path_parts) - 2;
392 392
                 if ($space_counter > 0) {
393 393
                     $label = str_repeat('&nbsp;&nbsp;&nbsp;', $space_counter).' &mdash; '.$folder_titles[$folder];
394 394
                 } else {
395 395
                     $label = ' &mdash; '.$folder_titles[$folder];
396 396
                 }
397
-				$parent_select -> addOption($label, $folder);
398
-				if ($selected != '') {
399
-					$parent_select->setSelected($folder);
400
-				}
401
-			}
402
-		}
403
-	} else {
404
-		if (is_array($folders) && !empty($folders)) {
405
-			foreach ($folders as & $folder) {
406
-				$selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
407
-				$label = $folder_titles[$folder];
408
-				if ($folder == $group_dir) {
409
-					$label = '/ (' . get_lang('HomeDirectory') . ')';
410
-				} else {
411
-					$path_parts = explode('/', str_replace($group_dir, '', $folder));
412
-					$label = cut($label, 80);
413
-					$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
414
-				}
415
-				$parent_select->addOption($label, $folder);
416
-				if ($selected != '') {
417
-					$parent_select->setSelected($folder);
418
-				}
419
-			}
420
-		}
421
-	}
397
+                $parent_select -> addOption($label, $folder);
398
+                if ($selected != '') {
399
+                    $parent_select->setSelected($folder);
400
+                }
401
+            }
402
+        }
403
+    } else {
404
+        if (is_array($folders) && !empty($folders)) {
405
+            foreach ($folders as & $folder) {
406
+                $selected = (substr($dir, 0, -1) == $folder) ? ' selected="selected"' : '';
407
+                $label = $folder_titles[$folder];
408
+                if ($folder == $group_dir) {
409
+                    $label = '/ (' . get_lang('HomeDirectory') . ')';
410
+                } else {
411
+                    $path_parts = explode('/', str_replace($group_dir, '', $folder));
412
+                    $label = cut($label, 80);
413
+                    $label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2) . ' &mdash; ' . $label;
414
+                }
415
+                $parent_select->addOption($label, $folder);
416
+                if ($selected != '') {
417
+                    $parent_select->setSelected($folder);
418
+                }
419
+            }
420
+        }
421
+    }
422 422
 }
423 423
 
424 424
 $form->addHidden('dirValue', '');
425 425
 
426 426
 if ($is_certificate_mode) {
427
-	$form->addButtonCreate(get_lang('CreateCertificate'));
427
+    $form->addButtonCreate(get_lang('CreateCertificate'));
428 428
 } else {
429
-	$form->addButtonCreate(get_lang('CreateDoc'));
429
+    $form->addButtonCreate(get_lang('CreateDoc'));
430 430
 }
431 431
 
432 432
 $form->setDefaults($defaults);
433 433
 
434 434
 // If form validates -> save the new document
435 435
 if ($form->validate()) {
436
-	$values = $form->exportValues();
437
-	$readonly = isset($values['readonly']) ? 1 : 0;
438
-	$values['title'] = trim($values['title']);
436
+    $values = $form->exportValues();
437
+    $readonly = isset($values['readonly']) ? 1 : 0;
438
+    $values['title'] = trim($values['title']);
439 439
 
440 440
     if (!empty($values['dirValue'])) {
441 441
         $dir = $values['dirValue'];
442 442
     }
443 443
 
444 444
     if ($dir[strlen($dir) - 1] != '/') {
445
-		$dir .= '/';
446
-	}
445
+        $dir .= '/';
446
+    }
447 447
     $filepath = $filepath.$dir;
448 448
 
449 449
     // Setting the filename
450
-	$filename = $values['title'];
451
-	$filename = addslashes(trim($filename));
452
-	$filename = Security::remove_XSS($filename);
453
-	$filename = api_replace_dangerous_char($filename);
454
-	$filename = disable_dangerous_file($filename);
450
+    $filename = $values['title'];
451
+    $filename = addslashes(trim($filename));
452
+    $filename = Security::remove_XSS($filename);
453
+    $filename = api_replace_dangerous_char($filename);
454
+    $filename = disable_dangerous_file($filename);
455 455
     $filename .= DocumentManager::getDocumentSuffix(
456 456
         $_course,
457 457
         api_get_session_id(),
@@ -459,14 +459,14 @@  discard block
 block discarded – undo
459 459
     );
460 460
 
461 461
     // Setting the title
462
-	$title = $values['title'];
462
+    $title = $values['title'];
463 463
 
464 464
     // Setting the extension
465
-	$extension = 'html';
465
+    $extension = 'html';
466 466
 
467
-	$content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
467
+    $content = Security::remove_XSS($values['content'], COURSEMANAGERLOWSECURITY);
468 468
 
469
-	/*if (strpos($content, '/css/frames.css') == false) {
469
+    /*if (strpos($content, '/css/frames.css') == false) {
470 470
 		$content = str_replace('</head>', '<link rel="stylesheet" href="./css/frames.css" type="text/css" /><style> body{margin:50px;}</style></head>', $content);
471 471
 	}*/
472 472
 
@@ -479,13 +479,13 @@  discard block
 block discarded – undo
479 479
         exit;
480 480
     }
481 481
 
482
-	if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
483
-		//$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
484
-		$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content);
482
+    if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
483
+        //$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
484
+        $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].api_get_path(REL_COURSE_PATH), $content);
485 485
 
486
-		fputs($fp, $content);
487
-		fclose($fp);
488
-		chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
486
+        fputs($fp, $content);
487
+        fclose($fp);
488
+        chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
489 489
 
490 490
         /*
491 491
 		if (!is_dir($filepath.'css')) {
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 			api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
504 504
 		}*/
505 505
 
506
-		$file_size = filesize($filepath.$filename.'.'.$extension);
507
-		$save_file_path = $dir.$filename.'.'.$extension;
506
+        $file_size = filesize($filepath.$filename.'.'.$extension);
507
+        $save_file_path = $dir.$filename.'.'.$extension;
508 508
 
509 509
         $document_id = add_document(
510 510
             $_course,
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
             $readonly
517 517
         );
518 518
 
519
-		if ($document_id) {
520
-			api_item_property_update(
519
+        if ($document_id) {
520
+            api_item_property_update(
521 521
                 $_course,
522 522
                 TOOL_DOCUMENT,
523 523
                 $document_id,
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
                 null,
530 530
                 $current_session_id
531 531
             );
532
-			// Update parent folders
533
-			item_property_update_on_folder($_course, $dir, $userId);
534
-			$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
535
-			$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
532
+            // Update parent folders
533
+            item_property_update_on_folder($_course, $dir, $userId);
534
+            $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
535
+            $new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
536 536
             $new_title = htmlspecialchars($new_title);
537
-			if ($new_comment || $new_title) {
538
-				$ct = '';
537
+            if ($new_comment || $new_title) {
538
+                $ct = '';
539 539
                 $params = [];
540 540
                 if ($new_comment) {
541 541
                     $params['comment'] = $new_comment;
@@ -550,39 +550,39 @@  discard block
 block discarded – undo
550 550
                         ['c_id = ? AND id = ?' => [$course_id, $document_id]]
551 551
                     );
552 552
                 }
553
-			}
554
-			$dir= substr($dir,0,-1);
555
-			$selectcat = '';
553
+            }
554
+            $dir= substr($dir,0,-1);
555
+            $selectcat = '';
556 556
             if (isset($_REQUEST['selectcat'])) {
557 557
                 $selectcat = "&selectcat=".intval($_REQUEST['selectcat']);
558 558
             }
559
-			$certificate_condition = '';
560
-			if ($is_certificate_mode) {
561
-				$df = DocumentManager::get_default_certificate_id($_course['code']);
559
+            $certificate_condition = '';
560
+            if ($is_certificate_mode) {
561
+                $df = DocumentManager::get_default_certificate_id($_course['code']);
562 562
                 if (!isset($df)) {
563 563
                     DocumentManager::attach_gradebook_certificate($_course['code'],$document_id);
564
-				}
565
-				$certificate_condition = '&certificate=true&curdirpath=/certificates';
566
-			}
564
+                }
565
+                $certificate_condition = '&certificate=true&curdirpath=/certificates';
566
+            }
567 567
             Display::addFlash(Display::return_message(get_lang('ItemAdded')));
568
-			header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
569
-			exit();
570
-		} else {
571
-			Display :: display_header($nameTools, 'Doc');
572
-			Display :: display_error_message(get_lang('Impossible'));
573
-			Display :: display_footer();
574
-		}
575
-	} else {
576
-		Display :: display_header($nameTools, 'Doc');
577
-		Display :: display_error_message(get_lang('Impossible'));
578
-		Display :: display_footer();
579
-	}
568
+            header('Location: document.php?'.api_get_cidreq().'&id='.$folder_id.$selectcat.$certificate_condition);
569
+            exit();
570
+        } else {
571
+            Display :: display_header($nameTools, 'Doc');
572
+            Display :: display_error_message(get_lang('Impossible'));
573
+            Display :: display_footer();
574
+        }
575
+    } else {
576
+        Display :: display_header($nameTools, 'Doc');
577
+        Display :: display_error_message(get_lang('Impossible'));
578
+        Display :: display_footer();
579
+    }
580 580
 } else {
581
-	// Copied from document.php
582
-	$dir_array = explode('/', $dir);
583
-	$array_len = count($dir_array);
581
+    // Copied from document.php
582
+    $dir_array = explode('/', $dir);
583
+    $array_len = count($dir_array);
584 584
 
585
-	// Breadcrumb for the current directory root path
585
+    // Breadcrumb for the current directory root path
586 586
     if (!empty($document_data)) {
587 587
         if (empty($document_data['parents'])) {
588 588
             $interbreadcrumb[] = array(
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
         }
600 600
     }
601 601
 
602
-	Display :: display_header($nameTools, "Doc");
603
-	// actions
602
+    Display :: display_header($nameTools, "Doc");
603
+    // actions
604 604
 
605
-	// link back to the documents overview
606
-	if ($is_certificate_mode) {
605
+    // link back to the documents overview
606
+    if ($is_certificate_mode) {
607 607
             $actionsLeft =  '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
608 608
                 Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
609 609
             $actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
@@ -618,19 +618,19 @@  discard block
 block discarded – undo
618 618
 
619 619
     echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft));
620 620
 
621
-	if ($is_certificate_mode) {
621
+    if ($is_certificate_mode) {
622 622
         $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
623 623
             api_get_user_id(),
624 624
             api_get_course_id()
625 625
         );
626 626
 
627
-		$str_info = '';
628
-		foreach ($all_information_by_create_certificate[0] as $info_value) {
629
-			$str_info.=$info_value.'<br/>';
630
-		}
631
-		$create_certificate = get_lang('CreateCertificateWithTags');
632
-		Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
-	}
627
+        $str_info = '';
628
+        foreach ($all_information_by_create_certificate[0] as $info_value) {
629
+            $str_info.=$info_value.'<br/>';
630
+        }
631
+        $create_certificate = get_lang('CreateCertificateWithTags');
632
+        Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
633
+    }
634 634
 
635 635
     // HTML-editor
636 636
     echo '<div class="page-create">
@@ -646,5 +646,5 @@  discard block
 block discarded – undo
646 646
                 '.$form->returnForm().'
647 647
             </div>
648 648
           </div></div>';
649
-	Display :: display_footer();
649
+    Display :: display_footer();
650 650
 }
Please login to merge, or discard this patch.
main/admin/access_url_edit_course_category_to_url.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 }
121 121
 
122 122
 if ($add_type == 'multiple') {
123
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
123
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
124 124
         get_lang('SessionAddTypeUnique').'</a>';
125
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
125
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
126 126
 } else {
127
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
128
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
127
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
128
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
129 129
         get_lang('SessionAddTypeMultiple').'</a>';
130 130
 }
131 131
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	<td colspan="3" align="center">
224 224
 		<br />
225 225
 		<?php
226
-		if(isset($_GET['add']))
227
-			echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
-		else
229
-			echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
-		?>
226
+        if(isset($_GET['add']))
227
+            echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
+        else
229
+            echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
+        ?>
231 231
 	</td>
232 232
 </tr>
233 233
 </table>
Please login to merge, or discard this patch.
main/admin/access_url_edit_courses_to_url.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 $xajax = new xajax();
13 13
 $xajax->registerFunction(
14
-	array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
14
+    array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
15 15
 );
16 16
 
17 17
 // setting the section (for the tabs)
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 // Access restrictions
21 21
 api_protect_global_admin_script();
22 22
 if (!api_get_multiple_access_url()) {
23
-	header('Location: index.php');
24
-	exit;
23
+    header('Location: index.php');
24
+    exit;
25 25
 }
26 26
 
27 27
 // Database Table Definitions
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 
37 37
 $add_type = 'multiple';
38 38
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
39
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
39
+    $add_type = Security::remove_XSS($_REQUEST['add_type']);
40 40
 }
41 41
 
42 42
 $access_url_id = 1;
43 43
 if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') {
44
-	$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
44
+    $access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
45 45
 }
46 46
 
47 47
 $xajax -> processRequests();
@@ -162,22 +162,22 @@  discard block
 block discarded – undo
162 162
 		<select name="access_url_id" onchange="javascript:send();">
163 163
 			<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
164 164
 			<?php
165
-			$url_selected='';
166
-			foreach ($url_list as $url_obj) {
167
-				$checked = '';
168
-				if (!empty($access_url_id)) {
169
-					if ($url_obj[0]==$access_url_id) {
170
-						$checked = 'selected=true';
171
-						$url_selected=$url_obj[1];
172
-					}
173
-				}
174
-				if ($url_obj['active']==1) {
175
-					?>
165
+            $url_selected='';
166
+            foreach ($url_list as $url_obj) {
167
+                $checked = '';
168
+                if (!empty($access_url_id)) {
169
+                    if ($url_obj[0]==$access_url_id) {
170
+                        $checked = 'selected=true';
171
+                        $url_selected=$url_obj[1];
172
+                    }
173
+                }
174
+                if ($url_obj['active']==1) {
175
+                    ?>
176 176
 					<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
177 177
 				<?php
178
-				}
179
-			}
180
-			?>
178
+                }
179
+            }
180
+            ?>
181 181
 		</select>
182 182
 		<br /><br />
183 183
 		<input type="hidden" name="form_sent" value="1" />
@@ -196,38 +196,38 @@  discard block
 block discarded – undo
196 196
 				<td align="center">
197 197
 					<div id="content_source">
198 198
 						<?php
199
-						if($ajax_search) {
200
-							?>
199
+                        if($ajax_search) {
200
+                            ?>
201 201
 							<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
202 202
 							<div id="ajax_list_courses"></div>
203 203
 						<?php
204
-						} else {
205
-							?>
204
+                        } else {
205
+                            ?>
206 206
 							<select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
207 207
 								<?php
208
-								foreach($no_course_list as $no_course) {
209
-									?>
208
+                                foreach($no_course_list as $no_course) {
209
+                                    ?>
210 210
 									<option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
211 211
 								<?php
212
-								}
213
-								unset($no_course_list);
214
-								?>
212
+                                }
213
+                                unset($no_course_list);
214
+                                ?>
215 215
 							</select>
216 216
 						<?php
217
-						}
218
-						?>
217
+                        }
218
+                        ?>
219 219
 					</div>
220 220
 				</td>
221 221
 				<td width="10%" valign="middle" align="center">
222 222
 					<?php
223
-					if($ajax_search) {
224
-						?>
223
+                    if($ajax_search) {
224
+                        ?>
225 225
 						<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" >
226 226
                             <em class="fa fa-arrow-left"></em>
227 227
 						</button>
228 228
 					<?php
229
-					} else {
230
-						?>
229
+                    } else {
230
+                        ?>
231 231
 						<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
232 232
                             <em class="fa fa-arrow-right"></em>
233 233
 						</button>
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
                             <em class="fa fa-arrow-left"></em>
237 237
 						</button>
238 238
 					<?php
239
-					}
240
-					?>
239
+                    }
240
+                    ?>
241 241
 					<br /><br /><br /><br /><br /><br />
242 242
 				</td>
243 243
 				<td align="center">
244 244
 					<select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
245 245
 						<?php
246
-						foreach($course_list as $course) {
247
-							$courseInfo = api_get_course_info_by_id($course['id']);
248
-							?>
246
+                        foreach($course_list as $course) {
247
+                            $courseInfo = api_get_course_info_by_id($course['id']);
248
+                            ?>
249 249
 							<option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option>
250 250
 						<?php
251
-						}
252
-						unset($course_list);
253
-						?>
251
+                        }
252
+                        unset($course_list);
253
+                        ?>
254 254
 
255 255
 					</select></td>
256 256
 			</tr>
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 				<td colspan="3" align="center">
259 259
 					<br />
260 260
 					<?php
261
-					if(isset($_GET['add']))
262
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
263
-					else
264
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
265
-					?>
261
+                    if(isset($_GET['add']))
262
+                        echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
263
+                    else
264
+                        echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
265
+                    ?>
266 266
 				</td>
267 267
 			</tr>
268 268
 		</table>
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
                 if (isset($_REQUEST['activate_start_date_check']) &&
545 545
                     $_REQUEST['activate_start_date_check'] == 1
546 546
                 ) {
547
-                	$publicated_on = $_REQUEST['publicated_on'];
547
+                    $publicated_on = $_REQUEST['publicated_on'];
548 548
                 } else {
549
-                	$publicated_on = null;
549
+                    $publicated_on = null;
550 550
                 }
551 551
 
552 552
                 if (isset($_REQUEST['activate_end_date_check']) &&
553 553
                     $_REQUEST['activate_end_date_check'] == 1
554 554
                 ) {
555
-                	$expired_on = $_REQUEST['expired_on'];
555
+                    $expired_on = $_REQUEST['expired_on'];
556 556
                 } else {
557
-                	$expired_on = null;
557
+                    $expired_on = null;
558 558
                 }
559 559
 
560 560
                 $new_lp_id = learnpath::add_lp(
@@ -958,9 +958,9 @@  discard block
 block discarded – undo
958 958
             $_SESSION['oLP']->setAccumulateScormTime($accumulateScormTime);
959 959
 
960 960
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
961
-            	$publicated_on  = $_REQUEST['publicated_on'];
961
+                $publicated_on  = $_REQUEST['publicated_on'];
962 962
             } else {
963
-            	$publicated_on = null;
963
+                $publicated_on = null;
964 964
             }
965 965
 
966 966
             if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
         } elseif ($mode == 'embedded') {
1179 1179
             $_SESSION['oLP']->mode = 'embedded';
1180 1180
         } elseif ($mode == 'embedframe') {
1181
-        	$_SESSION['oLP']->mode = 'embedframe';
1181
+            $_SESSION['oLP']->mode = 'embedframe';
1182 1182
         } elseif ($mode == 'impress') {
1183 1183
             $_SESSION['oLP']->mode = 'impress';
1184 1184
         }
@@ -1219,10 +1219,10 @@  discard block
 block discarded – undo
1219 1219
 		require 'lp_list.php';
1220 1220
 		break;
1221 1221
      */
1222
-	case 'switch_attempt_mode':
1223
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1224
-		$_SESSION['refresh'] = 1;
1225
-		$_SESSION['oLP']->switch_attempt_mode();
1222
+    case 'switch_attempt_mode':
1223
+        if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1224
+        $_SESSION['refresh'] = 1;
1225
+        $_SESSION['oLP']->switch_attempt_mode();
1226 1226
         require 'lp_list.php';
1227 1227
         break;
1228 1228
     case 'switch_scorm_debug':
Please login to merge, or discard this patch.
main/lp/lp_edit.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -178,8 +178,8 @@
 block discarded – undo
178 178
 );
179 179
 $display_date = 'none';
180 180
 if (!empty($expired_on)) {
181
-	$display_date = 'block';
182
-	$defaults['activate_end_date_check'] = 1;
181
+    $display_date = 'block';
182
+    $defaults['activate_end_date_check'] = 1;
183 183
 }
184 184
 
185 185
 $form->addElement('html', '<div id="end_date_div" style="display:'.$display_date.';">');
Please login to merge, or discard this patch.
main/user/subscribe_user.php 1 patch
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 // Access restriction
29 29
 if (!api_is_allowed_to_edit()) {
30
-	 api_not_allowed(true);
30
+        api_not_allowed(true);
31 31
 }
32 32
 
33 33
 $tool_name = get_lang("SubscribeUserToCourse");
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 $courseInfo = api_get_course_info();
38 38
 
39 39
 if ($type == COURSEMANAGER) {
40
-	$tool_name = get_lang("SubscribeUserToCourseAsTeacher");
40
+    $tool_name = get_lang("SubscribeUserToCourseAsTeacher");
41 41
 }
42 42
 
43 43
 //extra entries in breadcrumb
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         "url" => "subscribe_user.php?type=".$type.'&'.api_get_cidreq(),
51 51
         "name" => $tool_name,
52 52
     );
53
-	$tool_name = get_lang('SearchResults');
53
+    $tool_name = get_lang('SearchResults');
54 54
 }
55 55
 
56 56
 $current_session_id = api_get_session_id();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         );
80 80
     }
81 81
 
82
-	$user_id_temp = $_SESSION['session_user_id'];
82
+    $user_id_temp = $_SESSION['session_user_id'];
83 83
 
84 84
     if (is_array($user_id_temp)) {
85 85
         $counter = count($user_id_temp);
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
 
173 173
             header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
174 174
             exit;
175
-			break;
176
-	}
175
+            break;
176
+    }
177 177
 }
178 178
 
179 179
 if (!empty($_SESSION['session_user_id'])) {
180
-	unset($_SESSION['session_user_id']);
180
+    unset($_SESSION['session_user_id']);
181 181
 }
182 182
 
183 183
 if (!empty($_SESSION['session_user_name'])) {
184
-	unset($_SESSION['session_user_name']);
184
+    unset($_SESSION['session_user_name']);
185 185
 }
186 186
 
187 187
 $is_western_name_order = api_is_western_name_order();
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 
190 190
 // Build table
191 191
 $table = new SortableTable(
192
-	'subscribe_users',
193
-	'get_number_of_users',
194
-	'get_user_data',
195
-	($is_western_name_order xor $sort_by_first_name) ? 3 : 2
192
+    'subscribe_users',
193
+    'get_number_of_users',
194
+    'get_user_data',
195
+    ($is_western_name_order xor $sort_by_first_name) ? 3 : 2
196 196
 );
197 197
 $parameters['keyword'] = $keyword;
198 198
 $parameters['type'] = $type;
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
  */
275 275
 function get_number_of_users()
276 276
 {
277
-	// Database table definition
278
-	$user_table = Database::get_main_table(TABLE_MAIN_USER);
279
-	$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
280
-	$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
281
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
277
+    // Database table definition
278
+    $user_table = Database::get_main_table(TABLE_MAIN_USER);
279
+    $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
280
+    $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
281
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
282 282
 
283 283
     $courseCode = api_get_course_id();
284 284
     $sessionId = api_get_session_id();
285 285
 
286
-	if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'teacher') {
287
-		if (api_get_session_id() != 0) {
288
-			$sql = "SELECT COUNT(u.user_id)
286
+    if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'teacher') {
287
+        if (api_get_session_id() != 0) {
288
+            $sql = "SELECT COUNT(u.user_id)
289 289
 					FROM $user_table u
290 290
 					LEFT JOIN $tbl_session_rel_course_user cu
291 291
 					ON
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 						u.status = 1 AND
298 298
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
299 299
 
300
-			if (api_is_multiple_url_enabled()) {
301
-				$url_access_id = api_get_current_access_url_id();
302
-				if ($url_access_id !=-1) {
303
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
304
-					$sql = "SELECT COUNT(u.user_id)
300
+            if (api_is_multiple_url_enabled()) {
301
+                $url_access_id = api_get_current_access_url_id();
302
+                if ($url_access_id !=-1) {
303
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
304
+                    $sql = "SELECT COUNT(u.user_id)
305 305
 							FROM $user_table u
306 306
 							LEFT JOIN $tbl_session_rel_course_user cu
307 307
 							ON
@@ -315,34 +315,34 @@  discard block
 block discarded – undo
315 315
 								u.status = 1 AND
316 316
 								(u.official_code <> 'ADMIN' OR u.official_code IS NULL)
317 317
 							";
318
-				}
319
-			}
320
-		} else {
321
-			$sql = "SELECT COUNT(u.user_id)
318
+                }
319
+            }
320
+        } else {
321
+            $sql = "SELECT COUNT(u.user_id)
322 322
 					FROM $user_table u
323 323
 					LEFT JOIN $course_user_table cu
324 324
 					ON u.user_id = cu.user_id and c_id='".api_get_course_int_id()."'
325 325
 				    WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
326 326
 
327
-			if (api_is_multiple_url_enabled()) {
328
-				$url_access_id = api_get_current_access_url_id();
329
-				if ($url_access_id !=-1) {
330
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
327
+            if (api_is_multiple_url_enabled()) {
328
+                $url_access_id = api_get_current_access_url_id();
329
+                if ($url_access_id !=-1) {
330
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
331 331
 
332
-					$sql = "SELECT COUNT(u.user_id)
332
+                    $sql = "SELECT COUNT(u.user_id)
333 333
 						FROM $user_table u
334 334
 						LEFT JOIN $course_user_table cu
335 335
 						ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'
336 336
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
337 337
 						ON (url_rel_user.user_id = u.user_id)
338 338
 						WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
339
-				}
340
-			}
341
-		}
342
-	} else {
343
-		// students
344
-		if (api_get_session_id() != 0) {
345
-			$sql = "SELECT COUNT(u.user_id)
339
+                }
340
+            }
341
+        }
342
+    } else {
343
+        // students
344
+        if (api_get_session_id() != 0) {
345
+            $sql = "SELECT COUNT(u.user_id)
346 346
 					FROM $user_table u
347 347
 					LEFT JOIN $tbl_session_rel_course_user cu
348 348
 					ON
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 						u.status<>".DRH." AND
355 355
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
356 356
 
357
-			if (api_is_multiple_url_enabled()) {
358
-				$url_access_id = api_get_current_access_url_id();
359
-				if ($url_access_id !=-1) {
360
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
361
-					$sql = "SELECT COUNT(u.user_id)
357
+            if (api_is_multiple_url_enabled()) {
358
+                $url_access_id = api_get_current_access_url_id();
359
+                if ($url_access_id !=-1) {
360
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
361
+                    $sql = "SELECT COUNT(u.user_id)
362 362
 							FROM $user_table u
363 363
 							LEFT JOIN $tbl_session_rel_course_user cu
364 364
 							ON
@@ -372,21 +372,21 @@  discard block
 block discarded – undo
372 372
 								u.status<>".DRH." AND
373 373
 								access_url_id= $url_access_id AND
374 374
 								(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
375
-				}
376
-			}
377
-		} else {
378
-			$sql = "SELECT COUNT(u.user_id)
375
+                }
376
+            }
377
+        } else {
378
+            $sql = "SELECT COUNT(u.user_id)
379 379
 					FROM $user_table u
380 380
 					LEFT JOIN $course_user_table cu
381 381
 					ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'";
382 382
 
383
-			// we change the SQL when we have a filter
384
-			if (isset($_GET['subscribe_user_filter_value']) &&
383
+            // we change the SQL when we have a filter
384
+            if (isset($_GET['subscribe_user_filter_value']) &&
385 385
                 !empty($_GET['subscribe_user_filter_value']) &&
386 386
                 api_get_setting('ProfilingFilterAddingUsers') == 'true'
387 387
             ){
388
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
389
-				$sql .=	"
388
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
389
+                $sql .=	"
390 390
 					LEFT JOIN $table_user_field_values field_values
391 391
 					ON field_values.item_id = u.user_id
392 392
 					WHERE
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
 						field_values.field_id = '".intval($field_identification[0])."' AND
396 396
 						field_values.value = '".Database::escape_string($field_identification[1])."'
397 397
 					";
398
-			} else	{
399
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
400
-			}
398
+            } else	{
399
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
400
+            }
401 401
 
402
-			if (api_is_multiple_url_enabled()) {
403
-				$url_access_id = api_get_current_access_url_id();
402
+            if (api_is_multiple_url_enabled()) {
403
+                $url_access_id = api_get_current_access_url_id();
404 404
 
405
-				if ($url_access_id !=-1) {
405
+                if ($url_access_id !=-1) {
406 406
 
407
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
407
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
408 408
 
409
-					$sql = "SELECT COUNT(u.user_id)
409
+                    $sql = "SELECT COUNT(u.user_id)
410 410
 							FROM $user_table u
411 411
 							LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and c_id='".api_get_course_int_id()."'
412 412
 							INNER JOIN  $tbl_url_rel_user as url_rel_user
413 413
 							ON (url_rel_user.user_id = u.user_id)
414 414
 							WHERE cu.user_id IS NULL AND access_url_id= $url_access_id AND u.status<>".DRH." ";
415
-				}
416
-			}
417
-		}
418
-	}
419
-
420
-	// when there is a keyword then we are searching and we have to change the SQL statement
421
-	if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
422
-		$keyword = Database::escape_string(trim($_REQUEST['keyword']));
423
-		$sql .= " AND (
415
+                }
416
+            }
417
+        }
418
+    }
419
+
420
+    // when there is a keyword then we are searching and we have to change the SQL statement
421
+    if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
422
+        $keyword = Database::escape_string(trim($_REQUEST['keyword']));
423
+        $sql .= " AND (
424 424
 		    firstname LIKE '%".$keyword."%' OR
425 425
 		    lastname LIKE '%".$keyword."%' OR
426 426
 		    email LIKE '%".$keyword."%' OR
@@ -428,37 +428,37 @@  discard block
 block discarded – undo
428 428
 		    official_code LIKE '%".$keyword."%'
429 429
         )";
430 430
 
431
-		// we also want to search for users who have something in their profile fields that matches the keyword
432
-		if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
433
-			$additional_users = search_additional_profile_fields($keyword);
434
-		}
431
+        // we also want to search for users who have something in their profile fields that matches the keyword
432
+        if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
433
+            $additional_users = search_additional_profile_fields($keyword);
434
+        }
435 435
 
436
-		// getting all the users of the course (to make sure that we do not display users that are already in the course)
437
-		if (!empty($_SESSION["id_session"])) {
436
+        // getting all the users of the course (to make sure that we do not display users that are already in the course)
437
+        if (!empty($_SESSION["id_session"])) {
438 438
             $a_course_users = CourseManager:: get_user_list_from_course_code(
439 439
                 $courseCode,
440 440
                 $sessionId
441 441
             );
442
-		} else {
442
+        } else {
443 443
             $a_course_users = CourseManager:: get_user_list_from_course_code(
444 444
                 $courseCode,
445 445
                 0
446 446
             );
447
-	    }
448
-		foreach ($a_course_users as $user_id=>$course_user) {
449
-			$users_of_course[] = $course_user['user_id'];
450
-	    }
451
-	}
447
+        }
448
+        foreach ($a_course_users as $user_id=>$course_user) {
449
+            $users_of_course[] = $course_user['user_id'];
450
+        }
451
+    }
452 452
     $sql .=" AND u.status <> ".ANONYMOUS." ";
453
-	$res = Database::query($sql);
453
+    $res = Database::query($sql);
454 454
     $count_user = 0;
455 455
 
456 456
     if ($res) {
457
-	   $row = Database::fetch_row($res);
458
-	   $count_user = $row[0];
459
-	}
457
+        $row = Database::fetch_row($res);
458
+        $count_user = $row[0];
459
+    }
460 460
 
461
-	return $count_user;
461
+    return $count_user;
462 462
 }
463 463
 /**
464 464
  * Get the users to display on the current page.
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
     $url_access_id = api_get_current_access_url_id();
469 469
     $course_code = api_get_course_id();
470 470
     $session_id = api_get_session_id();
471
-	$courseId = api_get_course_int_id();
471
+    $courseId = api_get_course_int_id();
472 472
 
473
-	// Database table definitions
474
-	$user_table = Database::get_main_table(TABLE_MAIN_USER);
475
-	$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
476
-	$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
477
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
473
+    // Database table definitions
474
+    $user_table = Database::get_main_table(TABLE_MAIN_USER);
475
+    $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
476
+    $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
477
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
478 478
     $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
479 479
 
480 480
     // adding teachers
481
-	$is_western_name_order = api_is_western_name_order();
481
+    $is_western_name_order = api_is_western_name_order();
482 482
 
483 483
     if (api_get_setting('show_email_addresses') == 'true') {
484 484
 
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
                 u.active               AS col4,
504 504
                 u.user_id              AS col5";
505 505
     }
506
-	if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) {
507
-		// adding a teacher through a session
508
-		if (!empty($session_id)) {
509
-			$sql = "SELECT $select_fields
506
+    if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) {
507
+        // adding a teacher through a session
508
+        if (!empty($session_id)) {
509
+            $sql = "SELECT $select_fields
510 510
 					FROM $user_table u
511 511
 					LEFT JOIN $tbl_session_rel_course_user cu
512 512
 					ON
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
                     INNER JOIN  $tbl_url_rel_user as url_rel_user
517 517
                     ON (url_rel_user.user_id = u.user_id) ";
518 518
 
519
-			// applying the filter of the additional user profile fields
520
-			if (isset($_GET['subscribe_user_filter_value']) &&
521
-				!empty($_GET['subscribe_user_filter_value']) &&
522
-				api_get_setting('ProfilingFilterAddingUsers') == 'true'
523
-			) {
524
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
525
-				$sql .=	"
519
+            // applying the filter of the additional user profile fields
520
+            if (isset($_GET['subscribe_user_filter_value']) &&
521
+                !empty($_GET['subscribe_user_filter_value']) &&
522
+                api_get_setting('ProfilingFilterAddingUsers') == 'true'
523
+            ) {
524
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
525
+                $sql .=	"
526 526
 					LEFT JOIN $table_user_field_values field_values
527 527
 						ON field_values.item_id = u.user_id
528 528
 					WHERE
@@ -531,53 +531,53 @@  discard block
 block discarded – undo
531 531
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) AND
532 532
 						field_values.field_id = '".intval($field_identification[0])."' AND
533 533
 						field_values.value = '".Database::escape_string($field_identification[1])."'";
534
-			} else {
535
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status=1 AND (u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
536
-			}
534
+            } else {
535
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status=1 AND (u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
536
+            }
537 537
 
538 538
             $sql .=	" AND access_url_id= $url_access_id";
539 539
 
540
-		} else {
541
-		     // adding a teacher NOT through a session
542
-			$sql = "SELECT $select_fields
540
+        } else {
541
+                // adding a teacher NOT through a session
542
+            $sql = "SELECT $select_fields
543 543
                     FROM $user_table u
544 544
                     LEFT JOIN $course_user_table cu
545 545
                     ON u.user_id = cu.user_id AND c_id = '".$courseId."'";
546 546
 
547
-				// applying the filter of the additional user profile fields
548
-				if (isset($_GET['subscribe_user_filter_value']) &&
549
-					!empty($_GET['subscribe_user_filter_value']) &&
550
-					api_get_setting('ProfilingFilterAddingUsers') == 'true'
551
-				) {
552
-					$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
553
-					$sql .=	"
547
+                // applying the filter of the additional user profile fields
548
+                if (isset($_GET['subscribe_user_filter_value']) &&
549
+                    !empty($_GET['subscribe_user_filter_value']) &&
550
+                    api_get_setting('ProfilingFilterAddingUsers') == 'true'
551
+                ) {
552
+                    $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
553
+                    $sql .=	"
554 554
 						LEFT JOIN $table_user_field_values field_values
555 555
 							ON field_values.item_id = u.user_id
556 556
 						WHERE
557 557
 							cu.user_id IS NULL AND u.status<>".DRH." AND
558 558
 							field_values.field_id = '".intval($field_identification[0])."' AND
559 559
 							field_values.value = '".Database::escape_string($field_identification[1])."'";
560
-				} else	{
561
-					$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
562
-				}
563
-
564
-				// adding a teacher NOT trough a session on a portal with multiple URLs
565
-				if (api_is_multiple_url_enabled()) {
566
-					if ($url_access_id !=-1) {
567
-						$sql = "SELECT $select_fields
560
+                } else	{
561
+                    $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
562
+                }
563
+
564
+                // adding a teacher NOT trough a session on a portal with multiple URLs
565
+                if (api_is_multiple_url_enabled()) {
566
+                    if ($url_access_id !=-1) {
567
+                        $sql = "SELECT $select_fields
568 568
 						FROM $user_table u
569 569
 						LEFT JOIN $course_user_table cu
570 570
 						ON u.user_id = cu.user_id and c_id='".$courseId."'
571 571
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
572 572
 						ON (url_rel_user.user_id = u.user_id) ";
573 573
 
574
-					// applying the filter of the additional user profile fields
575
-					if (isset($_GET['subscribe_user_filter_value']) &&
576
-						!empty($_GET['subscribe_user_filter_value']) &&
577
-						api_get_setting('ProfilingFilterAddingUsers') == 'true'
578
-					){
579
-						$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
580
-						$sql .=	"
574
+                    // applying the filter of the additional user profile fields
575
+                    if (isset($_GET['subscribe_user_filter_value']) &&
576
+                        !empty($_GET['subscribe_user_filter_value']) &&
577
+                        api_get_setting('ProfilingFilterAddingUsers') == 'true'
578
+                    ){
579
+                        $field_identification = explode('*', $_GET['subscribe_user_filter_value']);
580
+                        $sql .=	"
581 581
 							LEFT JOIN $table_user_field_values field_values
582 582
 								ON field_values.item_id = u.user_id
583 583
 							WHERE
@@ -585,16 +585,16 @@  discard block
 block discarded – undo
585 585
 							 	u.status<>".DRH." AND
586 586
 							 	field_values.field_id = '".intval($field_identification[0])."' AND
587 587
 							 	field_values.value = '".Database::escape_string($field_identification[1])."'";
588
-					} else	{
589
-						$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
590
-					}
591
-				}
592
-			}
593
-		}
594
-	} else {
595
-		// adding a student
596
-		if (!empty($session_id)) {
597
-			$sql = "SELECT $select_fields
588
+                    } else	{
589
+                        $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
590
+                    }
591
+                }
592
+            }
593
+        }
594
+    } else {
595
+        // adding a student
596
+        if (!empty($session_id)) {
597
+            $sql = "SELECT $select_fields
598 598
                     FROM $user_table u
599 599
                     LEFT JOIN $tbl_session_rel_course_user cu
600 600
                     ON
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
                 $sql .=  "AND access_url_id = $url_access_id";
630 630
             }
631 631
 
632
-		} else {
632
+        } else {
633 633
             $sql = "SELECT $select_fields
634 634
                     FROM $user_table u
635 635
                     LEFT JOIN $course_user_table cu
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
                     	u.user_id = cu.user_id AND
638 638
                     	c_id ='".$courseId."'";
639 639
 
640
-			// applying the filter of the additional user profile fields
641
-			if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])){
642
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
643
-				$sql .=	"
640
+            // applying the filter of the additional user profile fields
641
+            if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])){
642
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
643
+                $sql .=	"
644 644
 					LEFT JOIN $table_user_field_values field_values
645 645
 						ON field_values.item_id = u.user_id
646 646
 					WHERE
@@ -648,28 +648,28 @@  discard block
 block discarded – undo
648 648
 						u.status<>".DRH." AND
649 649
 						field_values.field_id = '".intval($field_identification[0])."' AND
650 650
 						field_values.value = '".Database::escape_string($field_identification[1])."'";
651
-			} else	{
652
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
653
-			}
651
+            } else	{
652
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
653
+            }
654 654
 
655
-			//showing only the courses of the current Chamilo access_url_id
655
+            //showing only the courses of the current Chamilo access_url_id
656 656
 
657
-			if (api_is_multiple_url_enabled()) {
658
-				if ($url_access_id !=-1) {
659
-					$sql = "SELECT $select_fields
657
+            if (api_is_multiple_url_enabled()) {
658
+                if ($url_access_id !=-1) {
659
+                    $sql = "SELECT $select_fields
660 660
 						FROM $user_table u
661 661
 						LEFT JOIN $course_user_table cu
662 662
 						ON u.user_id = cu.user_id AND c_id='".$courseId."'
663 663
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
664 664
 						ON (url_rel_user.user_id = u.user_id) ";
665 665
 
666
-					// applying the filter of the additional user profile fields
667
-					if (isset($_GET['subscribe_user_filter_value']) &&
668
-						!empty($_GET['subscribe_user_filter_value']) &&
669
-						api_get_setting('ProfilingFilterAddingUsers') == 'true'
670
-					){
671
-						$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
672
-						$sql .=	"
666
+                    // applying the filter of the additional user profile fields
667
+                    if (isset($_GET['subscribe_user_filter_value']) &&
668
+                        !empty($_GET['subscribe_user_filter_value']) &&
669
+                        api_get_setting('ProfilingFilterAddingUsers') == 'true'
670
+                    ){
671
+                        $field_identification = explode('*', $_GET['subscribe_user_filter_value']);
672
+                        $sql .=	"
673 673
 							LEFT JOIN $table_user_field_values field_values
674 674
 								ON field_values.item_id = u.user_id
675 675
 							WHERE
@@ -679,19 +679,19 @@  discard block
 block discarded – undo
679 679
 								field_values.value = '".Database::escape_string($field_identification[1])."' AND
680 680
 								access_url_id = $url_access_id
681 681
                             ";
682
-					} else	{
683
-						$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
684
-					}
685
-				}
686
-			}
687
-		}
688
-	}
689
-
690
-	// adding additional WHERE statements to the SQL for the search functionality
682
+                    } else	{
683
+                        $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
684
+                    }
685
+                }
686
+            }
687
+        }
688
+    }
689
+
690
+    // adding additional WHERE statements to the SQL for the search functionality
691 691
     $additional_users = null;
692
-	if (isset($_REQUEST['keyword'])) {
693
-		$keyword = Database::escape_string(trim($_REQUEST['keyword']));
694
-		$sql .= " AND (
692
+    if (isset($_REQUEST['keyword'])) {
693
+        $keyword = Database::escape_string(trim($_REQUEST['keyword']));
694
+        $sql .= " AND (
695 695
 					firstname LIKE '%".$keyword."%' OR
696 696
 					lastname LIKE '%".$keyword."%' OR
697 697
 					email LIKE '%".$keyword."%' OR
@@ -700,46 +700,46 @@  discard block
 block discarded – undo
700 700
 					)
701 701
 				";
702 702
 
703
-		if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
704
-			// we also want to search for users who have something in
705
-			// their profile fields that matches the keyword
706
-			$additional_users = search_additional_profile_fields($keyword);
707
-		}
708
-
709
-		// getting all the users of the course (to make sure that we do not
710
-		// display users that are already in the course)
711
-		if (!empty($session_id)) {
712
-			$a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $session_id);
713
-		} else {
714
-			$a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0);
715
-	    }
716
-		foreach ($a_course_users as $user_id=>$course_user) {
717
-			$users_of_course[] = $course_user['user_id'];
718
-		}
719
-	}
720
-
721
-	$sql .=" AND u.status != ".ANONYMOUS." ";
722
-
723
-	// Sorting and pagination (used by the sortable table)
724
-	$sql .= " ORDER BY col$column $direction ";
725
-	$sql .= " LIMIT $from,$number_of_items";
726
-
727
-	$res = Database::query($sql);
728
-	$users = array ();
729
-	while ($user = Database::fetch_row($res)) {
730
-		$users[] = $user;
731
-		$_SESSION['session_user_id'][] = $user[0];
732
-		if ($is_western_name_order) {
733
-			$_SESSION['session_user_name'][] = api_get_person_name($user[2], $user[3]);
734
-		} else {
735
-			$_SESSION['session_user_name'][] = api_get_person_name($user[3], $user[2]);
736
-		}
737
-	}
738
-	// adding additional users based on the search on the additional profile fields
739
-	if (isset($_REQUEST['keyword'])){
740
-		if (is_array($additional_users)) {
741
-			foreach($additional_users as $additional_user_key=>$additional_user_value){
742
-				if (!in_array($additional_user_key, $_SESSION['session_user_id']) &&
703
+        if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
704
+            // we also want to search for users who have something in
705
+            // their profile fields that matches the keyword
706
+            $additional_users = search_additional_profile_fields($keyword);
707
+        }
708
+
709
+        // getting all the users of the course (to make sure that we do not
710
+        // display users that are already in the course)
711
+        if (!empty($session_id)) {
712
+            $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $session_id);
713
+        } else {
714
+            $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0);
715
+        }
716
+        foreach ($a_course_users as $user_id=>$course_user) {
717
+            $users_of_course[] = $course_user['user_id'];
718
+        }
719
+    }
720
+
721
+    $sql .=" AND u.status != ".ANONYMOUS." ";
722
+
723
+    // Sorting and pagination (used by the sortable table)
724
+    $sql .= " ORDER BY col$column $direction ";
725
+    $sql .= " LIMIT $from,$number_of_items";
726
+
727
+    $res = Database::query($sql);
728
+    $users = array ();
729
+    while ($user = Database::fetch_row($res)) {
730
+        $users[] = $user;
731
+        $_SESSION['session_user_id'][] = $user[0];
732
+        if ($is_western_name_order) {
733
+            $_SESSION['session_user_name'][] = api_get_person_name($user[2], $user[3]);
734
+        } else {
735
+            $_SESSION['session_user_name'][] = api_get_person_name($user[3], $user[2]);
736
+        }
737
+    }
738
+    // adding additional users based on the search on the additional profile fields
739
+    if (isset($_REQUEST['keyword'])){
740
+        if (is_array($additional_users)) {
741
+            foreach($additional_users as $additional_user_key=>$additional_user_value){
742
+                if (!in_array($additional_user_key, $_SESSION['session_user_id']) &&
743 743
                     !in_array($additional_user_key,$users_of_course)
744 744
                 ){
745 745
                     $users[] = array(
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
                         $additional_user_value['col5'],
752 752
                         $additional_user_value['col6'],
753 753
                     );
754
-				}
755
-			}
756
-		}
757
-	}
758
-	return $users;
754
+                }
755
+            }
756
+        }
757
+    }
758
+    return $users;
759 759
 }
760 760
 /**
761 761
 * Returns a mailto-link
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 * @return string HTML-code with a mailto-link
764 764
 */
765 765
 function email_filter($email) {
766
-	return Display :: encrypted_mailto_link($email, $email);
766
+    return Display :: encrypted_mailto_link($email, $email);
767 767
 }
768 768
 /**
769 769
  * Build the reg-column of the table
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
     } else {
777 777
         $type = STUDENT;
778 778
     }
779
-	$result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>';
780
-	return $result;
779
+    $result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>';
780
+    return $result;
781 781
 }
782 782
 
783 783
 /**
@@ -791,23 +791,23 @@  discard block
 block discarded – undo
791 791
  */
792 792
 
793 793
 function active_filter($active, $url_params, $row) {
794
-	$_user = api_get_user_info();
795
-	if ($active=='1') {
796
-		$action='AccountActive';
797
-		$image='accept';
798
-	}
799
-
800
-	if ($active=='0') {
801
-		$action='AccountInactive';
802
-		$image='error';
803
-	}
794
+    $_user = api_get_user_info();
795
+    if ($active=='1') {
796
+        $action='AccountActive';
797
+        $image='accept';
798
+    }
799
+
800
+    if ($active=='0') {
801
+        $action='AccountInactive';
802
+        $image='error';
803
+    }
804 804
     $result = null;
805
-	if ($row['0']<>$_user['user_id']) {
806
-	// you cannot lock yourself out otherwise you could disable all the accounts
807
-	// including your own => everybody is locked out and nobody can change it anymore.
808
-		$result = Display::return_icon($image.'.png',  get_lang(ucfirst($action)), array() , ICON_SIZE_TINY);
809
-	}
810
-	return $result;
805
+    if ($row['0']<>$_user['user_id']) {
806
+    // you cannot lock yourself out otherwise you could disable all the accounts
807
+    // including your own => everybody is locked out and nobody can change it anymore.
808
+        $result = Display::return_icon($image.'.png',  get_lang(ucfirst($action)), array() , ICON_SIZE_TINY);
809
+    }
810
+    return $result;
811 811
 }
812 812
 
813 813
 /**
@@ -825,29 +825,29 @@  discard block
 block discarded – undo
825 825
  */
826 826
 function search_additional_profile_fields($keyword)
827 827
 {
828
-	// database table definitions
829
-	$table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
830
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
828
+    // database table definitions
829
+    $table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
830
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
831 831
     $tableExtraField = Database::get_main_table(TABLE_EXTRA_FIELD);
832
-	$table_user = Database::get_main_table(TABLE_MAIN_USER);
832
+    $table_user = Database::get_main_table(TABLE_MAIN_USER);
833 833
 
834
-	// getting the field option text that match this keyword (for radio buttons and checkboxes)
835
-	$sql = "SELECT * FROM $table_user_field_options
834
+    // getting the field option text that match this keyword (for radio buttons and checkboxes)
835
+    $sql = "SELECT * FROM $table_user_field_options
836 836
 	        WHERE display_text LIKE '%".$keyword."%'";
837
-	$result_profiling = Database::query($sql);
838
-	while ($profiling_field_options = Database::fetch_array($result_profiling)) {
839
-		$profiling_field_options_exact_values[] = $profiling_field_options;
840
-	}
837
+    $result_profiling = Database::query($sql);
838
+    while ($profiling_field_options = Database::fetch_array($result_profiling)) {
839
+        $profiling_field_options_exact_values[] = $profiling_field_options;
840
+    }
841 841
     $profiling_field_options_exact_values_sql = '';
842
-	foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue){
843
-		$profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') ";
844
-	}
842
+    foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue){
843
+        $profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') ";
844
+    }
845 845
 
846 846
     $extraFieldType = ExtraField::USER_FIELD_TYPE;
847 847
 
848
-	// getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword
849
-	// or all the users who have entered the keyword in a free-form field
850
-	$sql = "SELECT
848
+    // getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword
849
+    // or all the users who have entered the keyword in a free-form field
850
+    $sql = "SELECT
851 851
 	            user.user_id as col0,
852 852
 	            user.official_code as col1,
853 853
 	            user.lastname as col2,
@@ -861,13 +861,13 @@  discard block
 block discarded – undo
861 861
                 user_values.field_id = e.id AND
862 862
                 e.extra_field_type = $extraFieldType AND
863 863
                 (value LIKE '%".$keyword."%'".$profiling_field_options_exact_values_sql.")";
864
-	$result = Database::query($sql);
864
+    $result = Database::query($sql);
865 865
     $additional_users = array();
866
-	while ($profiled_users = Database::fetch_array($result)) {
867
-		$additional_users[$profiled_users['col0']] = $profiled_users;
868
-	}
866
+    while ($profiled_users = Database::fetch_array($result)) {
867
+        $additional_users[$profiled_users['col0']] = $profiled_users;
868
+    }
869 869
 
870
-	return $additional_users;
870
+    return $additional_users;
871 871
 }
872 872
 
873 873
 /**
@@ -879,41 +879,41 @@  discard block
 block discarded – undo
879 879
  */
880 880
 function display_extra_profile_fields_filter()
881 881
 {
882
-	// getting all the additional user profile fields
883
-	$extra = UserManager::get_extra_fields(0,50,5,'ASC');
884
-
885
-	$return='<option value="">'.get_lang('SelectFilter').'</option>';
886
-
887
-	// looping through the additional user profile fields
888
-	foreach ($extra as $id => $field_details) {
889
-		// $field_details[2] contains the type of the additional user profile field
890
-		switch ($field_details[2]) {
891
-			// text fields cannot be used as a filter
892
-			case ExtraFieldModel::FIELD_TYPE_TEXT:
893
-				break;
894
-			// text area fields cannot be used as a filter
895
-			case ExtraFieldModel::FIELD_TYPE_TEXTAREA:
896
-				break;
897
-			case ExtraFieldModel::FIELD_TYPE_RADIO:
898
-			case ExtraFieldModel::FIELD_TYPE_SELECT:
899
-			case ExtraFieldModel::FIELD_TYPE_SELECT_MULTIPLE:
900
-				$return .= '<optgroup label="'.$field_details[3].'">';
901
-				foreach($field_details[9] as $option_id => $option_details) {
902
-					if ($_GET['subscribe_user_filter_value'] == $field_details[0].'*'.$option_details[1]) {
903
-						$selected = 'selected="selected"';
904
-					} else {
905
-						$selected = false;
906
-					}
907
-					$return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>';
908
-				}
909
-				$return .= '</optgroup>';
910
-				break;
911
-		}
912
-	}
913
-
914
-	echo '<form id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?api_get_cidreq" style="float:left;">';
915
-	echo '	<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />';
916
-	echo   '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>';
917
-	echo   '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>';
918
-	echo '</form>';
882
+    // getting all the additional user profile fields
883
+    $extra = UserManager::get_extra_fields(0,50,5,'ASC');
884
+
885
+    $return='<option value="">'.get_lang('SelectFilter').'</option>';
886
+
887
+    // looping through the additional user profile fields
888
+    foreach ($extra as $id => $field_details) {
889
+        // $field_details[2] contains the type of the additional user profile field
890
+        switch ($field_details[2]) {
891
+            // text fields cannot be used as a filter
892
+            case ExtraFieldModel::FIELD_TYPE_TEXT:
893
+                break;
894
+            // text area fields cannot be used as a filter
895
+            case ExtraFieldModel::FIELD_TYPE_TEXTAREA:
896
+                break;
897
+            case ExtraFieldModel::FIELD_TYPE_RADIO:
898
+            case ExtraFieldModel::FIELD_TYPE_SELECT:
899
+            case ExtraFieldModel::FIELD_TYPE_SELECT_MULTIPLE:
900
+                $return .= '<optgroup label="'.$field_details[3].'">';
901
+                foreach($field_details[9] as $option_id => $option_details) {
902
+                    if ($_GET['subscribe_user_filter_value'] == $field_details[0].'*'.$option_details[1]) {
903
+                        $selected = 'selected="selected"';
904
+                    } else {
905
+                        $selected = false;
906
+                    }
907
+                    $return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>';
908
+                }
909
+                $return .= '</optgroup>';
910
+                break;
911
+        }
912
+    }
913
+
914
+    echo '<form id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?api_get_cidreq" style="float:left;">';
915
+    echo '	<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />';
916
+    echo   '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>';
917
+    echo   '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>';
918
+    echo '</form>';
919 919
 }
Please login to merge, or discard this patch.
main/admin/configure_extensions.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,56 +17,56 @@  discard block
 block discarded – undo
17 17
 $message = '';
18 18
 
19 19
 if (isset($_POST['activeExtension'])) {
20
-	switch ($_POST['extension_code']) {
21
-		case 'ppt2lp':
22
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
20
+    switch ($_POST['extension_code']) {
21
+        case 'ppt2lp':
22
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
23 23
 					selected_value="true"
24 24
 					WHERE variable="service_ppt2lp"
25 25
 					AND subkey="active"';
26 26
 
27
-			$rs = Database::query($sql);
27
+            $rs = Database::query($sql);
28 28
 
29
-			if (Database::affected_rows($rs)>0){
30
-				$message = get_lang('ServiceActivated');
31
-			}
29
+            if (Database::affected_rows($rs)>0){
30
+                $message = get_lang('ServiceActivated');
31
+            }
32 32
 
33
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
33
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
34 34
 					selected_value="'.addslashes($_POST['host']).'"
35 35
 					WHERE variable="service_ppt2lp"
36 36
 					AND subkey="host"';
37
-			Database::query($sql);
37
+            Database::query($sql);
38 38
 
39
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
39
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
40 40
 					selected_value="'.addslashes($_POST['port']).'"
41 41
 					WHERE variable="service_ppt2lp"
42 42
 					AND subkey="port"';
43
-			Database::query($sql);
43
+            Database::query($sql);
44 44
 
45
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
45
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
46 46
 					selected_value="'.addslashes($_POST['ftp_password']).'"
47 47
 					WHERE variable="service_ppt2lp"
48 48
 					AND subkey="ftp_password"';
49
-			Database::query($sql);
49
+            Database::query($sql);
50 50
 
51
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
51
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
52 52
 					selected_value="'.addslashes($_POST['user']).'"
53 53
 					WHERE variable="service_ppt2lp"
54 54
 					AND subkey="user"';
55
-			Database::query($sql);
55
+            Database::query($sql);
56 56
 
57
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
57
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
58 58
 					selected_value="'.addslashes($_POST['path_to_lzx']).'"
59 59
 					WHERE variable="service_ppt2lp"
60 60
 					AND subkey="path_to_lzx"';
61
-			Database::query($sql);
61
+            Database::query($sql);
62 62
 
63
-			$sql = 'UPDATE '.$tbl_settings_current.' SET
63
+            $sql = 'UPDATE '.$tbl_settings_current.' SET
64 64
 					selected_value="'.addslashes($_POST['size']).'"
65 65
 					WHERE variable="service_ppt2lp"
66 66
 					AND subkey="size"';
67
-			Database::query($sql);
68
-			break;
69
-	}
67
+            Database::query($sql);
68
+            break;
69
+    }
70 70
 }
71 71
 
72 72
 $listActiveServices = array();
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 
78 78
 $rs = Database::query($sql);
79 79
 while($row = Database::fetch_array($rs)){
80
-	$listActiveServices[] = $row['variable'];
80
+    $listActiveServices[] = $row['variable'];
81 81
 }
82 82
 
83 83
 // javascript to handle accordion behaviour
84 84
 $javascript_message = '';
85 85
 if(!empty($message)){
86
-	$javascript_message = '
86
+    $javascript_message = '
87 87
 	document.getElementById("message").style.display = "block";
88 88
 	var timer = setTimeout(hideMessage, 5000);';
89 89
 }
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 ?>
136 136
 <div id="message" style="display: none">
137 137
 	<?php
138
-	if(!empty($message))
139
-		Display::display_normal_message($message)
140
-	?>
138
+    if(!empty($message))
139
+        Display::display_normal_message($message)
140
+    ?>
141 141
 </div>
142 142
 
143 143
 <div id="content" align="center">
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         </div>
201 201
     </div>
202 202
 	<?php
203
-	/*
203
+    /*
204 204
 	<!-- EPHORUS -->
205 205
 	<div id="main_ephorus">
206 206
 		<div id="extension_header_ephorus" class="accordion_header">
Please login to merge, or discard this patch.
main/inc/lib/internationalization.lib.php 1 patch
Indentation   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     }
100 100
 
101 101
     if (!isset($used_lang_vars)) {
102
-    	$used_lang_vars = array();
102
+        $used_lang_vars = array();
103 103
     }
104 104
 
105 105
     // Caching results from some API functions, for speed.
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     static $text_direction = array();
289 289
 
290 290
     if (empty($language)) {
291
-    	$language = api_get_interface_language();
291
+        $language = api_get_interface_language();
292 292
     }
293 293
     if (!isset($text_direction[$language])) {
294 294
         $text_direction[$language] = in_array(api_purify_language_id($language),
@@ -1703,7 +1703,6 @@  discard block
 block discarded – undo
1703 1703
 
1704 1704
 /**
1705 1705
  * Return true a date is valid
1706
-
1707 1706
  * @param string $date example: 2014-06-30 13:05:05
1708 1707
  * @param string $format example: "Y-m-d H:i:s"
1709 1708
  *
@@ -1973,15 +1972,15 @@  discard block
 block discarded – undo
1973 1972
 {
1974 1973
     if ($showTime) {
1975 1974
         if ($humanForm) {
1976
-           return $date->format('j M Y H:i:s');
1975
+            return $date->format('j M Y H:i:s');
1977 1976
         } else {
1978
-           return $date->format('Y-m-d H:i:s');
1977
+            return $date->format('Y-m-d H:i:s');
1979 1978
         }
1980 1979
     } else {
1981 1980
         if ($humanForm) {
1982
-           return $date->format('j M Y');
1981
+            return $date->format('j M Y');
1983 1982
         } else {
1984
-           return $date->format('Y-m-d');
1983
+            return $date->format('Y-m-d');
1985 1984
         }
1986 1985
     }
1987 1986
 }
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb_api.php 1 patch
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -44,107 +44,107 @@  discard block
 block discarded – undo
44 44
 
45 45
 class BigBlueButtonBN {
46 46
 
47
-	private $_securitySalt;
48
-	private $_bbbServerBaseUrl;
47
+    private $_securitySalt;
48
+    private $_bbbServerBaseUrl;
49 49
 
50
-	/* ___________ General Methods for the BigBlueButton Class __________ */
50
+    /* ___________ General Methods for the BigBlueButton Class __________ */
51 51
 
52
-	function __construct() {
53
-	/*
52
+    function __construct() {
53
+    /*
54 54
 	Establish just our basic elements in the constructor:
55 55
 	*/
56
-		// BASE CONFIGS - set these for your BBB server in config.php and they will
57
-		// simply flow in here via the constants:
58
-		$this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
-		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
-	}
61
-
62
-	private function _processXmlResponse($url){
63
-	/*
56
+        // BASE CONFIGS - set these for your BBB server in config.php and they will
57
+        // simply flow in here via the constants:
58
+        $this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
+        $this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
+    }
61
+
62
+    private function _processXmlResponse($url){
63
+    /*
64 64
 	A private utility method used by other public methods to process XML responses.
65 65
 	*/
66
-		if (extension_loaded('curl')) {
67
-			$ch = curl_init() or die ( curl_error($ch) );
68
-			$timeout = 10;
69
-			curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
-			curl_setopt( $ch, CURLOPT_URL, $url );
71
-			curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
-			curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
-			$data = curl_exec( $ch );
74
-			curl_close( $ch );
75
-
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
80
-		}
81
-		return (simplexml_load_file($url));
82
-	}
83
-
84
-	private function _requiredParam($param) {
85
-		/* Process required params and throw errors if we don't get values */
86
-		if ((isset($param)) && ($param != '')) {
87
-			return $param;
88
-		}
89
-		elseif (!isset($param)) {
90
-			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
93
-			throw new Exception(''.$param.' is required.');
94
-		}
95
-	}
96
-
97
-	private function _optionalParam($param) {
98
-		/* Pass most optional params through as set value, or set to '' */
99
-		/* Don't know if we'll use this one, but let's build it in case. */
100
-		if ((isset($param)) && ($param != '')) {
101
-			return $param;
102
-		}
103
-		else {
104
-			$param = '';
105
-			return $param;
106
-		}
107
-	}
108
-
109
-	/* __________________ BBB ADMINISTRATION METHODS _________________ */
110
-	/* The methods in the following section support the following categories of the BBB API:
66
+        if (extension_loaded('curl')) {
67
+            $ch = curl_init() or die ( curl_error($ch) );
68
+            $timeout = 10;
69
+            curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
+            curl_setopt( $ch, CURLOPT_URL, $url );
71
+            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
+            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
+            $data = curl_exec( $ch );
74
+            curl_close( $ch );
75
+
76
+            if($data)
77
+                return (new SimpleXMLElement($data));
78
+            else
79
+                return false;
80
+        }
81
+        return (simplexml_load_file($url));
82
+    }
83
+
84
+    private function _requiredParam($param) {
85
+        /* Process required params and throw errors if we don't get values */
86
+        if ((isset($param)) && ($param != '')) {
87
+            return $param;
88
+        }
89
+        elseif (!isset($param)) {
90
+            throw new Exception('Missing parameter.');
91
+        }
92
+        else {
93
+            throw new Exception(''.$param.' is required.');
94
+        }
95
+    }
96
+
97
+    private function _optionalParam($param) {
98
+        /* Pass most optional params through as set value, or set to '' */
99
+        /* Don't know if we'll use this one, but let's build it in case. */
100
+        if ((isset($param)) && ($param != '')) {
101
+            return $param;
102
+        }
103
+        else {
104
+            $param = '';
105
+            return $param;
106
+        }
107
+    }
108
+
109
+    /* __________________ BBB ADMINISTRATION METHODS _________________ */
110
+    /* The methods in the following section support the following categories of the BBB API:
111 111
 	-- create
112 112
 	-- join
113 113
 	-- end
114 114
 	*/
115 115
 
116
-	public function getCreateMeetingUrl($creationParams) {
117
-		/*
116
+    public function getCreateMeetingUrl($creationParams) {
117
+        /*
118 118
 		USAGE:
119 119
 		(see $creationParams array in createMeetingArray method.)
120 120
 		*/
121
-		$this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
-		$this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
-		// Set up the basic creation URL:
124
-		$creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
-		// Add params:
126
-		$params =
127
-		'name='.urlencode($this->_meetingName).
128
-		'&meetingID='.urlencode($this->_meetingId).
129
-		'&attendeePW='.urlencode($creationParams['attendeePw']).
130
-		'&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
-		'&dialNumber='.urlencode($creationParams['dialNumber']).
132
-		'&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
-		'&webVoice='.urlencode($creationParams['webVoice']).
134
-		'&logoutURL='.urlencode($creationParams['logoutUrl']).
135
-		'&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
-		'&record='.urlencode($creationParams['record']).
137
-		'&duration='.urlencode($creationParams['duration']);
138
-		//'&meta_category='.urlencode($creationParams['meta_category']);
139
-		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
142
-		// Return the complete URL:
143
-		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
-	}
145
-
146
-	public function createMeetingWithXmlResponseArray($creationParams) {
147
-		/*
121
+        $this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
+        $this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
+        // Set up the basic creation URL:
124
+        $creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
+        // Add params:
126
+        $params =
127
+        'name='.urlencode($this->_meetingName).
128
+        '&meetingID='.urlencode($this->_meetingId).
129
+        '&attendeePW='.urlencode($creationParams['attendeePw']).
130
+        '&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
+        '&dialNumber='.urlencode($creationParams['dialNumber']).
132
+        '&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
+        '&webVoice='.urlencode($creationParams['webVoice']).
134
+        '&logoutURL='.urlencode($creationParams['logoutUrl']).
135
+        '&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
+        '&record='.urlencode($creationParams['record']).
137
+        '&duration='.urlencode($creationParams['duration']);
138
+        //'&meta_category='.urlencode($creationParams['meta_category']);
139
+        $welcomeMessage = $creationParams['welcomeMsg'];
140
+        if(trim($welcomeMessage))
141
+            $params .= '&welcome='.urlencode($welcomeMessage);
142
+        // Return the complete URL:
143
+        return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
+    }
145
+
146
+    public function createMeetingWithXmlResponseArray($creationParams) {
147
+        /*
148 148
 		USAGE:
149 149
 		$creationParams = array(
150 150
 			'name' => 'Meeting Name',	-- A name for the meeting (or username)
@@ -162,34 +162,34 @@  discard block
 block discarded – undo
162 162
 			'meta_category' => '', 		-- Use to pass additional info to BBB server. See API docs to enable.
163 163
 		);
164 164
 		*/
165
-		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
165
+        $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 166
 
167 167
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
170
-					'returncode' => $xml->returncode->__toString(),
171
-					'message' => $xml->message->__toString(),
172
-					'messageKey' => $xml->messageKey->__toString(),
173
-					'meetingId' => $xml->meetingID->__toString(),
174
-					'attendeePw' => $xml->attendeePW->__toString(),
175
-					'moderatorPw' => $xml->moderatorPW->__toString(),
176
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
-					'createTime' => $xml->createTime->__toString()
178
-					);
179
-			else
180
-				return array(
181
-					'returncode' => $xml->returncode->__toString(),
182
-					'message' => $xml->message->__toString(),
183
-					'messageKey' => $xml->messageKey->__toString()
184
-					);
185
-		}
186
-		else {
187
-			return null;
188
-		}
189
-	}
190
-
191
-	public function getJoinMeetingURL($joinParams) {
192
-		/*
168
+            if($xml->meetingID)
169
+                return array(
170
+                    'returncode' => $xml->returncode->__toString(),
171
+                    'message' => $xml->message->__toString(),
172
+                    'messageKey' => $xml->messageKey->__toString(),
173
+                    'meetingId' => $xml->meetingID->__toString(),
174
+                    'attendeePw' => $xml->attendeePW->__toString(),
175
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
176
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
+                    'createTime' => $xml->createTime->__toString()
178
+                    );
179
+            else
180
+                return array(
181
+                    'returncode' => $xml->returncode->__toString(),
182
+                    'message' => $xml->message->__toString(),
183
+                    'messageKey' => $xml->messageKey->__toString()
184
+                    );
185
+        }
186
+        else {
187
+            return null;
188
+        }
189
+    }
190
+
191
+    public function getJoinMeetingURL($joinParams) {
192
+        /*
193 193
 		NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API
194 194
 		doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL
195 195
 		that's returned from this method and simply send your users off to that URL in your code.
@@ -203,249 +203,249 @@  discard block
 block discarded – undo
203 203
 			'webVoiceConf' => ''		-- OPTIONAL - string
204 204
 		);
205 205
 		*/
206
-		$this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
-		$this->_username = $this->_requiredParam($joinParams['username']);
208
-		$this->_password = $this->_requiredParam($joinParams['password']);
209
-		// Establish the basic join URL:
210
-		$joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
-		// Add parameters to the URL:
212
-		$params =
213
-		'meetingID='.urlencode($this->_meetingId).
214
-		'&fullName='.urlencode($this->_username).
215
-		'&password='.urlencode($this->_password).
216
-		'&userID='.urlencode($joinParams['userID']).
217
-		'&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
-		// Only use createTime if we really want to use it. If it's '', then don't pass it:
219
-		if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
-			$params .= '&createTime='.urlencode($joinParams['createTime']);
221
-		}
222
-		// Return the URL:
223
-		return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
-	}
225
-
226
-	public function getEndMeetingURL($endParams) {
227
-		/* USAGE:
206
+        $this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
+        $this->_username = $this->_requiredParam($joinParams['username']);
208
+        $this->_password = $this->_requiredParam($joinParams['password']);
209
+        // Establish the basic join URL:
210
+        $joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
+        // Add parameters to the URL:
212
+        $params =
213
+        'meetingID='.urlencode($this->_meetingId).
214
+        '&fullName='.urlencode($this->_username).
215
+        '&password='.urlencode($this->_password).
216
+        '&userID='.urlencode($joinParams['userID']).
217
+        '&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
+        // Only use createTime if we really want to use it. If it's '', then don't pass it:
219
+        if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
+            $params .= '&createTime='.urlencode($joinParams['createTime']);
221
+        }
222
+        // Return the URL:
223
+        return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
+    }
225
+
226
+    public function getEndMeetingURL($endParams) {
227
+        /* USAGE:
228 228
 		$endParams = array (
229 229
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
230 230
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
231 231
 		);
232 232
 		*/
233
-		$this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
-		$this->_password = $this->_requiredParam($endParams['password']);
235
-		$endUrl = $this->_bbbServerBaseUrl."api/end?";
236
-		$params =
237
-		'meetingID='.urlencode($this->_meetingId).
238
-		'&password='.urlencode($this->_password);
239
-		return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
-	}
241
-
242
-	public function endMeetingWithXmlResponseArray($endParams) {
243
-		/* USAGE:
233
+        $this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
+        $this->_password = $this->_requiredParam($endParams['password']);
235
+        $endUrl = $this->_bbbServerBaseUrl."api/end?";
236
+        $params =
237
+        'meetingID='.urlencode($this->_meetingId).
238
+        '&password='.urlencode($this->_password);
239
+        return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
+    }
241
+
242
+    public function endMeetingWithXmlResponseArray($endParams) {
243
+        /* USAGE:
244 244
 		$endParams = array (
245 245
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
246 246
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
247 247
 		);
248 248
 		*/
249
-		$xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
-		if ($xml) {
251
-			return array(
252
-				'returncode' => $xml->returncode->__toString(),
253
-				'message' => $xml->message->__toString(),
254
-				'messageKey' => $xml->messageKey->__toString()
255
-				);
256
-		}
257
-		else {
258
-			return null;
259
-		}
260
-
261
-	}
262
-
263
-	/* __________________ BBB MONITORING METHODS _________________ */
264
-	/* The methods in the following section support the following categories of the BBB API:
249
+        $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
+        if ($xml) {
251
+            return array(
252
+                'returncode' => $xml->returncode->__toString(),
253
+                'message' => $xml->message->__toString(),
254
+                'messageKey' => $xml->messageKey->__toString()
255
+                );
256
+        }
257
+        else {
258
+            return null;
259
+        }
260
+
261
+    }
262
+
263
+    /* __________________ BBB MONITORING METHODS _________________ */
264
+    /* The methods in the following section support the following categories of the BBB API:
265 265
 	-- isMeetingRunning
266 266
 	-- getMeetings
267 267
 	-- getMeetingInfo
268 268
 	*/
269 269
 
270
-	public function getIsMeetingRunningUrl($meetingId) {
271
-		/* USAGE:
270
+    public function getIsMeetingRunningUrl($meetingId) {
271
+        /* USAGE:
272 272
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
273 273
 		*/
274
-		$this->_meetingId = $this->_requiredParam($meetingId);
275
-		$runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
-		$params =
277
-		'meetingID='.urlencode($this->_meetingId);
278
-		return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
-	}
280
-
281
-	public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
-		/* USAGE:
274
+        $this->_meetingId = $this->_requiredParam($meetingId);
275
+        $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
+        $params =
277
+        'meetingID='.urlencode($this->_meetingId);
278
+        return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
+    }
280
+
281
+    public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
+        /* USAGE:
283 283
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
284 284
 		*/
285
-		$xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
-		if($xml) {
287
-			return array(
288
-				'returncode' => $xml->returncode->__toString(),
289
-				'running' => $xml->running->__toString() 	// -- Returns true/false.
290
-			);
291
-		}
292
-		else {
293
-			return null;
294
-		}
295
-
296
-	}
297
-
298
-	public function getGetMeetingsUrl() {
299
-		/* Simply formulate the getMeetings URL
285
+        $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
+        if($xml) {
287
+            return array(
288
+                'returncode' => $xml->returncode->__toString(),
289
+                'running' => $xml->running->__toString() 	// -- Returns true/false.
290
+            );
291
+        }
292
+        else {
293
+            return null;
294
+        }
295
+
296
+    }
297
+
298
+    public function getGetMeetingsUrl() {
299
+        /* Simply formulate the getMeetings URL
300 300
 		We do this in a separate function so we have the option to just get this
301 301
 		URL and print it if we want for some reason.
302 302
 		*/
303
-		$getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
-		return $getMeetingsUrl;
305
-	}
303
+        $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
+        return $getMeetingsUrl;
305
+    }
306 306
 
307
-	public function getMeetingsWithXmlResponseArray() {
308
-		/* USAGE:
307
+    public function getMeetingsWithXmlResponseArray() {
308
+        /* USAGE:
309 309
 		We don't need to pass any parameters with this one, so we just send the query URL off to BBB
310 310
 		and then handle the results that we get in the XML response.
311 311
 		*/
312
-		$xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
-		if($xml) {
314
-			// If we don't get a success code, stop processing and return just the returncode:
315
-			if ($xml->returncode != 'SUCCESS') {
316
-				$result = array(
317
-					'returncode' => $xml->returncode->__toString()
318
-				);
319
-				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
322
-				/* No meetings on server, so return just this info: */
323
-				$result = array(
324
-					'returncode' => $xml->returncode->__toString(),
325
-					'messageKey' => $xml->messageKey->__toString(),
326
-					'message' => $xml->message->__toString()
327
-				);
328
-				return $result;
329
-			}
330
-			else {
331
-				// In this case, we have success and meetings. First return general response:
332
-				$result = array(
333
-					'returncode' => $xml->returncode->__toString(),
334
-					'messageKey' => $xml->messageKey->__toString(),
335
-					'message' => $xml->message->__toString()
336
-				);
337
-				// Then interate through meeting results and return them as part of the array:
338
-				foreach ($xml->meetings->meeting as $m) {
339
-					$result[] = array(
340
-						'meetingId' => $m->meetingID->__toString(),
341
-						'meetingName' => $m->meetingName->__toString(),
342
-						'createTime' => $m->createTime->__toString(),
343
-						'attendeePw' => $m->attendeePW->__toString(),
344
-						'moderatorPw' => $m->moderatorPW->__toString(),
345
-						'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
-						'running' => $m->running->__toString()
347
-					);
348
-				}
349
-				return $result;
350
-			}
351
-		}
352
-		else {
353
-			return null;
354
-		}
355
-
356
-	}
357
-
358
-	public function getMeetingInfoUrl($infoParams) {
359
-		/* USAGE:
312
+        $xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
+        if($xml) {
314
+            // If we don't get a success code, stop processing and return just the returncode:
315
+            if ($xml->returncode != 'SUCCESS') {
316
+                $result = array(
317
+                    'returncode' => $xml->returncode->__toString()
318
+                );
319
+                return $result;
320
+            }
321
+            elseif ($xml->messageKey == 'noMeetings') {
322
+                /* No meetings on server, so return just this info: */
323
+                $result = array(
324
+                    'returncode' => $xml->returncode->__toString(),
325
+                    'messageKey' => $xml->messageKey->__toString(),
326
+                    'message' => $xml->message->__toString()
327
+                );
328
+                return $result;
329
+            }
330
+            else {
331
+                // In this case, we have success and meetings. First return general response:
332
+                $result = array(
333
+                    'returncode' => $xml->returncode->__toString(),
334
+                    'messageKey' => $xml->messageKey->__toString(),
335
+                    'message' => $xml->message->__toString()
336
+                );
337
+                // Then interate through meeting results and return them as part of the array:
338
+                foreach ($xml->meetings->meeting as $m) {
339
+                    $result[] = array(
340
+                        'meetingId' => $m->meetingID->__toString(),
341
+                        'meetingName' => $m->meetingName->__toString(),
342
+                        'createTime' => $m->createTime->__toString(),
343
+                        'attendeePw' => $m->attendeePW->__toString(),
344
+                        'moderatorPw' => $m->moderatorPW->__toString(),
345
+                        'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
+                        'running' => $m->running->__toString()
347
+                    );
348
+                }
349
+                return $result;
350
+            }
351
+        }
352
+        else {
353
+            return null;
354
+        }
355
+
356
+    }
357
+
358
+    public function getMeetingInfoUrl($infoParams) {
359
+        /* USAGE:
360 360
 		$infoParams = array(
361 361
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
362 362
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
363 363
 		);
364 364
 		*/
365
-		$this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
-		$this->_password = $this->_requiredParam($infoParams['password']);
367
-		$infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
-		$params =
369
-		'meetingID='.urlencode($this->_meetingId).
370
-		'&password='.urlencode($this->_password);
371
-		return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
-	}
373
-
374
-	public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
-		/* USAGE:
365
+        $this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
+        $this->_password = $this->_requiredParam($infoParams['password']);
367
+        $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
+        $params =
369
+        'meetingID='.urlencode($this->_meetingId).
370
+        '&password='.urlencode($this->_password);
371
+        return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
+    }
373
+
374
+    public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
+        /* USAGE:
376 376
 		$infoParams = array(
377 377
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
378 378
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
379 379
 		);
380 380
 		*/
381
-		$xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
-		if($xml) {
383
-			// If we don't get a success code or messageKey, find out why:
384
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
-				$result = array(
386
-					'returncode' => $xml->returncode->__toString(),
387
-					'messageKey' => $xml->messageKey->__toString(),
388
-					'message' => $xml->message->__toString()
389
-				);
390
-				return $result;
391
-			}
392
-			else {
393
-				// In this case, we have success and meeting info:
394
-				$result = array(
395
-					'returncode' => $xml->returncode->__toString(),
396
-					'meetingName' => $xml->meetingName->__toString(),
397
-					'meetingId' => $xml->meetingID->__toString(),
398
-					'createTime' => $xml->createTime->__toString(),
399
-					'voiceBridge' => $xml->voiceBridge->__toString(),
400
-					'attendeePw' => $xml->attendeePW->__toString(),
401
-					'moderatorPw' => $xml->moderatorPW->__toString(),
402
-					'running' => $xml->running->__toString(),
403
-					'recording' => $xml->recording->__toString(),
404
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
-					'startTime' => $xml->startTime->__toString(),
406
-					'endTime' => $xml->endTime->__toString(),
407
-					'participantCount' => $xml->participantCount->__toString(),
408
-					'maxUsers' => $xml->maxUsers->__toString(),
409
-					'moderatorCount' => $xml->moderatorCount->__toString(),
410
-				);
411
-				// Then interate through attendee results and return them as part of the array:
412
-				foreach ($xml->attendees->attendee as $a) {
413
-					$result[] = array(
414
-						'userId' => $a->userID->__toString(),
415
-						'fullName' => $a->fullName->__toString(),
416
-						'role' => $a->role->__toString()
417
-					);
418
-				}
419
-				return $result;
420
-			}
421
-		}
422
-		else {
423
-			return null;
424
-		}
425
-
426
-	}
427
-
428
-	/* __________________ BBB RECORDING METHODS _________________ */
429
-	/* The methods in the following section support the following categories of the BBB API:
381
+        $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
+        if($xml) {
383
+            // If we don't get a success code or messageKey, find out why:
384
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
+                $result = array(
386
+                    'returncode' => $xml->returncode->__toString(),
387
+                    'messageKey' => $xml->messageKey->__toString(),
388
+                    'message' => $xml->message->__toString()
389
+                );
390
+                return $result;
391
+            }
392
+            else {
393
+                // In this case, we have success and meeting info:
394
+                $result = array(
395
+                    'returncode' => $xml->returncode->__toString(),
396
+                    'meetingName' => $xml->meetingName->__toString(),
397
+                    'meetingId' => $xml->meetingID->__toString(),
398
+                    'createTime' => $xml->createTime->__toString(),
399
+                    'voiceBridge' => $xml->voiceBridge->__toString(),
400
+                    'attendeePw' => $xml->attendeePW->__toString(),
401
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
402
+                    'running' => $xml->running->__toString(),
403
+                    'recording' => $xml->recording->__toString(),
404
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
+                    'startTime' => $xml->startTime->__toString(),
406
+                    'endTime' => $xml->endTime->__toString(),
407
+                    'participantCount' => $xml->participantCount->__toString(),
408
+                    'maxUsers' => $xml->maxUsers->__toString(),
409
+                    'moderatorCount' => $xml->moderatorCount->__toString(),
410
+                );
411
+                // Then interate through attendee results and return them as part of the array:
412
+                foreach ($xml->attendees->attendee as $a) {
413
+                    $result[] = array(
414
+                        'userId' => $a->userID->__toString(),
415
+                        'fullName' => $a->fullName->__toString(),
416
+                        'role' => $a->role->__toString()
417
+                    );
418
+                }
419
+                return $result;
420
+            }
421
+        }
422
+        else {
423
+            return null;
424
+        }
425
+
426
+    }
427
+
428
+    /* __________________ BBB RECORDING METHODS _________________ */
429
+    /* The methods in the following section support the following categories of the BBB API:
430 430
 	-- getRecordings
431 431
 	-- publishRecordings
432 432
 	-- deleteRecordings
433 433
 	*/
434 434
 
435
-	public function getRecordingsUrl($recordingParams) {
436
-		/* USAGE:
435
+    public function getRecordingsUrl($recordingParams) {
436
+        /* USAGE:
437 437
 		$recordingParams = array(
438 438
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
439 439
 		);
440 440
 		*/
441
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
-		$params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
-		return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
441
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
+        $params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
+        return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
444 444
 
445
-	}
445
+    }
446 446
 
447
-	public function getRecordingsWithXmlResponseArray($recordingParams) {
448
-		/* USAGE:
447
+    public function getRecordingsWithXmlResponseArray($recordingParams) {
448
+        /* USAGE:
449 449
 		$recordingParams = array(
450 450
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
451 451
 		);
@@ -453,121 +453,121 @@  discard block
 block discarded – undo
453 453
 		when creating a meeting, it will kick users out after the duration. Should
454 454
 		probably be required in user code when 'recording' is set to true.
455 455
 		*/
456
-		$xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
-		if($xml) {
458
-			// If we don't get a success code or messageKey, find out why:
459
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
-				$result = array(
461
-					'returncode' => $xml->returncode->__toString(),
462
-					'messageKey' => $xml->messageKey->__toString(),
463
-					'message' => $xml->message->__toString()
464
-				);
465
-				return $result;
466
-			}
467
-			else {
468
-				// In this case, we have success and recording info:
469
-				$result = array(
470
-					'returncode' => $xml->returncode->__toString(),
471
-					'messageKey' => $xml->messageKey->__toString(),
472
-					'message' => $xml->message->__toString()
473
-				);
474
-
475
-				foreach ($xml->recordings->recording as $r) {
476
-					$result[] = array(
477
-						'recordId' => $r->recordID->__toString(),
478
-						'meetingId' => $r->meetingID->__toString(),
479
-						'name' => $r->name->__toString(),
480
-						'published' => $r->published->__toString(),
481
-						'startTime' => $r->startTime->__toString(),
482
-						'endTime' => $r->endTime->__toString(),
483
-						'playbackFormatType' => $r->playback->format->type->__toString(),
484
-						'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
-						'playbackFormatLength' => $r->playback->format->length->__toString(),
486
-						'metadataTitle' => $r->metadata->title->__toString(),
487
-						'metadataSubject' => $r->metadata->subject->__toString(),
488
-						'metadataDescription' => $r->metadata->description->__toString(),
489
-						'metadataCreator' => $r->metadata->creator->__toString(),
490
-						'metadataContributor' => $r->metadata->contributor->__toString(),
491
-						'metadataLanguage' => $r->metadata->language->__toString(),
492
-						// Add more here as needed for your app depending on your
493
-						// use of metadata when creating recordings.
494
-						);
495
-					}
496
-				return $result;
497
-			}
498
-		}
499
-		else {
500
-			return null;
501
-		}
502
-	}
503
-
504
-	public function getPublishRecordingsUrl($recordingParams) {
505
-		/* USAGE:
456
+        $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
+        if($xml) {
458
+            // If we don't get a success code or messageKey, find out why:
459
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
+                $result = array(
461
+                    'returncode' => $xml->returncode->__toString(),
462
+                    'messageKey' => $xml->messageKey->__toString(),
463
+                    'message' => $xml->message->__toString()
464
+                );
465
+                return $result;
466
+            }
467
+            else {
468
+                // In this case, we have success and recording info:
469
+                $result = array(
470
+                    'returncode' => $xml->returncode->__toString(),
471
+                    'messageKey' => $xml->messageKey->__toString(),
472
+                    'message' => $xml->message->__toString()
473
+                );
474
+
475
+                foreach ($xml->recordings->recording as $r) {
476
+                    $result[] = array(
477
+                        'recordId' => $r->recordID->__toString(),
478
+                        'meetingId' => $r->meetingID->__toString(),
479
+                        'name' => $r->name->__toString(),
480
+                        'published' => $r->published->__toString(),
481
+                        'startTime' => $r->startTime->__toString(),
482
+                        'endTime' => $r->endTime->__toString(),
483
+                        'playbackFormatType' => $r->playback->format->type->__toString(),
484
+                        'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
+                        'playbackFormatLength' => $r->playback->format->length->__toString(),
486
+                        'metadataTitle' => $r->metadata->title->__toString(),
487
+                        'metadataSubject' => $r->metadata->subject->__toString(),
488
+                        'metadataDescription' => $r->metadata->description->__toString(),
489
+                        'metadataCreator' => $r->metadata->creator->__toString(),
490
+                        'metadataContributor' => $r->metadata->contributor->__toString(),
491
+                        'metadataLanguage' => $r->metadata->language->__toString(),
492
+                        // Add more here as needed for your app depending on your
493
+                        // use of metadata when creating recordings.
494
+                        );
495
+                    }
496
+                return $result;
497
+            }
498
+        }
499
+        else {
500
+            return null;
501
+        }
502
+    }
503
+
504
+    public function getPublishRecordingsUrl($recordingParams) {
505
+        /* USAGE:
506 506
 		$recordingParams = array(
507 507
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
508 508
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
509 509
 		);
510 510
 		*/
511
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
-		$params =
513
-		'recordID='.urlencode($recordingParams['recordId']).
514
-		'&publish='.urlencode($recordingParams['publish']);
515
-		return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
511
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
+        $params =
513
+        'recordID='.urlencode($recordingParams['recordId']).
514
+        '&publish='.urlencode($recordingParams['publish']);
515
+        return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
516 516
 
517
-	}
517
+    }
518 518
 
519
-	public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
-		/* USAGE:
519
+    public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
+        /* USAGE:
521 521
 		$recordingParams = array(
522 522
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
523 523
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
524 524
 		);
525 525
 		*/
526
-		$xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
-		if($xml) {
528
-			return array(
529
-				'returncode' => $xml->returncode->__toString(),
530
-				'published' => $xml->published->__toString() 	// -- Returns true/false.
531
-			);
532
-		}
533
-		else {
534
-			return null;
535
-		}
536
-
537
-
538
-	}
539
-
540
-	public function getDeleteRecordingsUrl($recordingParams) {
541
-		/* USAGE:
526
+        $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
+        if($xml) {
528
+            return array(
529
+                'returncode' => $xml->returncode->__toString(),
530
+                'published' => $xml->published->__toString() 	// -- Returns true/false.
531
+            );
532
+        }
533
+        else {
534
+            return null;
535
+        }
536
+
537
+
538
+    }
539
+
540
+    public function getDeleteRecordingsUrl($recordingParams) {
541
+        /* USAGE:
542 542
 		$recordingParams = array(
543 543
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
544 544
 		);
545 545
 		*/
546
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
-		$params =
548
-		'recordID='.urlencode($recordingParams['recordId']);
549
-		return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
-	}
551
-
552
-	public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
-		/* USAGE:
546
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
+        $params =
548
+        'recordID='.urlencode($recordingParams['recordId']);
549
+        return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
+    }
551
+
552
+    public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
+        /* USAGE:
554 554
 		$recordingParams = array(
555 555
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
556 556
 		);
557 557
 		*/
558 558
 
559
-		$xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
-		if($xml) {
561
-			return array(
562
-				'returncode' => $xml->returncode->__toString(),
563
-				'deleted' => $xml->deleted->__toString() 	// -- Returns true/false.
564
-			);
565
-		}
566
-		else {
567
-			return null;
568
-		}
569
-
570
-	}
559
+        $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
+        if($xml) {
561
+            return array(
562
+                'returncode' => $xml->returncode->__toString(),
563
+                'deleted' => $xml->deleted->__toString() 	// -- Returns true/false.
564
+            );
565
+        }
566
+        else {
567
+            return null;
568
+        }
569
+
570
+    }
571 571
 
572 572
 
573 573
 
Please login to merge, or discard this patch.