Subversion Repositories php-qbpwcf

Rev

Rev 3 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 92... Line 92...
92
 
92
 
93
		#回傳結果
93
		#回傳結果
94
		return $result;
94
		return $result;
95
 
95
 
96
		}#function __callStatic end
96
		}#function __callStatic end
97
	
97
 
98
	/*
98
	/*
99
	#函式說明:
99
	#函式說明:
100
	#計算checksum
100
	#計算checksum
101
	#回傳結果:
101
	#回傳結果:
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 177... Line 177...
177
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
177
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
178
		unset($conf["variableCheck::checkArguments"]);
178
		unset($conf["variableCheck::checkArguments"]);
179
 
179
 
180
		#若執行失敗
180
		#若執行失敗
181
		if($checkArguments["status"]==="false"){
181
		if($checkArguments["status"]==="false"){
182
		
182
 
183
			#設置執行失敗
183
			#設置執行失敗
184
			$result["status"]="false";
184
			$result["status"]="false";
185
		
185
 
186
			#設置錯誤訊息
186
			#設置錯誤訊息
187
			$result["error"]=$checkArguments;
187
			$result["error"]=$checkArguments;
188
		
188
 
189
			#函式說明:
189
			#函式說明:
190
			#隱藏元素中可能含有機密的內容.
190
			#隱藏元素中可能含有機密的內容.
191
			#回傳結果:
191
			#回傳結果:
192
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
192
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
193
			#$result["content"],變數的解析結果.
193
			#$result["content"],變數的解析結果.
Line 205... Line 205...
205
			#無.
205
			#無.
206
			#備註:
206
			#備註:
207
			#目前不支援物件.
207
			#目前不支援物件.
208
			$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
208
			$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
209
			unset($conf["variableCheck::hideParams"]);
209
			unset($conf["variableCheck::hideParams"]);
210
		
210
 
211
			#若執行失敗
211
			#若執行失敗
212
			if($hideParams["status"]==="false"){
212
			if($hideParams["status"]==="false"){
213
			
213
 
214
				#設置執行失敗
214
				#設置執行失敗
215
				$result["status"]="false";
215
				$result["status"]="false";
216
			
216
 
217
				#設置錯誤訊息
217
				#設置錯誤訊息
218
				$result["error"]=$hideParams;
218
				$result["error"]=$hideParams;
219
				
219
 
220
				#回傳結果
220
				#回傳結果
221
				return $result;
221
				return $result;
222
				
222
 
223
				}#if end
223
				}#if end
224
		
224
 
225
			#取得隱藏後的結果
225
			#取得隱藏後的結果
226
			$reuslt["error"]=$hideParams["content"];
226
			$reuslt["error"]=$hideParams["content"];
227
		
227
 
228
			#回傳內容
228
			#回傳內容
229
			return $reuslt;
229
			return $reuslt;
230
		
230
 
231
			}#if end
231
			}#if end
232
 
232
 
233
		#設置回傳內容
233
		#設置回傳內容
234
		$result["content"]=sha1($conf["input"].$conf["SharedSecret"]);
234
		$result["content"]=sha1($conf["input"].$conf["SharedSecret"]);
235
 
235
 
Line 252... Line 252...
252
		#無.
252
		#無.
253
		#備註:
253
		#備註:
254
		#目前不支援物件.
254
		#目前不支援物件.
255
		$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
255
		$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
256
		unset($conf["variableCheck::hideParams"]);
256
		unset($conf["variableCheck::hideParams"]);
257
	
257
 
258
		#若執行失敗
258
		#若執行失敗
259
		if($hideParams["status"]==="false"){
259
		if($hideParams["status"]==="false"){
260
		
260
 
261
			#設置執行失敗
261
			#設置執行失敗
262
			$result["status"]="false";
262
			$result["status"]="false";
263
		
263
 
264
			#設置錯誤訊息
264
			#設置錯誤訊息
265
			$result["error"]=$hideParams;
265
			$result["error"]=$hideParams;
266
			
266
 
267
			#回傳結果
267
			#回傳結果
268
			return $result;
268
			return $result;
269
			
269
 
270
			}#if end
270
			}#if end
271
				
271
 
272
		#取得隱藏後的結果
272
		#取得隱藏後的結果
273
		$result=$hideParams["content"];
273
		$result=$hideParams["content"];
274
 
274
 
275
		#設置執行正常
275
		#設置執行正常
276
		$result["status"]="true";
276
		$result["status"]="true";
277
 
277
 
278
		#回傳結果
278
		#回傳結果
279
		return $result;
279
		return $result;
280
 
280
 
281
		}#functino getCheckSum end
281
		}#functino getCheckSum end
282
	
282
 
283
	/*
283
	/*
284
	#函式說明:
284
	#函式說明:
285
	#取得會議室清單
285
	#取得會議室清單
286
	#回傳結果:
286
	#回傳結果:
287
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
287
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 305... Line 305...
305
	*/
305
	*/
306
	public static function listRooms(&$conf){
306
	public static function listRooms(&$conf){
307
 
307
 
308
		#取得當前執行的函式
308
		#取得當前執行的函式
309
		$result["function"]=__FUNCTION__;
309
		$result["function"]=__FUNCTION__;
310
	
310
 
311
		#取得使用的參數
311
		#取得使用的參數
312
		$result["argu"]=$conf;
312
		$result["argu"]=$conf;
313
 
313
 
314
		#函式說明:
314
		#函式說明:
315
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
315
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
Line 363... Line 363...
363
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
363
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
364
		unset($conf["variableCheck::checkArguments"]);
364
		unset($conf["variableCheck::checkArguments"]);
365
 
365
 
366
		#若執行失敗
366
		#若執行失敗
367
		if($checkArguments["status"]==="false"){
367
		if($checkArguments["status"]==="false"){
368
		
368
 
369
			#設置執行失敗
369
			#設置執行失敗
370
			$result["status"]="false";
370
			$result["status"]="false";
371
		
371
 
372
			#設置錯誤訊息
372
			#設置錯誤訊息
373
			$result["error"]=$checkArguments;
373
			$result["error"]=$checkArguments;
374
		
374
 
375
			#函式說明:
375
			#函式說明:
376
			#隱藏元素中可能含有機密的內容.
376
			#隱藏元素中可能含有機密的內容.
377
			#回傳結果:
377
			#回傳結果:
378
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
378
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
379
			#$result["content"],變數的解析結果.
379
			#$result["content"],變數的解析結果.
Line 391... Line 391...
391
			#無.
391
			#無.
392
			#備註:
392
			#備註:
393
			#目前不支援物件.
393
			#目前不支援物件.
394
			$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
394
			$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
395
			unset($conf["variableCheck::hideParams"]);
395
			unset($conf["variableCheck::hideParams"]);
396
		
396
 
397
			#若執行失敗
397
			#若執行失敗
398
			if($hideParams["status"]==="false"){
398
			if($hideParams["status"]==="false"){
399
			
399
 
400
				#設置執行失敗
400
				#設置執行失敗
401
				$result["status"]="false";
401
				$result["status"]="false";
402
			
402
 
403
				#設置錯誤訊息
403
				#設置錯誤訊息
404
				$result["error"]=$hideParams;
404
				$result["error"]=$hideParams;
405
				
405
 
406
				#回傳結果
406
				#回傳結果
407
				return $result;
407
				return $result;
408
				
408
 
409
				}#if end
409
				}#if end
410
		
410
 
411
			#取得隱藏後的結果
411
			#取得隱藏後的結果
412
			$reuslt["error"]=$hideParams["content"];
412
			$reuslt["error"]=$hideParams["content"];
413
		
413
 
414
			#回傳內容
414
			#回傳內容
415
			return $reuslt;
415
			return $reuslt;
416
		
416
 
417
			}#if end
417
			}#if end
418
	
418
 
419
		#base url
419
		#base url
420
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
420
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
421
		
421
 
422
		#api name
422
		#api name
423
		$apiName="getMeetings";
423
		$apiName="getMeetings";
424
		
424
 
425
		#參數為空
425
		#參數為空
426
		$getParams="";
426
		$getParams="";
427
		
427
 
428
		#目標網址的開頭
428
		#目標網址的開頭
429
		$headUrl=$baseUrl.$apiName.$getParams;
429
		$headUrl=$baseUrl.$apiName.$getParams;
430
				
430
 
431
		#函式說明:
431
		#函式說明:
432
		#計算checksum
432
		#計算checksum
433
		#回傳結果:
433
		#回傳結果:
434
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
434
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
435
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
435
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 464... Line 464...
464
		#取得checksum
464
		#取得checksum
465
		$checkSum=$getCheckSum["content"];
465
		$checkSum=$getCheckSum["content"];
466
 
466
 
467
		#取得目標url
467
		#取得目標url
468
		$targetUrl=$headUrl."?checksum=".$checkSum;
468
		$targetUrl=$headUrl."?checksum=".$checkSum;
469
		
469
 
470
		#函式說明:
470
		#函式說明:
471
		#運行curl cmd
471
		#運行curl cmd
472
		#回傳結果:
472
		#回傳結果:
473
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
473
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
474
		#$result["error"],錯誤訊息陣列.
474
		#$result["error"],錯誤訊息陣列.
Line 504... Line 504...
504
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
504
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
505
		unset($conf["catchWebContent::curlCmd"]);
505
		unset($conf["catchWebContent::curlCmd"]);
506
 
506
 
507
		#如果執行失敗
507
		#如果執行失敗
508
		if($curlCmd["status"]==="false"){
508
		if($curlCmd["status"]==="false"){
509
		
509
 
510
			#設置執行不正常
510
			#設置執行不正常
511
			$result["status"]="false";
511
			$result["status"]="false";
512
 
512
 
513
			#設置執行錯誤
513
			#設置執行錯誤
514
			$result["error"]=$curlCmd;
514
			$result["error"]=$curlCmd;
515
 
515
 
516
			#回傳結果
516
			#回傳結果
517
			return $result;
517
			return $result;
518
		
518
 
519
			}#if end
519
			}#if end
520
 
520
 
521
		#如果回應為 error
521
		#如果回應為 error
522
		if($curlCmd["content"][0]="Error"){
522
		if($curlCmd["content"][0]="Error"){
523
		
523
 
524
			#設置執行不正常
524
			#設置執行不正常
525
			$result	["status"]="false";
525
			$result	["status"]="false";
526
 
526
 
527
			#設置執行錯誤
527
			#設置執行錯誤
528
			$result["error"]=$curlCmd;
528
			$result["error"]=$curlCmd;
529
 
529
 
530
			#回傳結果
530
			#回傳結果
531
			return $result;
531
			return $result;
532
		
532
 
533
			}#if end
533
			}#if end
534
 
534
 
535
		#取得回應的內容
535
		#取得回應的內容
536
		$result["content"]=$curlCmd["content"];
536
		$result["content"]=$curlCmd["content"];
537
 
537
 
538
		#設置執行正常
538
		#設置執行正常
539
		$result["status"]="true";
539
		$result["status"]="true";
540
		
540
 
541
		#回傳結果
541
		#回傳結果
542
		return $result;
542
		return $result;
543
 
543
 
544
		}#function listRooms end
544
		}#function listRooms end
545
	
545
 
546
	/*
546
	/*
547
	#函式說明:
547
	#函式說明:
548
	#建立會議室清單
548
	#建立會議室清單
549
	#回傳結果:
549
	#回傳結果:
550
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
550
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 584... Line 584...
584
	#https://docs.bigbluebutton.org/dev/api.html#getmeetings
584
	#https://docs.bigbluebutton.org/dev/api.html#getmeetings
585
	#備註:
585
	#備註:
586
	#無.
586
	#無.
587
	*/
587
	*/
588
	public static function createRoom(&$conf){
588
	public static function createRoom(&$conf){
589
	
589
 
590
		#初始化要回傳的結果
590
		#初始化要回傳的結果
591
		$result=array();
591
		$result=array();
592
 
592
 
593
		#取得當前執行的函數名稱
593
		#取得當前執行的函數名稱
594
		$result["function"]=__FUNCTION__;
594
		$result["function"]=__FUNCTION__;
Line 690... Line 690...
690
 
690
 
691
			#回傳結果
691
			#回傳結果
692
			return $result;
692
			return $result;
693
 
693
 
694
			}#if end
694
			}#if end
695
			
695
 
696
		#base url
696
		#base url
697
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
697
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
698
		
698
 
699
		#api name
699
		#api name
700
		$apiName="create";
700
		$apiName="create";
701
		
701
 
702
		#建立 $meetingID
702
		#建立 $meetingID
703
		#涵式說明:
703
		#涵式說明:
704
		#呼叫shell執行系統命令,並取得回傳的內容.
704
		#呼叫shell執行系統命令,並取得回傳的內容.
705
		#回傳的結果:
705
		#回傳的結果:
706
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
706
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 750... Line 750...
750
		#參考資料:
750
		#參考資料:
751
		#exec=>http://php.net/manual/en/function.exec.php
751
		#exec=>http://php.net/manual/en/function.exec.php
752
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
752
		#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
753
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
753
		#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
754
		$callShell=external::callShell($conf["external::callShell"]);
754
		$callShell=external::callShell($conf["external::callShell"]);
755
		unset($conf["external::callShell"]);		
755
		unset($conf["external::callShell"]);
756
		
756
 
757
		#如果執行失敗
757
		#如果執行失敗
758
		if($callShell["status"]==="false"){
758
		if($callShell["status"]==="false"){
759
		
759
 
760
			#設置執行不正常
760
			#設置執行不正常
761
			$result	["status"]="false";
761
			$result	["status"]="false";
762
 
762
 
763
			#設置執行錯誤
763
			#設置執行錯誤
764
			$result["error"]=$callShell;
764
			$result["error"]=$callShell;
765
 
765
 
766
			#回傳結果
766
			#回傳結果
767
			return $result;
767
			return $result;
768
		
768
 
769
			}#if end
769
			}#if end
770
 
770
 
771
		#取得meeting id
771
		#取得meeting id
772
		$meetingID=$callShell["output"][0];
772
		$meetingID=$callShell["output"][0];
773
		
773
 
774
		#參數為空
774
		#參數為空
775
		$getParams="allowStartStopRecording=true&autoStartRecording=".$conf["autoStartRecording"]."&meetingID=".$meetingID."&name=".urlencode($conf["meetingName"])."&record=true&attendeePW=".$conf["attendeePW"]."&moderatorPW=".$conf["moderatorPW"];
775
		$getParams="allowStartStopRecording=true&autoStartRecording=".$conf["autoStartRecording"]."&meetingID=".$meetingID."&name=".urlencode($conf["meetingName"])."&record=true&attendeePW=".$conf["attendeePW"]."&moderatorPW=".$conf["moderatorPW"];
776
		
776
 
777
		#目標網址的開頭
777
		#目標網址的開頭
778
		$headUrl=$baseUrl.$apiName."?".$getParams;
778
		$headUrl=$baseUrl.$apiName."?".$getParams;
779
				
779
 
780
		#函式說明:
780
		#函式說明:
781
		#計算checksum
781
		#計算checksum
782
		#回傳結果:
782
		#回傳結果:
783
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
783
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
784
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
784
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 796... Line 796...
796
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
796
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
797
		unset($conf["bigbluebutton::getCheckSum"]);
797
		unset($conf["bigbluebutton::getCheckSum"]);
798
 
798
 
799
		#如果執行失敗
799
		#如果執行失敗
800
		if($getCheckSum["status"]==="false"){
800
		if($getCheckSum["status"]==="false"){
801
		
801
 
802
			#設置執行不正常
802
			#設置執行不正常
803
			$result["status"]="false";
803
			$result["status"]="false";
804
 
804
 
805
			#設置執行錯誤
805
			#設置執行錯誤
806
			$result["error"]=$getCheckSum;
806
			$result["error"]=$getCheckSum;
807
 
807
 
808
			#回傳結果
808
			#回傳結果
809
			return $result;
809
			return $result;
810
		
810
 
811
			}#if end
811
			}#if end
812
 
812
 
813
		#取得checksum
813
		#取得checksum
814
		$checkSum=$getCheckSum["content"];
814
		$checkSum=$getCheckSum["content"];
815
 
815
 
816
		#取得目標url
816
		#取得目標url
817
		$targetUrl=$headUrl."&checksum=".$checkSum;
817
		$targetUrl=$headUrl."&checksum=".$checkSum;
818
		
818
 
819
		#函式說明:
819
		#函式說明:
820
		#運行curl cmd
820
		#運行curl cmd
821
		#回傳結果:
821
		#回傳結果:
822
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
822
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
823
		#$result["error"],錯誤訊息陣列.
823
		#$result["error"],錯誤訊息陣列.
Line 853... Line 853...
853
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
853
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
854
		unset($conf["catchWebContent::curlCmd"]);
854
		unset($conf["catchWebContent::curlCmd"]);
855
 
855
 
856
		#如果執行失敗
856
		#如果執行失敗
857
		if($curlCmd["status"]==="false"){
857
		if($curlCmd["status"]==="false"){
858
		
858
 
859
			#設置執行不正常
859
			#設置執行不正常
860
			$result["status"]="false";
860
			$result["status"]="false";
861
 
861
 
862
			#設置執行錯誤
862
			#設置執行錯誤
863
			$result["error"]=$curlCmd;
863
			$result["error"]=$curlCmd;
864
 
864
 
865
			#回傳結果
865
			#回傳結果
866
			return $result;
866
			return $result;
867
		
867
 
868
			}#if end
868
			}#if end
869
 
869
 
870
		#xml字串
870
		#xml字串
871
		$xmlStr="";
871
		$xmlStr="";
872
 
872
 
873
		#如果有xml內容
873
		#如果有xml內容
874
		if(count($curlCmd["content"])>1){
874
		if(count($curlCmd["content"])>1){
875
		
875
 
876
			#針對每行輸出
876
			#針對每行輸出
877
			for($i=0;$i<count($curlCmd["content"]);$i++){
877
			for($i=0;$i<count($curlCmd["content"]);$i++){
878
			
878
 
879
				#傳接xml內容
879
				#傳接xml內容
880
				$xmlStr=$xmlStr.$curlCmd["content"][$i];
880
				$xmlStr=$xmlStr.$curlCmd["content"][$i];
881
			
881
 
882
				}#for end
882
				}#for end
883
				
883
 
884
			}#if end
884
			}#if end
885
 
885
 
886
		#涵式說明:
886
		#涵式說明:
887
		#解析xml字串.
887
		#解析xml字串.
888
		#回傳結果:
888
		#回傳結果:
Line 901... Line 901...
901
		$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
901
		$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
902
		unset($conf["xml::parseXMLstring"]);
902
		unset($conf["xml::parseXMLstring"]);
903
 
903
 
904
		#如果解析失敗
904
		#如果解析失敗
905
		if($parseXMLstring["status"]==="false"){
905
		if($parseXMLstring["status"]==="false"){
906
		
906
 
907
			#設置執行不正常
907
			#設置執行不正常
908
			$result["status"]="false";
908
			$result["status"]="false";
909
 
909
 
910
			#設置執行錯誤
910
			#設置執行錯誤
911
			$result["error"]=$parseXMLstring;
911
			$result["error"]=$parseXMLstring;
912
 
912
 
913
			#回傳結果
913
			#回傳結果
914
			return $result;
914
			return $result;
915
		
915
 
916
			}#if end
916
			}#if end
917
	
917
 
918
		#取得xml物件的內容
918
		#取得xml物件的內容
919
		$result["content"]=$parseXMLstring["content"];
919
		$result["content"]=$parseXMLstring["content"];
920
 
920
 
921
		#取得回應的內容
921
		#取得回應的內容
922
		$result["xml"]=$parseXMLstring["xmlStr"];
922
		$result["xml"]=$parseXMLstring["xmlStr"];
923
 
923
 
924
		#如果有 returncode
924
		#如果有 returncode
925
		if(isset($result["content"]->returncode)){
925
		if(isset($result["content"]->returncode)){
926
		
926
 
927
			#取得回應
927
			#取得回應
928
			$res=(array)$result["content"]->returncode;
928
			$res=(array)$result["content"]->returncode;
929
		
929
 
930
			#設置其數值內容
930
			#設置其數值內容
931
			$result["res"]["returncode"]=$res[0];
931
			$result["res"]["returncode"]=$res[0];
932
		
932
 
933
			}#if end
933
			}#if end
934
			
934
 
935
		#如果有 meetingID
935
		#如果有 meetingID
936
		if(isset($result["content"]->meetingID)){
936
		if(isset($result["content"]->meetingID)){
937
		
937
 
938
			#取得回應
938
			#取得回應
939
			$res=(array)$result["content"]->meetingID;
939
			$res=(array)$result["content"]->meetingID;
940
		
940
 
941
			#設置其數值內容
941
			#設置其數值內容
942
			$result["res"]["meetingID"]=$res[0];
942
			$result["res"]["meetingID"]=$res[0];
943
		
943
 
944
			}#if end
944
			}#if end
945
		
945
 
946
		#如果有 parentMeetingID
946
		#如果有 parentMeetingID
947
		if(isset($result["content"]->parentMeetingID)){
947
		if(isset($result["content"]->parentMeetingID)){
948
		
948
 
949
			#取得回應
949
			#取得回應
950
			$res=(array)$result["content"]->parentMeetingID;
950
			$res=(array)$result["content"]->parentMeetingID;
951
			
951
 
952
			#設置其數值內容
952
			#設置其數值內容
953
			$result["res"]["parentMeetingID"]=$res[0];
953
			$result["res"]["parentMeetingID"]=$res[0];
954
		
954
 
955
			}#if end
955
			}#if end
956
			
956
 
957
		#如果有 attendeePW
957
		#如果有 attendeePW
958
		if(isset($result["content"]->attendeePW)){
958
		if(isset($result["content"]->attendeePW)){
959
		
959
 
960
			#取得回應
960
			#取得回應
961
			$res=(array)$result["content"]->attendeePW;
961
			$res=(array)$result["content"]->attendeePW;
962
		
962
 
963
			#設置其數值內容
963
			#設置其數值內容
964
			$result["res"]["attendeePW"]=$res[0];
964
			$result["res"]["attendeePW"]=$res[0];
965
		
965
 
966
			}#if end
966
			}#if end
967
 
967
 
968
		#如果有 moderatorPW
968
		#如果有 moderatorPW
969
		if(isset($result["content"]->moderatorPW)){
969
		if(isset($result["content"]->moderatorPW)){
970
		
970
 
971
			#取得回應
971
			#取得回應
972
			$res=(array)$result["content"]->moderatorPW;
972
			$res=(array)$result["content"]->moderatorPW;
973
		
973
 
974
			#設置其數值內容
974
			#設置其數值內容
975
			$result["res"]["moderatorPW"]=$res[0];
975
			$result["res"]["moderatorPW"]=$res[0];
976
		
976
 
977
			}#if end
977
			}#if end
978
			
978
 
979
		#如果有 createTime
979
		#如果有 createTime
980
		if(isset($result["content"]->createTime)){
980
		if(isset($result["content"]->createTime)){
981
		
981
 
982
			#取得回應
982
			#取得回應
983
			$res=(array)$result["content"]->createTime;
983
			$res=(array)$result["content"]->createTime;
984
		
984
 
985
			#設置其數值內容
985
			#設置其數值內容
986
			$result["res"]["createTime"]=$res[0];
986
			$result["res"]["createTime"]=$res[0];
987
		
987
 
988
			}#if end
988
			}#if end
989
			
989
 
990
		#如果有 voiceBridge
990
		#如果有 voiceBridge
991
		if(isset($result["content"]->voiceBridge)){
991
		if(isset($result["content"]->voiceBridge)){
992
		
992
 
993
			#取得回應
993
			#取得回應
994
			$res=(array)$result["content"]->voiceBridge;
994
			$res=(array)$result["content"]->voiceBridge;
995
		
995
 
996
			#設置其數值內容
996
			#設置其數值內容
997
			$result["res"]["voiceBridge"]=$res[0];
997
			$result["res"]["voiceBridge"]=$res[0];
998
		
998
 
999
			}#if end
999
			}#if end
1000
			
1000
 
1001
		#如果有 dialNumber
1001
		#如果有 dialNumber
1002
		if(isset($result["content"]->dialNumber)){
1002
		if(isset($result["content"]->dialNumber)){
1003
		
1003
 
1004
			#取得回應
1004
			#取得回應
1005
			$res=(array)$result["content"]->dialNumber;
1005
			$res=(array)$result["content"]->dialNumber;
1006
		
1006
 
1007
			#設置其數值內容
1007
			#設置其數值內容
1008
			$result["res"]["dialNumber"]=$res[0];
1008
			$result["res"]["dialNumber"]=$res[0];
1009
		
1009
 
1010
			}#if end
1010
			}#if end
1011
 
1011
 
1012
		#如果有 hasUserJoined
1012
		#如果有 hasUserJoined
1013
		if(isset($result["content"]->hasUserJoined)){
1013
		if(isset($result["content"]->hasUserJoined)){
1014
		
1014
 
1015
			#取得回應
1015
			#取得回應
1016
			$res=(array)$result["content"]->hasUserJoined;
1016
			$res=(array)$result["content"]->hasUserJoined;
1017
		
1017
 
1018
			#設置其數值內容
1018
			#設置其數值內容
1019
			$result["res"]["hasUserJoined"]=$res[0];
1019
			$result["res"]["hasUserJoined"]=$res[0];
1020
		
1020
 
1021
			}#if end
1021
			}#if end
1022
			
1022
 
1023
		#如果有 duration
1023
		#如果有 duration
1024
		if(isset($result["content"]->duration)){
1024
		if(isset($result["content"]->duration)){
1025
		
1025
 
1026
			#取得回應
1026
			#取得回應
1027
			$res=(array)$result["content"]->duration;
1027
			$res=(array)$result["content"]->duration;
1028
		
1028
 
1029
			#設置其數值內容
1029
			#設置其數值內容
1030
			$result["res"]["duration"]=$res[0];
1030
			$result["res"]["duration"]=$res[0];
1031
		
1031
 
1032
			}#if end
1032
			}#if end
1033
			
1033
 
1034
		#如果有 hasBeenForciblyEnded
1034
		#如果有 hasBeenForciblyEnded
1035
		if(isset($result["content"]->hasBeenForciblyEnded)){
1035
		if(isset($result["content"]->hasBeenForciblyEnded)){
1036
		
1036
 
1037
			#取得回應
1037
			#取得回應
1038
			$res=(array)$result["content"]->hasBeenForciblyEnded;
1038
			$res=(array)$result["content"]->hasBeenForciblyEnded;
1039
		
1039
 
1040
			#設置其數值內容
1040
			#設置其數值內容
1041
			$result["res"]["hasBeenForciblyEnded"]=$res[0];
1041
			$result["res"]["hasBeenForciblyEnded"]=$res[0];
1042
		
1042
 
1043
			}#if end
1043
			}#if end
1044
			
1044
 
1045
		#設置執行正常
1045
		#設置執行正常
1046
		$result["status"]="true";
1046
		$result["status"]="true";
1047
		
1047
 
1048
		#回傳結果
1048
		#回傳結果
1049
		return $result;
1049
		return $result;
1050
	
1050
 
1051
		}#function createRoom end
1051
		}#function createRoom end
1052
	
1052
 
1053
	/*
1053
	/*
1054
	#函式說明:
1054
	#函式說明:
1055
	#提供加入會議室的網址.
1055
	#提供加入會議室的網址.
1056
	#回傳結果:
1056
	#回傳結果:
1057
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1057
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 1077... Line 1077...
1077
	#https://docs.bigbluebutton.org/dev/api.html#join
1077
	#https://docs.bigbluebutton.org/dev/api.html#join
1078
	#備註:
1078
	#備註:
1079
	#無.
1079
	#無.
1080
	*/
1080
	*/
1081
	public static function enterRoom(&$conf){
1081
	public static function enterRoom(&$conf){
1082
	
1082
 
1083
		#初始化要回傳的結果
1083
		#初始化要回傳的結果
1084
		$result=array();
1084
		$result=array();
1085
 
1085
 
1086
		#取得當前執行的函數名稱
1086
		#取得當前執行的函數名稱
1087
		$result["function"]=__FUNCTION__;
1087
		$result["function"]=__FUNCTION__;
Line 1183... Line 1183...
1183
 
1183
 
1184
			#回傳結果
1184
			#回傳結果
1185
			return $result;
1185
			return $result;
1186
 
1186
 
1187
			}#if end
1187
			}#if end
1188
			
1188
 
1189
		#base url
1189
		#base url
1190
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
1190
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
1191
		
1191
 
1192
		#api name
1192
		#api name
1193
		$apiName="join";
1193
		$apiName="join";
1194
		
1194
 
1195
		#參數為空
1195
		#參數為空
1196
		$getParams="fullName=".$conf["name"]."&meetingID=".$conf["meetingID"]."&password=".$conf["password"];
1196
		$getParams="fullName=".$conf["name"]."&meetingID=".$conf["meetingID"]."&password=".$conf["password"];
1197
		
1197
 
1198
		#目標網址的開頭
1198
		#目標網址的開頭
1199
		$headUrl=$baseUrl.$apiName."?".$getParams;
1199
		$headUrl=$baseUrl.$apiName."?".$getParams;
1200
				
1200
 
1201
		#函式說明:
1201
		#函式說明:
1202
		#計算checksum
1202
		#計算checksum
1203
		#回傳結果:
1203
		#回傳結果:
1204
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1204
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1205
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
1205
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 1217... Line 1217...
1217
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
1217
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
1218
		unset($conf["bigbluebutton::getCheckSum"]);
1218
		unset($conf["bigbluebutton::getCheckSum"]);
1219
 
1219
 
1220
		#如果執行失敗
1220
		#如果執行失敗
1221
		if($getCheckSum["status"]==="false"){
1221
		if($getCheckSum["status"]==="false"){
1222
		
1222
 
1223
			#設置執行不正常
1223
			#設置執行不正常
1224
			$result	["status"]="false";
1224
			$result	["status"]="false";
1225
 
1225
 
1226
			#設置執行錯誤
1226
			#設置執行錯誤
1227
			$result["error"]=$getCheckSum;
1227
			$result["error"]=$getCheckSum;
1228
 
1228
 
1229
			#回傳結果
1229
			#回傳結果
1230
			return $result;
1230
			return $result;
1231
		
1231
 
1232
			}#if end
1232
			}#if end
1233
 
1233
 
1234
		#取得checksum
1234
		#取得checksum
1235
		$checkSum=$getCheckSum["content"];
1235
		$checkSum=$getCheckSum["content"];
1236
 
1236
 
1237
		#取得目標url
1237
		#取得目標url
1238
		$targetUrl=$headUrl."&checksum=".$checkSum;
1238
		$targetUrl=$headUrl."&checksum=".$checkSum;
1239
		
1239
 
1240
		#記錄進入會議室的網址
1240
		#記錄進入會議室的網址
1241
		$result["content"]=$targetUrl;
1241
		$result["content"]=$targetUrl;
1242
		
1242
 
1243
		#設置執行正常
1243
		#設置執行正常
1244
		$result["status"]="true";
1244
		$result["status"]="true";
1245
		
1245
 
1246
		#回傳結果
1246
		#回傳結果
1247
		return $result;
1247
		return $result;
1248
			
1248
 
1249
		}#functino enterRoom end
1249
		}#functino enterRoom end
1250
		
1250
 
1251
	/*
1251
	/*
1252
	#函式說明:
1252
	#函式說明:
1253
	#取得會議室的錄影資料
1253
	#取得會議室的錄影資料
1254
	#回傳結果:
1254
	#回傳結果:
1255
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1255
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 1274... Line 1274...
1274
	#https://docs.bigbluebutton.org/dev/api.html#getrecordings
1274
	#https://docs.bigbluebutton.org/dev/api.html#getrecordings
1275
	#備註:
1275
	#備註:
1276
	#建構中.
1276
	#建構中.
1277
	*/
1277
	*/
1278
	public static function getRecord(&$conf){
1278
	public static function getRecord(&$conf){
1279
			
1279
 
1280
		#初始化要回傳的結果
1280
		#初始化要回傳的結果
1281
		$result=array();
1281
		$result=array();
1282
 
1282
 
1283
		#取得當前執行的函數名稱
1283
		#取得當前執行的函數名稱
1284
		$result["function"]=__FUNCTION__;
1284
		$result["function"]=__FUNCTION__;
Line 1380... Line 1380...
1380
 
1380
 
1381
			#回傳結果
1381
			#回傳結果
1382
			return $result;
1382
			return $result;
1383
 
1383
 
1384
			}#if end
1384
			}#if end
1385
			
1385
 
1386
		#base url
1386
		#base url
1387
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
1387
		$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
1388
		
1388
 
1389
		#api name
1389
		#api name
1390
		$apiName="getRecordings";
1390
		$apiName="getRecordings";
1391
		
1391
 
1392
		#參數為空
1392
		#參數為空
1393
		$getParamsArray=array();
1393
		$getParamsArray=array();
1394
		
1394
 
1395
		#如果有設定 $conf["meetingID"]
1395
		#如果有設定 $conf["meetingID"]
1396
		if(isset($conf["meetingID"])){
1396
		if(isset($conf["meetingID"])){
1397
		
1397
 
1398
			#設定參數
1398
			#設定參數
1399
			$getParamsArray["meetingID"]=$conf["meetingID"];
1399
			$getParamsArray["meetingID"]=$conf["meetingID"];
1400
		
1400
 
1401
			}#if end
1401
			}#if end
1402
			
1402
 
1403
		#如果有設定  recordID
1403
		#如果有設定  recordID
1404
		if(isset($conf["recordID"])){
1404
		if(isset($conf["recordID"])){
1405
		
1405
 
1406
			#設定參數
1406
			#設定參數
1407
			$getParamsArray["recordID"]=$conf["recordID"];
1407
			$getParamsArray["recordID"]=$conf["recordID"];
1408
		
1408
 
1409
			}#if end
1409
			}#if end
1410
		
1410
 
1411
		#to get query string
1411
		#to get query string
1412
		$getParams=http_build_query($getParamsArray);
1412
		$getParams=http_build_query($getParamsArray);
1413
		
1413
 
1414
		#目標網址的開頭
1414
		#目標網址的開頭
1415
		$headUrl=$baseUrl.$apiName."?".$getParams;
1415
		$headUrl=$baseUrl.$apiName."?".$getParams;
1416
				
1416
 
1417
		#函式說明:
1417
		#函式說明:
1418
		#計算checksum
1418
		#計算checksum
1419
		#回傳結果:
1419
		#回傳結果:
1420
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1420
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1421
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
1421
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 1433... Line 1433...
1433
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
1433
		$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
1434
		unset($conf["bigbluebutton::getCheckSum"]);
1434
		unset($conf["bigbluebutton::getCheckSum"]);
1435
 
1435
 
1436
		#如果執行失敗
1436
		#如果執行失敗
1437
		if($getCheckSum["status"]==="false"){
1437
		if($getCheckSum["status"]==="false"){
1438
		
1438
 
1439
			#設置執行不正常
1439
			#設置執行不正常
1440
			$result	["status"]="false";
1440
			$result	["status"]="false";
1441
 
1441
 
1442
			#設置執行錯誤
1442
			#設置執行錯誤
1443
			$result["error"]=$getCheckSum;
1443
			$result["error"]=$getCheckSum;
1444
 
1444
 
1445
			#回傳結果
1445
			#回傳結果
1446
			return $result;
1446
			return $result;
1447
		
1447
 
1448
			}#if end
1448
			}#if end
1449
 
1449
 
1450
		#取得checksum
1450
		#取得checksum
1451
		$getParamsArray["checksum"]=$getCheckSum["content"];
1451
		$getParamsArray["checksum"]=$getCheckSum["content"];
1452
 
1452
 
1453
		#to get query string
1453
		#to get query string
1454
		$getParams=http_build_query($getParamsArray);
1454
		$getParams=http_build_query($getParamsArray);
1455
		
1455
 
1456
		#目標網址的開頭
1456
		#目標網址的開頭
1457
		$targetUrl=$baseUrl.$apiName."?".$getParams;
1457
		$targetUrl=$baseUrl.$apiName."?".$getParams;
1458
 
1458
 
1459
		#要求的網址
1459
		#要求的網址
1460
		$result["requestUrl"]=$targetUrl;
1460
		$result["requestUrl"]=$targetUrl;
1461
		
1461
 
1462
		#函式說明:
1462
		#函式說明:
1463
		#運行curl cmd
1463
		#運行curl cmd
1464
		#回傳結果:
1464
		#回傳結果:
1465
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1465
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1466
		#$result["error"],錯誤訊息陣列.
1466
		#$result["error"],錯誤訊息陣列.
Line 1496... Line 1496...
1496
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
1496
		$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
1497
		unset($conf["catchWebContent::curlCmd"]);
1497
		unset($conf["catchWebContent::curlCmd"]);
1498
 
1498
 
1499
		#如果執行失敗
1499
		#如果執行失敗
1500
		if($curlCmd["status"]==="false"){
1500
		if($curlCmd["status"]==="false"){
1501
		
1501
 
1502
			#設置執行不正常
1502
			#設置執行不正常
1503
			$result	["status"]="false";
1503
			$result	["status"]="false";
1504
 
1504
 
1505
			#設置執行錯誤
1505
			#設置執行錯誤
1506
			$result["error"]=$curlCmd;
1506
			$result["error"]=$curlCmd;
1507
 
1507
 
1508
			#回傳結果
1508
			#回傳結果
1509
			return $result;
1509
			return $result;
1510
		
1510
 
1511
			}#if end
1511
			}#if end
1512
 
1512
 
1513
		#xml字串
1513
		#xml字串
1514
		$xmlStr="";
1514
		$xmlStr="";
1515
 
1515
 
1516
		#如果有xml內容
1516
		#如果有xml內容
1517
		if(count($curlCmd["content"])>1){
1517
		if(count($curlCmd["content"])>1){
1518
		
1518
 
1519
			#針對每行輸出
1519
			#針對每行輸出
1520
			for($i=0;$i<count($curlCmd["content"]);$i++){
1520
			for($i=0;$i<count($curlCmd["content"]);$i++){
1521
			
1521
 
1522
				#傳接xml內容
1522
				#傳接xml內容
1523
				$xmlStr=$xmlStr.$curlCmd["content"][$i];
1523
				$xmlStr=$xmlStr.$curlCmd["content"][$i];
1524
			
1524
 
1525
				}#for end
1525
				}#for end
1526
				
1526
 
1527
			}#if end
1527
			}#if end
1528
 
1528
 
1529
		#涵式說明:
1529
		#涵式說明:
1530
		#解析xml字串.
1530
		#解析xml字串.
1531
		#回傳結果:
1531
		#回傳結果:
Line 1544... Line 1544...
1544
		$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
1544
		$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
1545
		unset($conf["xml::parseXMLstring"]);
1545
		unset($conf["xml::parseXMLstring"]);
1546
 
1546
 
1547
		#如果解析失敗
1547
		#如果解析失敗
1548
		if($parseXMLstring["status"]==="false"){
1548
		if($parseXMLstring["status"]==="false"){
1549
		
1549
 
1550
			#設置執行不正常
1550
			#設置執行不正常
1551
			$result["status"]="false";
1551
			$result["status"]="false";
1552
 
1552
 
1553
			#設置執行錯誤
1553
			#設置執行錯誤
1554
			$result["error"]=$parseXMLstring;
1554
			$result["error"]=$parseXMLstring;
1555
 
1555
 
1556
			#回傳結果
1556
			#回傳結果
1557
			return $result;
1557
			return $result;
1558
		
1558
 
1559
			}#if end
1559
			}#if end
1560
	
1560
 
1561
		#取得xml物件的內容
1561
		#取得xml物件的內容
1562
		$result["content"]=$parseXMLstring["content"];
1562
		$result["content"]=$parseXMLstring["content"];
1563
 
1563
 
1564
		#取得回應的xml格式內容
1564
		#取得回應的xml格式內容
1565
		$result["xml"]=$parseXMLstring["xmlStr"];
1565
		$result["xml"]=$parseXMLstring["xmlStr"];
1566
 
1566
 
1567
		#設置執行正常
1567
		#設置執行正常
1568
		$result["status"]="true";
1568
		$result["status"]="true";
1569
		
1569
 
1570
		#回傳結果
1570
		#回傳結果
1571
		return $result;
1571
		return $result;
1572
	
1572
 
1573
		}#function getRecord end
1573
		}#function getRecord end
1574
 
1574
 
1575
	}#class bigbluebutton end
1575
	}#class bigbluebutton end
1576
 
1576
 
1577
?>
1577
?>