| 3 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
|
|
|
5 |
QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
| 239 |
liveuser |
6 |
Copyright (C) 2014~2026 MIN ZHI, CHEN
|
| 3 |
liveuser |
7 |
|
|
|
8 |
This file is part of QBPWCF.
|
|
|
9 |
|
|
|
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
|
|
|
12 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
13 |
(at your option) any later version.
|
|
|
14 |
|
|
|
15 |
QBPWCF is distributed in the hope that it will be useful,
|
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
18 |
GNU General Public License for more details.
|
|
|
19 |
|
|
|
20 |
You should have received a copy of the GNU General Public License
|
|
|
21 |
along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22 |
|
|
|
23 |
*/
|
|
|
24 |
namespace qbpwcf;
|
|
|
25 |
|
|
|
26 |
/*
|
|
|
27 |
類別說明:
|
|
|
28 |
提供bigbluebutton應用的類別.
|
|
|
29 |
備註:
|
|
|
30 |
無.
|
|
|
31 |
*/
|
|
|
32 |
class bigbluebutton{
|
|
|
33 |
|
|
|
34 |
/*
|
|
|
35 |
#函式說明:
|
|
|
36 |
#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
|
|
|
37 |
#回傳結果:
|
|
|
38 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
39 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
40 |
#$result["function"],當前執行的函式名稱.
|
|
|
41 |
#必填參數:
|
|
|
42 |
#$method,物件,為物件實體或類別名稱,會自動置入該參數.
|
|
|
43 |
#$arguments,陣列,為呼叫方法時所用的參數.
|
|
|
44 |
#參考資料:
|
|
|
45 |
#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
|
|
|
46 |
*/
|
|
|
47 |
public function __call($method,$arguments){
|
|
|
48 |
|
|
|
49 |
#取得當前執行的函式
|
|
|
50 |
$result["function"]=__FUNCTION__;
|
|
|
51 |
|
|
|
52 |
#設置執行不正常
|
|
|
53 |
$result["status"]="false";
|
|
|
54 |
|
|
|
55 |
#設置執行錯誤
|
|
|
56 |
$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
|
|
|
57 |
|
|
|
58 |
#設置所丟入的參數
|
|
|
59 |
$result["error"][]=$arguments;
|
|
|
60 |
|
|
|
61 |
#回傳結果
|
|
|
62 |
return $result;
|
|
|
63 |
|
|
|
64 |
}#function __call end
|
|
|
65 |
|
|
|
66 |
/*
|
|
|
67 |
#函式說明:
|
|
|
68 |
#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
|
|
|
69 |
#回傳結果:
|
|
|
70 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
71 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
72 |
#$result["function"],當前執行的函式名稱.
|
|
|
73 |
#必填參數:
|
|
|
74 |
#$method,物件,為物件實體或類別名稱,會自動置入該參數.
|
|
|
75 |
#$arguments,陣列,為呼叫方法時所用的參數.
|
|
|
76 |
#參考資料:
|
|
|
77 |
#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
|
|
|
78 |
*/
|
|
|
79 |
public static function __callStatic($method,$arguments){
|
|
|
80 |
|
|
|
81 |
#取得當前執行的函式
|
|
|
82 |
$result["function"]=__FUNCTION__;
|
|
|
83 |
|
|
|
84 |
#設置執行不正常
|
|
|
85 |
$result["status"]="false";
|
|
|
86 |
|
|
|
87 |
#設置執行錯誤
|
|
|
88 |
$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
|
|
|
89 |
|
|
|
90 |
#設置所丟入的參數
|
|
|
91 |
$result["error"][]=$arguments;
|
|
|
92 |
|
|
|
93 |
#回傳結果
|
|
|
94 |
return $result;
|
|
|
95 |
|
|
|
96 |
}#function __callStatic end
|
| 226 |
liveuser |
97 |
|
| 3 |
liveuser |
98 |
/*
|
|
|
99 |
#函式說明:
|
|
|
100 |
#計算checksum
|
|
|
101 |
#回傳結果:
|
|
|
102 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
103 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
104 |
#$result["function"],當前執行的函式名稱.
|
|
|
105 |
#$result["argu"],使用的參數.
|
|
|
106 |
#$result["content"],內容.
|
|
|
107 |
#必填參數:
|
|
|
108 |
#$conf["input"],字串,要計算checksum的內容.
|
|
|
109 |
$conf["input"]="";
|
|
|
110 |
#$conf["SharedSecret"],字串,SharedSecret.
|
|
|
111 |
$conf["SharedSecret"]="";
|
|
|
112 |
#可省略參數:
|
|
|
113 |
#$conf["hideSecret"],字串,預設為"true",代表要隱藏使用的 SharedSecret 參數內容;"false"代表不用隱藏.
|
|
|
114 |
#$conf["hideSecret"]="false";
|
|
|
115 |
#參考資料:
|
|
|
116 |
#無.
|
|
|
117 |
#備註:
|
|
|
118 |
#無.
|
|
|
119 |
*/
|
|
|
120 |
public static function getCheckSum(&$conf){
|
|
|
121 |
|
|
|
122 |
#取得當前執行的函式
|
|
|
123 |
$result["function"]=__FUNCTION__;
|
|
|
124 |
|
|
|
125 |
#取得使用的參數
|
|
|
126 |
$result["argu"]=$conf;
|
|
|
127 |
|
|
|
128 |
#函式說明:
|
|
|
129 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
|
|
|
130 |
#回傳結果:
|
|
|
131 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
132 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
133 |
#$result["function"],當前執行的函式名稱.
|
|
|
134 |
#$result["argu"],設置給予的參數.
|
|
|
135 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
136 |
#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
137 |
#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
138 |
#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
139 |
#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
|
|
|
140 |
#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
|
|
|
141 |
#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
|
|
|
142 |
#$result["notNeedVar"],字串陣列,多餘的參數名稱.
|
|
|
143 |
#必填參數:
|
|
|
144 |
#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
145 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
146 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
147 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
148 |
#可省略參數:
|
|
|
149 |
#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
150 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("input","SharedSecret");
|
|
|
151 |
#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
|
|
|
152 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
|
|
|
153 |
#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
|
|
|
154 |
$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
155 |
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
|
|
|
156 |
#$conf["canNotBeEmpty"]=array();
|
|
|
157 |
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
|
|
|
158 |
#$conf["canBeEmpty"]=array();
|
|
|
159 |
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
|
|
|
160 |
$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("hideSecret");
|
|
|
161 |
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
162 |
$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("hideSecret");
|
|
|
163 |
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
|
|
164 |
$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
|
|
|
165 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
166 |
$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
|
|
|
167 |
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
|
|
|
168 |
#$conf["disallowAllSkipableVarIsEmpty"]="";
|
|
|
169 |
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
|
|
|
170 |
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
|
|
|
171 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
172 |
#$conf["arrayCountEqualCheck"][]=array();
|
|
|
173 |
#參考資料:
|
|
|
174 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
|
|
175 |
#備註:
|
|
|
176 |
#無.
|
|
|
177 |
$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
178 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
179 |
|
|
|
180 |
#若執行失敗
|
|
|
181 |
if($checkArguments["status"]==="false"){
|
| 226 |
liveuser |
182 |
|
| 3 |
liveuser |
183 |
#設置執行失敗
|
|
|
184 |
$result["status"]="false";
|
| 226 |
liveuser |
185 |
|
| 3 |
liveuser |
186 |
#設置錯誤訊息
|
|
|
187 |
$result["error"]=$checkArguments;
|
| 226 |
liveuser |
188 |
|
| 3 |
liveuser |
189 |
#函式說明:
|
|
|
190 |
#隱藏元素中可能含有機密的內容.
|
|
|
191 |
#回傳結果:
|
|
|
192 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
193 |
#$result["content"],變數的解析結果.
|
|
|
194 |
#$result["function"],當前執行的函數
|
|
|
195 |
#$result["error"],涵式錯誤訊息陣列
|
|
|
196 |
#必填參數:
|
|
|
197 |
#$conf["params"],陣列,要處理的變數.
|
|
|
198 |
$conf["variableCheck::hideParams"]["params"]=$result["error"];
|
|
|
199 |
#可省略參數:
|
|
|
200 |
#$conf["keyWords"],字串陣列,針對params中每一個的key,若擁有該陣列中任一元素的數值(關鍵字),則要將其內容隱藏,預設為array("password","key","secret").
|
|
|
201 |
#$conf["keyWords"]=array("password","key","secret");
|
|
|
202 |
#$conf["changeTo"],字串,將要隱藏的參數內容置換為什麼字串內容,預設為"[classified content]".
|
|
|
203 |
#$conf["changeTo"]="[classified content]";
|
|
|
204 |
#參考資料:
|
|
|
205 |
#無.
|
|
|
206 |
#備註:
|
|
|
207 |
#目前不支援物件.
|
|
|
208 |
$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
|
|
|
209 |
unset($conf["variableCheck::hideParams"]);
|
| 226 |
liveuser |
210 |
|
| 3 |
liveuser |
211 |
#若執行失敗
|
|
|
212 |
if($hideParams["status"]==="false"){
|
| 226 |
liveuser |
213 |
|
| 3 |
liveuser |
214 |
#設置執行失敗
|
|
|
215 |
$result["status"]="false";
|
| 226 |
liveuser |
216 |
|
| 3 |
liveuser |
217 |
#設置錯誤訊息
|
|
|
218 |
$result["error"]=$hideParams;
|
| 226 |
liveuser |
219 |
|
| 3 |
liveuser |
220 |
#回傳結果
|
|
|
221 |
return $result;
|
| 226 |
liveuser |
222 |
|
| 3 |
liveuser |
223 |
}#if end
|
| 226 |
liveuser |
224 |
|
| 3 |
liveuser |
225 |
#取得隱藏後的結果
|
|
|
226 |
$reuslt["error"]=$hideParams["content"];
|
| 226 |
liveuser |
227 |
|
| 3 |
liveuser |
228 |
#回傳內容
|
|
|
229 |
return $reuslt;
|
| 226 |
liveuser |
230 |
|
| 3 |
liveuser |
231 |
}#if end
|
|
|
232 |
|
|
|
233 |
#設置回傳內容
|
|
|
234 |
$result["content"]=sha1($conf["input"].$conf["SharedSecret"]);
|
|
|
235 |
|
|
|
236 |
#函式說明:
|
|
|
237 |
#隱藏元素中可能含有機密的內容.
|
|
|
238 |
#回傳結果:
|
|
|
239 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
240 |
#$result["content"],變數的解析結果.
|
|
|
241 |
#$result["function"],當前執行的函數
|
|
|
242 |
#$result["error"],涵式錯誤訊息陣列
|
|
|
243 |
#必填參數:
|
|
|
244 |
#$conf["params"],陣列,要處理的變數.
|
|
|
245 |
$conf["variableCheck::hideParams"]["params"]=$result;
|
|
|
246 |
#可省略參數:
|
|
|
247 |
#$conf["keyWords"],字串陣列,針對params中每一個的key,若擁有該陣列中任一元素的數值(關鍵字),則要將其內容隱藏,預設為array("password","key","secret").
|
|
|
248 |
#$conf["keyWords"]=array("password","key","secret");
|
|
|
249 |
#$conf["changeTo"],字串,將要隱藏的參數內容置換為什麼字串內容,預設為"[classified content]".
|
|
|
250 |
#$conf["changeTo"]="[classified content]";
|
|
|
251 |
#參考資料:
|
|
|
252 |
#無.
|
|
|
253 |
#備註:
|
|
|
254 |
#目前不支援物件.
|
|
|
255 |
$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
|
|
|
256 |
unset($conf["variableCheck::hideParams"]);
|
| 226 |
liveuser |
257 |
|
| 3 |
liveuser |
258 |
#若執行失敗
|
|
|
259 |
if($hideParams["status"]==="false"){
|
| 226 |
liveuser |
260 |
|
| 3 |
liveuser |
261 |
#設置執行失敗
|
|
|
262 |
$result["status"]="false";
|
| 226 |
liveuser |
263 |
|
| 3 |
liveuser |
264 |
#設置錯誤訊息
|
|
|
265 |
$result["error"]=$hideParams;
|
| 226 |
liveuser |
266 |
|
| 3 |
liveuser |
267 |
#回傳結果
|
|
|
268 |
return $result;
|
| 226 |
liveuser |
269 |
|
| 3 |
liveuser |
270 |
}#if end
|
| 226 |
liveuser |
271 |
|
| 3 |
liveuser |
272 |
#取得隱藏後的結果
|
|
|
273 |
$result=$hideParams["content"];
|
|
|
274 |
|
|
|
275 |
#設置執行正常
|
|
|
276 |
$result["status"]="true";
|
|
|
277 |
|
|
|
278 |
#回傳結果
|
|
|
279 |
return $result;
|
|
|
280 |
|
|
|
281 |
}#functino getCheckSum end
|
| 226 |
liveuser |
282 |
|
| 3 |
liveuser |
283 |
/*
|
|
|
284 |
#函式說明:
|
|
|
285 |
#取得會議室清單
|
|
|
286 |
#回傳結果:
|
|
|
287 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
288 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
289 |
#$result["function"],當前執行的函式名稱.
|
|
|
290 |
#$result["content"],內容.
|
|
|
291 |
#必填參數:
|
|
|
292 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
293 |
$conf["fileArgu"]=__FILE__;
|
|
|
294 |
#$conf["bbbUrl"],字串,提供bbb服務的主機名稱.
|
|
|
295 |
$conf["bbbUrl"]="";
|
|
|
296 |
#$conf["SharedSecret"],字串,SharedSecret.
|
|
|
297 |
$conf["SharedSecret"]="";
|
|
|
298 |
#可省略參數:
|
|
|
299 |
#無.
|
|
|
300 |
#參考資料
|
|
|
301 |
#https://docs.bigbluebutton.org/dev/api.html#usage
|
|
|
302 |
#https://docs.bigbluebutton.org/dev/api.html#getmeetings
|
|
|
303 |
#備註:
|
|
|
304 |
#無.
|
|
|
305 |
*/
|
|
|
306 |
public static function listRooms(&$conf){
|
|
|
307 |
|
|
|
308 |
#取得當前執行的函式
|
|
|
309 |
$result["function"]=__FUNCTION__;
|
| 226 |
liveuser |
310 |
|
| 3 |
liveuser |
311 |
#取得使用的參數
|
|
|
312 |
$result["argu"]=$conf;
|
|
|
313 |
|
|
|
314 |
#函式說明:
|
|
|
315 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
|
|
|
316 |
#回傳結果:
|
|
|
317 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
318 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
319 |
#$result["function"],當前執行的函式名稱.
|
|
|
320 |
#$result["argu"],設置給予的參數.
|
|
|
321 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
322 |
#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
323 |
#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
324 |
#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
325 |
#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
|
|
|
326 |
#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
|
|
|
327 |
#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
|
|
|
328 |
#$result["notNeedVar"],字串陣列,多餘的參數名稱.
|
|
|
329 |
#必填參數:
|
|
|
330 |
#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
331 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
332 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
333 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
334 |
#可省略參數:
|
|
|
335 |
#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
336 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","bbbUrl","SharedSecret");
|
|
|
337 |
#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null代表不指定變數形態.
|
|
|
338 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");
|
|
|
339 |
#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
|
|
|
340 |
$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
341 |
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
|
|
|
342 |
#$conf["canNotBeEmpty"]=array();
|
|
|
343 |
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
|
|
|
344 |
#$conf["canBeEmpty"]=array();
|
|
|
345 |
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
|
|
|
346 |
#$conf["variableCheck::checkArguments"]["skipableVariableCanNotBeEmpty"]=array("hideSecret");
|
|
|
347 |
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
348 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("hideSecret");
|
|
|
349 |
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
|
|
350 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
|
|
|
351 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
352 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
|
|
|
353 |
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
|
|
|
354 |
#$conf["disallowAllSkipableVarIsEmpty"]="";
|
|
|
355 |
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
|
|
|
356 |
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
|
|
|
357 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
358 |
#$conf["arrayCountEqualCheck"][]=array();
|
|
|
359 |
#參考資料:
|
|
|
360 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
|
|
361 |
#備註:
|
|
|
362 |
#無.
|
|
|
363 |
$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
364 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
365 |
|
|
|
366 |
#若執行失敗
|
|
|
367 |
if($checkArguments["status"]==="false"){
|
| 226 |
liveuser |
368 |
|
| 3 |
liveuser |
369 |
#設置執行失敗
|
|
|
370 |
$result["status"]="false";
|
| 226 |
liveuser |
371 |
|
| 3 |
liveuser |
372 |
#設置錯誤訊息
|
|
|
373 |
$result["error"]=$checkArguments;
|
| 226 |
liveuser |
374 |
|
| 3 |
liveuser |
375 |
#函式說明:
|
|
|
376 |
#隱藏元素中可能含有機密的內容.
|
|
|
377 |
#回傳結果:
|
|
|
378 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
379 |
#$result["content"],變數的解析結果.
|
|
|
380 |
#$result["function"],當前執行的函數
|
|
|
381 |
#$result["error"],涵式錯誤訊息陣列
|
|
|
382 |
#必填參數:
|
|
|
383 |
#$conf["params"],陣列,要處理的變數.
|
|
|
384 |
$conf["variableCheck::hideParams"]["params"]=$result["error"];
|
|
|
385 |
#可省略參數:
|
|
|
386 |
#$conf["keyWords"],字串陣列,針對params中每一個的key,若擁有該陣列中任一元素的數值(關鍵字),則要將其內容隱藏,預設為array("password","key","secret").
|
|
|
387 |
#$conf["keyWords"]=array("password","key","secret");
|
|
|
388 |
#$conf["changeTo"],字串,將要隱藏的參數內容置換為什麼字串內容,預設為"[classified content]".
|
|
|
389 |
#$conf["changeTo"]="[classified content]";
|
|
|
390 |
#參考資料:
|
|
|
391 |
#無.
|
|
|
392 |
#備註:
|
|
|
393 |
#目前不支援物件.
|
|
|
394 |
$hideParams=variableCheck::hideParams($conf["variableCheck::hideParams"]);
|
|
|
395 |
unset($conf["variableCheck::hideParams"]);
|
| 226 |
liveuser |
396 |
|
| 3 |
liveuser |
397 |
#若執行失敗
|
|
|
398 |
if($hideParams["status"]==="false"){
|
| 226 |
liveuser |
399 |
|
| 3 |
liveuser |
400 |
#設置執行失敗
|
|
|
401 |
$result["status"]="false";
|
| 226 |
liveuser |
402 |
|
| 3 |
liveuser |
403 |
#設置錯誤訊息
|
|
|
404 |
$result["error"]=$hideParams;
|
| 226 |
liveuser |
405 |
|
| 3 |
liveuser |
406 |
#回傳結果
|
|
|
407 |
return $result;
|
| 226 |
liveuser |
408 |
|
| 3 |
liveuser |
409 |
}#if end
|
| 226 |
liveuser |
410 |
|
| 3 |
liveuser |
411 |
#取得隱藏後的結果
|
|
|
412 |
$reuslt["error"]=$hideParams["content"];
|
| 226 |
liveuser |
413 |
|
| 3 |
liveuser |
414 |
#回傳內容
|
|
|
415 |
return $reuslt;
|
| 226 |
liveuser |
416 |
|
| 3 |
liveuser |
417 |
}#if end
|
| 226 |
liveuser |
418 |
|
| 3 |
liveuser |
419 |
#base url
|
|
|
420 |
$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
|
| 226 |
liveuser |
421 |
|
| 3 |
liveuser |
422 |
#api name
|
|
|
423 |
$apiName="getMeetings";
|
| 226 |
liveuser |
424 |
|
| 3 |
liveuser |
425 |
#參數為空
|
|
|
426 |
$getParams="";
|
| 226 |
liveuser |
427 |
|
| 3 |
liveuser |
428 |
#目標網址的開頭
|
|
|
429 |
$headUrl=$baseUrl.$apiName.$getParams;
|
| 226 |
liveuser |
430 |
|
| 3 |
liveuser |
431 |
#函式說明:
|
|
|
432 |
#計算checksum
|
|
|
433 |
#回傳結果:
|
|
|
434 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
435 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
436 |
#$result["function"],當前執行的函式名稱.
|
|
|
437 |
#$result["content"],內容.
|
|
|
438 |
#必填參數:
|
|
|
439 |
#$conf["input"],字串,要計算checksum的內容.
|
|
|
440 |
$conf["bigbluebutton::getCheckSum"]["input"]=$apiName.$getParams;
|
|
|
441 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
442 |
$conf["bigbluebutton::getCheckSum"]["SharedSecret"]=$conf["SharedSecret"];
|
|
|
443 |
#可省略參數:
|
|
|
444 |
#無.
|
|
|
445 |
#備註:
|
|
|
446 |
#建構中...
|
|
|
447 |
$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
|
|
|
448 |
unset($conf["bigbluebutton::getCheckSum"]);
|
|
|
449 |
|
|
|
450 |
#如果執行失敗
|
|
|
451 |
if($getCheckSum["status"]==="false"){
|
|
|
452 |
|
|
|
453 |
#設置執行不正常
|
|
|
454 |
$result ["status"]="false";
|
|
|
455 |
|
|
|
456 |
#設置執行錯誤
|
|
|
457 |
$result["error"]=$getCheckSum;
|
|
|
458 |
|
|
|
459 |
#回傳結果
|
|
|
460 |
return $result;
|
|
|
461 |
|
|
|
462 |
}#if end
|
|
|
463 |
|
|
|
464 |
#取得checksum
|
|
|
465 |
$checkSum=$getCheckSum["content"];
|
|
|
466 |
|
|
|
467 |
#取得目標url
|
|
|
468 |
$targetUrl=$headUrl."?checksum=".$checkSum;
|
| 226 |
liveuser |
469 |
|
| 3 |
liveuser |
470 |
#函式說明:
|
|
|
471 |
#運行curl cmd
|
|
|
472 |
#回傳結果:
|
|
|
473 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
474 |
#$result["error"],錯誤訊息陣列.
|
|
|
475 |
#$result["function"],當前執行的函式名稱.
|
|
|
476 |
#$result["content"],取得的回應內容.
|
|
|
477 |
#$result["cookie"],cookie檔案的位置與名稱.
|
|
|
478 |
#$result["cmd"],執行的command.
|
|
|
479 |
#$result["argu],使用的參數.
|
|
|
480 |
#必填參數:
|
|
|
481 |
#$conf["url"],字串,目標url.
|
|
|
482 |
$conf["catchWebContent::curlCmd"]["url"]=$targetUrl;
|
|
|
483 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
484 |
$conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
|
|
|
485 |
#可省略參數:
|
|
|
486 |
#$conf["header"],字串陣列,要傳送的header.
|
|
|
487 |
#$conf["header"]=array();
|
|
|
488 |
#$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
|
|
|
489 |
#$conf["allowAnySSLcertificate"]="";
|
|
|
490 |
#$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
|
|
|
491 |
#$conf["postVar"]=array();
|
|
|
492 |
#$conf["rawPost"]="字串",要傳送的raw post內容.
|
|
|
493 |
#$conf["rawPost"]="";
|
|
|
494 |
#$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
|
|
|
495 |
#$conf["urlEncode"]="false";
|
|
|
496 |
#$conf["agent"],字串,user agent的名稱.
|
|
|
497 |
#$conf["agent"]="";
|
|
|
498 |
#$conf["cookie"],字串,cookie位置與檔案位置.
|
|
|
499 |
#$conf["cookie"]="";
|
|
|
500 |
#$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
|
|
|
501 |
#$conf["forceNewCookie"]="";
|
|
|
502 |
#備註:
|
|
|
503 |
#無.
|
|
|
504 |
$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
|
|
|
505 |
unset($conf["catchWebContent::curlCmd"]);
|
|
|
506 |
|
|
|
507 |
#如果執行失敗
|
|
|
508 |
if($curlCmd["status"]==="false"){
|
| 226 |
liveuser |
509 |
|
| 3 |
liveuser |
510 |
#設置執行不正常
|
|
|
511 |
$result["status"]="false";
|
|
|
512 |
|
|
|
513 |
#設置執行錯誤
|
|
|
514 |
$result["error"]=$curlCmd;
|
|
|
515 |
|
|
|
516 |
#回傳結果
|
|
|
517 |
return $result;
|
| 226 |
liveuser |
518 |
|
| 3 |
liveuser |
519 |
}#if end
|
|
|
520 |
|
|
|
521 |
#如果回應為 error
|
|
|
522 |
if($curlCmd["content"][0]="Error"){
|
| 226 |
liveuser |
523 |
|
| 3 |
liveuser |
524 |
#設置執行不正常
|
|
|
525 |
$result ["status"]="false";
|
|
|
526 |
|
|
|
527 |
#設置執行錯誤
|
|
|
528 |
$result["error"]=$curlCmd;
|
|
|
529 |
|
|
|
530 |
#回傳結果
|
|
|
531 |
return $result;
|
| 226 |
liveuser |
532 |
|
| 3 |
liveuser |
533 |
}#if end
|
|
|
534 |
|
|
|
535 |
#取得回應的內容
|
|
|
536 |
$result["content"]=$curlCmd["content"];
|
|
|
537 |
|
|
|
538 |
#設置執行正常
|
|
|
539 |
$result["status"]="true";
|
| 226 |
liveuser |
540 |
|
| 3 |
liveuser |
541 |
#回傳結果
|
|
|
542 |
return $result;
|
|
|
543 |
|
|
|
544 |
}#function listRooms end
|
| 226 |
liveuser |
545 |
|
| 3 |
liveuser |
546 |
/*
|
|
|
547 |
#函式說明:
|
|
|
548 |
#建立會議室清單
|
|
|
549 |
#回傳結果:
|
|
|
550 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
551 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
552 |
#$result["function"],當前執行的函式名稱.
|
|
|
553 |
#$result["content"],回應的xml物件.
|
|
|
554 |
#$result["res"]["returncode"],bbb server的回應,代表API的要求狀態識別.
|
|
|
555 |
#$result["res"]["meetingID"],bbb server的回應,會議室識別碼.
|
|
|
556 |
#$result["res"]["parentMeetingID"],bbb server的回應,父會議室識別碼
|
|
|
557 |
#$result["res"]["attendeePW"],bbb server的回應,vier password.
|
|
|
558 |
#$result["res"]["moderatorPW"],bbb server的回應,admin password.
|
|
|
559 |
#$result["res"]["createTime"],bbb server的回應,unix建立時間戳記.
|
|
|
560 |
#$result["res"]["voiceBridge"],bbb server的回應,voice id.
|
|
|
561 |
#$result["res"]["dialNumber"],bbb server的回應,phone call number.
|
|
|
562 |
#$result["res"]["hasUserJoined"],bbb server的回應,是否已經有使用者了.
|
|
|
563 |
#$result["res"]["duration"],bbb server的回應,會議室的時間長度限制.
|
|
|
564 |
#$result["res"]["hasBeenForciblyEnded"],bbb server的回應,是否已經結束會議了.
|
|
|
565 |
#$result["xml"],回應的xml格式內容.
|
|
|
566 |
#必填參數:
|
|
|
567 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
568 |
$conf["fileArgu"]=__FILE__;
|
|
|
569 |
#$conf["bbbUrl"],字串,提供bbb服務的主機名稱.
|
|
|
570 |
$conf["bbbUrl"]="";
|
|
|
571 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
572 |
$conf["SharedSecret"]="";
|
|
|
573 |
#$conf["meetingName"],字串,會議的名稱.
|
|
|
574 |
$conf["meetingName"]="";
|
|
|
575 |
#$conf["moderatorPW"],字串,管理者的密碼.
|
|
|
576 |
$conf["moderatorPW"]="";
|
|
|
577 |
#$conf["attendeePW"],字串,訪客的密碼.
|
|
|
578 |
$conf["attendeePW"]="";
|
|
|
579 |
#可省略參數:
|
|
|
580 |
#$conf["autoStartRecording"],字串,預設為"true",代表要會議一開始就錄影反之為"false".
|
|
|
581 |
#$conf["autoStartRecording"]="true".
|
|
|
582 |
#參考資料
|
|
|
583 |
#https://docs.bigbluebutton.org/dev/api.html#usage
|
|
|
584 |
#https://docs.bigbluebutton.org/dev/api.html#getmeetings
|
|
|
585 |
#備註:
|
|
|
586 |
#無.
|
|
|
587 |
*/
|
|
|
588 |
public static function createRoom(&$conf){
|
| 226 |
liveuser |
589 |
|
| 3 |
liveuser |
590 |
#初始化要回傳的結果
|
|
|
591 |
$result=array();
|
|
|
592 |
|
|
|
593 |
#取得當前執行的函數名稱
|
|
|
594 |
$result["function"]=__FUNCTION__;
|
|
|
595 |
|
|
|
596 |
#如果沒有參數
|
|
|
597 |
if(func_num_args()==0){
|
|
|
598 |
|
|
|
599 |
#設置執行失敗
|
|
|
600 |
$result["status"]="false";
|
|
|
601 |
|
|
|
602 |
#設置執行錯誤訊息
|
|
|
603 |
$result["error"]="函數".$result["function"]."需要參數";
|
|
|
604 |
|
|
|
605 |
#回傳結果
|
|
|
606 |
return $result;
|
|
|
607 |
|
|
|
608 |
}#if end
|
|
|
609 |
|
|
|
610 |
#取得參數
|
|
|
611 |
$result["argu"]=$conf;
|
|
|
612 |
|
|
|
613 |
#如果 $conf 不為陣列
|
|
|
614 |
if(gettype($conf)!=="array"){
|
|
|
615 |
|
|
|
616 |
#設置執行失敗
|
|
|
617 |
$result["status"]="false";
|
|
|
618 |
|
|
|
619 |
#設置執行錯誤訊息
|
|
|
620 |
$result["error"][]="\$conf變數須為陣列形態";
|
|
|
621 |
|
|
|
622 |
#如果傳入的參數為 null
|
|
|
623 |
if($conf===null){
|
|
|
624 |
|
|
|
625 |
#設置執行錯誤訊息
|
|
|
626 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
|
|
627 |
|
|
|
628 |
}#if end
|
|
|
629 |
|
|
|
630 |
#回傳結果
|
|
|
631 |
return $result;
|
|
|
632 |
|
|
|
633 |
}#if end
|
|
|
634 |
|
|
|
635 |
#檢查參數
|
|
|
636 |
#函式說明:
|
|
|
637 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
638 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
639 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
640 |
#$result["function"],當前執行的函式名稱.
|
|
|
641 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
642 |
#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
643 |
#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
644 |
#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
645 |
#必填寫的參數:
|
|
|
646 |
#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
647 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
648 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
649 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","bbbUrl","SharedSecret","meetingName","moderatorPW","attendeePW");
|
|
|
650 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
|
|
|
651 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string","string","string","string");
|
|
|
652 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
653 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
654 |
#可以省略的參數:
|
|
|
655 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
|
|
|
656 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
657 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
658 |
$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("autoStartRecording");
|
|
|
659 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
|
|
660 |
$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
|
|
|
661 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,"null"代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
662 |
$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
|
|
|
663 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
664 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
|
|
|
665 |
$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
666 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
667 |
|
|
|
668 |
#如果檢查參數失敗
|
|
|
669 |
if($checkResult["status"]=="false"){
|
|
|
670 |
|
|
|
671 |
#設置執行失敗
|
|
|
672 |
$result["status"]="false";
|
|
|
673 |
|
|
|
674 |
#設置執行錯誤
|
|
|
675 |
$result["error"]=$checkResult;
|
|
|
676 |
|
|
|
677 |
#回傳結果
|
|
|
678 |
return $result;
|
|
|
679 |
|
|
|
680 |
}#if end
|
|
|
681 |
|
|
|
682 |
#如果檢查參數不通過
|
|
|
683 |
if($checkResult["passed"]=="false"){
|
|
|
684 |
|
|
|
685 |
#設置執行失敗
|
|
|
686 |
$result["status"]="false";
|
|
|
687 |
|
|
|
688 |
#設置執行錯誤
|
|
|
689 |
$result["error"]=$checkResult;
|
|
|
690 |
|
|
|
691 |
#回傳結果
|
|
|
692 |
return $result;
|
|
|
693 |
|
|
|
694 |
}#if end
|
| 226 |
liveuser |
695 |
|
| 3 |
liveuser |
696 |
#base url
|
|
|
697 |
$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
|
| 226 |
liveuser |
698 |
|
| 3 |
liveuser |
699 |
#api name
|
|
|
700 |
$apiName="create";
|
| 226 |
liveuser |
701 |
|
| 3 |
liveuser |
702 |
#建立 $meetingID
|
|
|
703 |
#涵式說明:
|
|
|
704 |
#呼叫shell執行系統命令,並取得回傳的內容.
|
|
|
705 |
#回傳的結果:
|
|
|
706 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
707 |
#$result["error"],錯誤訊息陣列.
|
|
|
708 |
#$result["function"],當前執行的函數名稱.
|
|
|
709 |
#$result["argu"],使用的參數.
|
|
|
710 |
#$result["cmd"],執行的指令內容.
|
|
|
711 |
#$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
|
|
|
712 |
#$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
|
|
|
713 |
#$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
|
|
|
714 |
#$result["running"],是否還在執行.
|
|
|
715 |
#$result["pid"],pid.
|
|
|
716 |
#$result["statusCode"],執行結束後的代碼.
|
|
|
717 |
#必填的參數
|
|
|
718 |
#$conf["command"],字串,要執行的指令與.
|
|
|
719 |
$conf["external::callShell"]["command"]="uuid";
|
|
|
720 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
721 |
$conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
|
|
|
722 |
#可省略參數:
|
|
|
723 |
#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
|
|
|
724 |
#$conf["argu"]=array("");
|
|
|
725 |
#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
|
|
|
726 |
#$conf["arguIsAddr"]=array();
|
|
|
727 |
#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
|
|
|
728 |
#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
|
|
|
729 |
#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
|
|
|
730 |
#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
|
|
|
731 |
#$conf["enablePrintDescription"]="true";
|
|
|
732 |
#$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
|
|
|
733 |
#$conf["printDescription"]="";
|
|
|
734 |
#$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".
|
|
|
735 |
$conf["external::callShell"]["escapeshellarg"]="true";
|
|
|
736 |
#$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
|
|
|
737 |
#$conf["username"]="";
|
|
|
738 |
#$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
|
|
|
739 |
#$conf["password"]="";
|
|
|
740 |
#$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
|
|
|
741 |
#$conf["useScript"]="";
|
|
|
742 |
#$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
|
|
|
743 |
#$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
|
|
|
744 |
#$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
|
|
|
745 |
#$conf["inBackGround"]="";
|
|
|
746 |
#$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
|
|
|
747 |
#$conf["getErr"]="false";
|
|
|
748 |
#備註:
|
|
|
749 |
#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
|
|
|
750 |
#參考資料:
|
|
|
751 |
#exec=>http://php.net/manual/en/function.exec.php
|
|
|
752 |
#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
|
|
|
753 |
#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
|
|
|
754 |
$callShell=external::callShell($conf["external::callShell"]);
|
| 226 |
liveuser |
755 |
unset($conf["external::callShell"]);
|
|
|
756 |
|
| 3 |
liveuser |
757 |
#如果執行失敗
|
|
|
758 |
if($callShell["status"]==="false"){
|
| 226 |
liveuser |
759 |
|
| 3 |
liveuser |
760 |
#設置執行不正常
|
|
|
761 |
$result ["status"]="false";
|
|
|
762 |
|
|
|
763 |
#設置執行錯誤
|
|
|
764 |
$result["error"]=$callShell;
|
|
|
765 |
|
|
|
766 |
#回傳結果
|
|
|
767 |
return $result;
|
| 226 |
liveuser |
768 |
|
| 3 |
liveuser |
769 |
}#if end
|
|
|
770 |
|
|
|
771 |
#取得meeting id
|
|
|
772 |
$meetingID=$callShell["output"][0];
|
| 226 |
liveuser |
773 |
|
| 3 |
liveuser |
774 |
#參數為空
|
|
|
775 |
$getParams="allowStartStopRecording=true&autoStartRecording=".$conf["autoStartRecording"]."&meetingID=".$meetingID."&name=".urlencode($conf["meetingName"])."&record=true&attendeePW=".$conf["attendeePW"]."&moderatorPW=".$conf["moderatorPW"];
|
| 226 |
liveuser |
776 |
|
| 3 |
liveuser |
777 |
#目標網址的開頭
|
|
|
778 |
$headUrl=$baseUrl.$apiName."?".$getParams;
|
| 226 |
liveuser |
779 |
|
| 3 |
liveuser |
780 |
#函式說明:
|
|
|
781 |
#計算checksum
|
|
|
782 |
#回傳結果:
|
|
|
783 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
784 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
785 |
#$result["function"],當前執行的函式名稱.
|
|
|
786 |
#$result["content"],內容.
|
|
|
787 |
#必填參數:
|
|
|
788 |
#$conf["input"],字串,要計算checksum的內容.
|
|
|
789 |
$conf["bigbluebutton::getCheckSum"]["input"]=$apiName.$getParams;
|
|
|
790 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
791 |
$conf["bigbluebutton::getCheckSum"]["SharedSecret"]=$conf["SharedSecret"];
|
|
|
792 |
#可省略參數:
|
|
|
793 |
#無.
|
|
|
794 |
#備註:
|
|
|
795 |
#無.
|
|
|
796 |
$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
|
|
|
797 |
unset($conf["bigbluebutton::getCheckSum"]);
|
|
|
798 |
|
|
|
799 |
#如果執行失敗
|
|
|
800 |
if($getCheckSum["status"]==="false"){
|
| 226 |
liveuser |
801 |
|
| 3 |
liveuser |
802 |
#設置執行不正常
|
|
|
803 |
$result["status"]="false";
|
|
|
804 |
|
|
|
805 |
#設置執行錯誤
|
|
|
806 |
$result["error"]=$getCheckSum;
|
|
|
807 |
|
|
|
808 |
#回傳結果
|
|
|
809 |
return $result;
|
| 226 |
liveuser |
810 |
|
| 3 |
liveuser |
811 |
}#if end
|
|
|
812 |
|
|
|
813 |
#取得checksum
|
|
|
814 |
$checkSum=$getCheckSum["content"];
|
|
|
815 |
|
|
|
816 |
#取得目標url
|
|
|
817 |
$targetUrl=$headUrl."&checksum=".$checkSum;
|
| 226 |
liveuser |
818 |
|
| 3 |
liveuser |
819 |
#函式說明:
|
|
|
820 |
#運行curl cmd
|
|
|
821 |
#回傳結果:
|
|
|
822 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
823 |
#$result["error"],錯誤訊息陣列.
|
|
|
824 |
#$result["function"],當前執行的函式名稱.
|
|
|
825 |
#$result["content"],取得的回應內容.
|
|
|
826 |
#$result["cookie"],cookie檔案的位置與名稱.
|
|
|
827 |
#$result["cmd"],執行的command.
|
|
|
828 |
#$result["argu],使用的參數.
|
|
|
829 |
#必填參數:
|
|
|
830 |
#$conf["url"],字串,目標url.
|
|
|
831 |
$conf["catchWebContent::curlCmd"]["url"]=$targetUrl;
|
|
|
832 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
833 |
$conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
|
|
|
834 |
#可省略參數:
|
|
|
835 |
#$conf["header"],字串陣列,要傳送的header.
|
|
|
836 |
#$conf["header"]=array();
|
|
|
837 |
#$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
|
|
|
838 |
#$conf["allowAnySSLcertificate"]="";
|
|
|
839 |
#$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
|
|
|
840 |
#$conf["postVar"]=array();
|
|
|
841 |
#$conf["rawPost"]="字串",要傳送的raw post內容.
|
|
|
842 |
#$conf["rawPost"]="";
|
|
|
843 |
#$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
|
|
|
844 |
#$conf["urlEncode"]="false";
|
|
|
845 |
#$conf["agent"],字串,user agent的名稱.
|
|
|
846 |
$conf["catchWebContent::curlCmd"]["agent"]="qbpwcf";
|
|
|
847 |
#$conf["cookie"],字串,cookie位置與檔案位置.
|
|
|
848 |
#$conf["cookie"]="";
|
|
|
849 |
#$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
|
|
|
850 |
#$conf["forceNewCookie"]="";
|
|
|
851 |
#備註:
|
|
|
852 |
#無.
|
|
|
853 |
$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
|
|
|
854 |
unset($conf["catchWebContent::curlCmd"]);
|
|
|
855 |
|
|
|
856 |
#如果執行失敗
|
|
|
857 |
if($curlCmd["status"]==="false"){
|
| 226 |
liveuser |
858 |
|
| 3 |
liveuser |
859 |
#設置執行不正常
|
|
|
860 |
$result["status"]="false";
|
|
|
861 |
|
|
|
862 |
#設置執行錯誤
|
|
|
863 |
$result["error"]=$curlCmd;
|
|
|
864 |
|
|
|
865 |
#回傳結果
|
|
|
866 |
return $result;
|
| 226 |
liveuser |
867 |
|
| 3 |
liveuser |
868 |
}#if end
|
|
|
869 |
|
|
|
870 |
#xml字串
|
|
|
871 |
$xmlStr="";
|
|
|
872 |
|
|
|
873 |
#如果有xml內容
|
|
|
874 |
if(count($curlCmd["content"])>1){
|
| 226 |
liveuser |
875 |
|
| 3 |
liveuser |
876 |
#針對每行輸出
|
|
|
877 |
for($i=0;$i<count($curlCmd["content"]);$i++){
|
| 226 |
liveuser |
878 |
|
| 3 |
liveuser |
879 |
#傳接xml內容
|
|
|
880 |
$xmlStr=$xmlStr.$curlCmd["content"][$i];
|
| 226 |
liveuser |
881 |
|
| 3 |
liveuser |
882 |
}#for end
|
| 226 |
liveuser |
883 |
|
| 3 |
liveuser |
884 |
}#if end
|
|
|
885 |
|
|
|
886 |
#涵式說明:
|
|
|
887 |
#解析xml字串.
|
|
|
888 |
#回傳結果:
|
|
|
889 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
890 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
891 |
#$result["function"],當前執行的函式名稱.
|
|
|
892 |
#$result["content"],xml物件.
|
|
|
893 |
#$result["xmlStr"],xml格式的內容.
|
|
|
894 |
#必填參數:
|
|
|
895 |
#$conf["xmlString"],字串,要解析的xml字串.
|
|
|
896 |
$conf["xml::parseXMLstring"]["xmlString"]=$xmlStr;
|
|
|
897 |
#可省略參數:
|
|
|
898 |
#無.
|
|
|
899 |
#備註:
|
|
|
900 |
#無.
|
|
|
901 |
$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
|
|
|
902 |
unset($conf["xml::parseXMLstring"]);
|
|
|
903 |
|
|
|
904 |
#如果解析失敗
|
|
|
905 |
if($parseXMLstring["status"]==="false"){
|
| 226 |
liveuser |
906 |
|
| 3 |
liveuser |
907 |
#設置執行不正常
|
|
|
908 |
$result["status"]="false";
|
|
|
909 |
|
|
|
910 |
#設置執行錯誤
|
|
|
911 |
$result["error"]=$parseXMLstring;
|
|
|
912 |
|
|
|
913 |
#回傳結果
|
|
|
914 |
return $result;
|
| 226 |
liveuser |
915 |
|
| 3 |
liveuser |
916 |
}#if end
|
| 226 |
liveuser |
917 |
|
| 3 |
liveuser |
918 |
#取得xml物件的內容
|
|
|
919 |
$result["content"]=$parseXMLstring["content"];
|
|
|
920 |
|
|
|
921 |
#取得回應的內容
|
|
|
922 |
$result["xml"]=$parseXMLstring["xmlStr"];
|
|
|
923 |
|
|
|
924 |
#如果有 returncode
|
|
|
925 |
if(isset($result["content"]->returncode)){
|
| 226 |
liveuser |
926 |
|
| 3 |
liveuser |
927 |
#取得回應
|
|
|
928 |
$res=(array)$result["content"]->returncode;
|
| 226 |
liveuser |
929 |
|
| 3 |
liveuser |
930 |
#設置其數值內容
|
|
|
931 |
$result["res"]["returncode"]=$res[0];
|
| 226 |
liveuser |
932 |
|
| 3 |
liveuser |
933 |
}#if end
|
| 226 |
liveuser |
934 |
|
| 3 |
liveuser |
935 |
#如果有 meetingID
|
|
|
936 |
if(isset($result["content"]->meetingID)){
|
| 226 |
liveuser |
937 |
|
| 3 |
liveuser |
938 |
#取得回應
|
|
|
939 |
$res=(array)$result["content"]->meetingID;
|
| 226 |
liveuser |
940 |
|
| 3 |
liveuser |
941 |
#設置其數值內容
|
|
|
942 |
$result["res"]["meetingID"]=$res[0];
|
| 226 |
liveuser |
943 |
|
| 3 |
liveuser |
944 |
}#if end
|
| 226 |
liveuser |
945 |
|
| 3 |
liveuser |
946 |
#如果有 parentMeetingID
|
|
|
947 |
if(isset($result["content"]->parentMeetingID)){
|
| 226 |
liveuser |
948 |
|
| 3 |
liveuser |
949 |
#取得回應
|
|
|
950 |
$res=(array)$result["content"]->parentMeetingID;
|
| 226 |
liveuser |
951 |
|
| 3 |
liveuser |
952 |
#設置其數值內容
|
|
|
953 |
$result["res"]["parentMeetingID"]=$res[0];
|
| 226 |
liveuser |
954 |
|
| 3 |
liveuser |
955 |
}#if end
|
| 226 |
liveuser |
956 |
|
| 3 |
liveuser |
957 |
#如果有 attendeePW
|
|
|
958 |
if(isset($result["content"]->attendeePW)){
|
| 226 |
liveuser |
959 |
|
| 3 |
liveuser |
960 |
#取得回應
|
|
|
961 |
$res=(array)$result["content"]->attendeePW;
|
| 226 |
liveuser |
962 |
|
| 3 |
liveuser |
963 |
#設置其數值內容
|
|
|
964 |
$result["res"]["attendeePW"]=$res[0];
|
| 226 |
liveuser |
965 |
|
| 3 |
liveuser |
966 |
}#if end
|
|
|
967 |
|
|
|
968 |
#如果有 moderatorPW
|
|
|
969 |
if(isset($result["content"]->moderatorPW)){
|
| 226 |
liveuser |
970 |
|
| 3 |
liveuser |
971 |
#取得回應
|
|
|
972 |
$res=(array)$result["content"]->moderatorPW;
|
| 226 |
liveuser |
973 |
|
| 3 |
liveuser |
974 |
#設置其數值內容
|
|
|
975 |
$result["res"]["moderatorPW"]=$res[0];
|
| 226 |
liveuser |
976 |
|
| 3 |
liveuser |
977 |
}#if end
|
| 226 |
liveuser |
978 |
|
| 3 |
liveuser |
979 |
#如果有 createTime
|
|
|
980 |
if(isset($result["content"]->createTime)){
|
| 226 |
liveuser |
981 |
|
| 3 |
liveuser |
982 |
#取得回應
|
|
|
983 |
$res=(array)$result["content"]->createTime;
|
| 226 |
liveuser |
984 |
|
| 3 |
liveuser |
985 |
#設置其數值內容
|
|
|
986 |
$result["res"]["createTime"]=$res[0];
|
| 226 |
liveuser |
987 |
|
| 3 |
liveuser |
988 |
}#if end
|
| 226 |
liveuser |
989 |
|
| 3 |
liveuser |
990 |
#如果有 voiceBridge
|
|
|
991 |
if(isset($result["content"]->voiceBridge)){
|
| 226 |
liveuser |
992 |
|
| 3 |
liveuser |
993 |
#取得回應
|
|
|
994 |
$res=(array)$result["content"]->voiceBridge;
|
| 226 |
liveuser |
995 |
|
| 3 |
liveuser |
996 |
#設置其數值內容
|
|
|
997 |
$result["res"]["voiceBridge"]=$res[0];
|
| 226 |
liveuser |
998 |
|
| 3 |
liveuser |
999 |
}#if end
|
| 226 |
liveuser |
1000 |
|
| 3 |
liveuser |
1001 |
#如果有 dialNumber
|
|
|
1002 |
if(isset($result["content"]->dialNumber)){
|
| 226 |
liveuser |
1003 |
|
| 3 |
liveuser |
1004 |
#取得回應
|
|
|
1005 |
$res=(array)$result["content"]->dialNumber;
|
| 226 |
liveuser |
1006 |
|
| 3 |
liveuser |
1007 |
#設置其數值內容
|
|
|
1008 |
$result["res"]["dialNumber"]=$res[0];
|
| 226 |
liveuser |
1009 |
|
| 3 |
liveuser |
1010 |
}#if end
|
|
|
1011 |
|
|
|
1012 |
#如果有 hasUserJoined
|
|
|
1013 |
if(isset($result["content"]->hasUserJoined)){
|
| 226 |
liveuser |
1014 |
|
| 3 |
liveuser |
1015 |
#取得回應
|
|
|
1016 |
$res=(array)$result["content"]->hasUserJoined;
|
| 226 |
liveuser |
1017 |
|
| 3 |
liveuser |
1018 |
#設置其數值內容
|
|
|
1019 |
$result["res"]["hasUserJoined"]=$res[0];
|
| 226 |
liveuser |
1020 |
|
| 3 |
liveuser |
1021 |
}#if end
|
| 226 |
liveuser |
1022 |
|
| 3 |
liveuser |
1023 |
#如果有 duration
|
|
|
1024 |
if(isset($result["content"]->duration)){
|
| 226 |
liveuser |
1025 |
|
| 3 |
liveuser |
1026 |
#取得回應
|
|
|
1027 |
$res=(array)$result["content"]->duration;
|
| 226 |
liveuser |
1028 |
|
| 3 |
liveuser |
1029 |
#設置其數值內容
|
|
|
1030 |
$result["res"]["duration"]=$res[0];
|
| 226 |
liveuser |
1031 |
|
| 3 |
liveuser |
1032 |
}#if end
|
| 226 |
liveuser |
1033 |
|
| 3 |
liveuser |
1034 |
#如果有 hasBeenForciblyEnded
|
|
|
1035 |
if(isset($result["content"]->hasBeenForciblyEnded)){
|
| 226 |
liveuser |
1036 |
|
| 3 |
liveuser |
1037 |
#取得回應
|
|
|
1038 |
$res=(array)$result["content"]->hasBeenForciblyEnded;
|
| 226 |
liveuser |
1039 |
|
| 3 |
liveuser |
1040 |
#設置其數值內容
|
|
|
1041 |
$result["res"]["hasBeenForciblyEnded"]=$res[0];
|
| 226 |
liveuser |
1042 |
|
| 3 |
liveuser |
1043 |
}#if end
|
| 226 |
liveuser |
1044 |
|
| 3 |
liveuser |
1045 |
#設置執行正常
|
|
|
1046 |
$result["status"]="true";
|
| 226 |
liveuser |
1047 |
|
| 3 |
liveuser |
1048 |
#回傳結果
|
|
|
1049 |
return $result;
|
| 226 |
liveuser |
1050 |
|
| 3 |
liveuser |
1051 |
}#function createRoom end
|
| 226 |
liveuser |
1052 |
|
| 3 |
liveuser |
1053 |
/*
|
|
|
1054 |
#函式說明:
|
|
|
1055 |
#提供加入會議室的網址.
|
|
|
1056 |
#回傳結果:
|
|
|
1057 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1058 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1059 |
#$result["function"],當前執行的函式名稱.
|
|
|
1060 |
#$result["content"],加入會議的網址.
|
|
|
1061 |
#必填參數:
|
|
|
1062 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
1063 |
$conf["fileArgu"]=__FILE__;
|
|
|
1064 |
#$conf["bbbUrl"],字串,提供bbb服務的主機名稱.
|
|
|
1065 |
$conf["bbbUrl"]="";
|
|
|
1066 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
1067 |
$conf["SharedSecret"]="";
|
|
|
1068 |
#$conf["name"],字串,你的名字.
|
|
|
1069 |
$conf["name"]="";
|
|
|
1070 |
#$conf["meetingID"],字串,會議室識別碼.
|
|
|
1071 |
$conf["meetingID"]="";
|
|
|
1072 |
#$conf["password"],字串,會議室密碼.
|
|
|
1073 |
$conf["password"]="";
|
|
|
1074 |
#可省略參數:
|
|
|
1075 |
#無.
|
|
|
1076 |
#參考資料:
|
|
|
1077 |
#https://docs.bigbluebutton.org/dev/api.html#join
|
|
|
1078 |
#備註:
|
|
|
1079 |
#無.
|
|
|
1080 |
*/
|
|
|
1081 |
public static function enterRoom(&$conf){
|
| 226 |
liveuser |
1082 |
|
| 3 |
liveuser |
1083 |
#初始化要回傳的結果
|
|
|
1084 |
$result=array();
|
|
|
1085 |
|
|
|
1086 |
#取得當前執行的函數名稱
|
|
|
1087 |
$result["function"]=__FUNCTION__;
|
|
|
1088 |
|
|
|
1089 |
#如果沒有參數
|
|
|
1090 |
if(func_num_args()==0){
|
|
|
1091 |
|
|
|
1092 |
#設置執行失敗
|
|
|
1093 |
$result["status"]="false";
|
|
|
1094 |
|
|
|
1095 |
#設置執行錯誤訊息
|
|
|
1096 |
$result["error"]="函數".$result["function"]."需要參數";
|
|
|
1097 |
|
|
|
1098 |
#回傳結果
|
|
|
1099 |
return $result;
|
|
|
1100 |
|
|
|
1101 |
}#if end
|
|
|
1102 |
|
|
|
1103 |
#取得參數
|
|
|
1104 |
$result["argu"]=$conf;
|
|
|
1105 |
|
|
|
1106 |
#如果 $conf 不為陣列
|
|
|
1107 |
if(gettype($conf)!=="array"){
|
|
|
1108 |
|
|
|
1109 |
#設置執行失敗
|
|
|
1110 |
$result["status"]="false";
|
|
|
1111 |
|
|
|
1112 |
#設置執行錯誤訊息
|
|
|
1113 |
$result["error"][]="\$conf變數須為陣列形態";
|
|
|
1114 |
|
|
|
1115 |
#如果傳入的參數為 null
|
|
|
1116 |
if($conf===null){
|
|
|
1117 |
|
|
|
1118 |
#設置執行錯誤訊息
|
|
|
1119 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
|
|
1120 |
|
|
|
1121 |
}#if end
|
|
|
1122 |
|
|
|
1123 |
#回傳結果
|
|
|
1124 |
return $result;
|
|
|
1125 |
|
|
|
1126 |
}#if end
|
|
|
1127 |
|
|
|
1128 |
#檢查參數
|
|
|
1129 |
#函式說明:
|
|
|
1130 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
1131 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1132 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1133 |
#$result["function"],當前執行的函式名稱.
|
|
|
1134 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
1135 |
#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
1136 |
#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
1137 |
#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
1138 |
#必填寫的參數:
|
|
|
1139 |
#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
1140 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
1141 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
1142 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","bbbUrl","SharedSecret","name","meetingID","password");
|
|
|
1143 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
|
|
|
1144 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string","string","string","string");
|
|
|
1145 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
1146 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
1147 |
#可以省略的參數:
|
|
|
1148 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
|
|
|
1149 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
1150 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
1151 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("autoStartRecording");
|
|
|
1152 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
|
|
1153 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string");
|
|
|
1154 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,"null"代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
1155 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array("true");
|
|
|
1156 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
1157 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
|
|
|
1158 |
$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
1159 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
1160 |
|
|
|
1161 |
#如果檢查參數失敗
|
|
|
1162 |
if($checkResult["status"]=="false"){
|
|
|
1163 |
|
|
|
1164 |
#設置執行失敗
|
|
|
1165 |
$result["status"]="false";
|
|
|
1166 |
|
|
|
1167 |
#設置執行錯誤
|
|
|
1168 |
$result["error"]=$checkResult;
|
|
|
1169 |
|
|
|
1170 |
#回傳結果
|
|
|
1171 |
return $result;
|
|
|
1172 |
|
|
|
1173 |
}#if end
|
|
|
1174 |
|
|
|
1175 |
#如果檢查參數不通過
|
|
|
1176 |
if($checkResult["passed"]=="false"){
|
|
|
1177 |
|
|
|
1178 |
#設置執行失敗
|
|
|
1179 |
$result["status"]="false";
|
|
|
1180 |
|
|
|
1181 |
#設置執行錯誤
|
|
|
1182 |
$result["error"]=$checkResult;
|
|
|
1183 |
|
|
|
1184 |
#回傳結果
|
|
|
1185 |
return $result;
|
|
|
1186 |
|
|
|
1187 |
}#if end
|
| 226 |
liveuser |
1188 |
|
| 3 |
liveuser |
1189 |
#base url
|
|
|
1190 |
$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
|
| 226 |
liveuser |
1191 |
|
| 3 |
liveuser |
1192 |
#api name
|
|
|
1193 |
$apiName="join";
|
| 226 |
liveuser |
1194 |
|
| 3 |
liveuser |
1195 |
#參數為空
|
|
|
1196 |
$getParams="fullName=".$conf["name"]."&meetingID=".$conf["meetingID"]."&password=".$conf["password"];
|
| 226 |
liveuser |
1197 |
|
| 3 |
liveuser |
1198 |
#目標網址的開頭
|
|
|
1199 |
$headUrl=$baseUrl.$apiName."?".$getParams;
|
| 226 |
liveuser |
1200 |
|
| 3 |
liveuser |
1201 |
#函式說明:
|
|
|
1202 |
#計算checksum
|
|
|
1203 |
#回傳結果:
|
|
|
1204 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1205 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1206 |
#$result["function"],當前執行的函式名稱.
|
|
|
1207 |
#$result["content"],內容.
|
|
|
1208 |
#必填參數:
|
|
|
1209 |
#$conf["input"],字串,要計算checksum的內容.
|
|
|
1210 |
$conf["bigbluebutton::getCheckSum"]["input"]=$apiName.$getParams;
|
|
|
1211 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
1212 |
$conf["bigbluebutton::getCheckSum"]["SharedSecret"]=$conf["SharedSecret"];
|
|
|
1213 |
#可省略參數:
|
|
|
1214 |
#無.
|
|
|
1215 |
#備註:
|
|
|
1216 |
#無.
|
|
|
1217 |
$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
|
|
|
1218 |
unset($conf["bigbluebutton::getCheckSum"]);
|
|
|
1219 |
|
|
|
1220 |
#如果執行失敗
|
|
|
1221 |
if($getCheckSum["status"]==="false"){
|
| 226 |
liveuser |
1222 |
|
| 3 |
liveuser |
1223 |
#設置執行不正常
|
|
|
1224 |
$result ["status"]="false";
|
|
|
1225 |
|
|
|
1226 |
#設置執行錯誤
|
|
|
1227 |
$result["error"]=$getCheckSum;
|
|
|
1228 |
|
|
|
1229 |
#回傳結果
|
|
|
1230 |
return $result;
|
| 226 |
liveuser |
1231 |
|
| 3 |
liveuser |
1232 |
}#if end
|
|
|
1233 |
|
|
|
1234 |
#取得checksum
|
|
|
1235 |
$checkSum=$getCheckSum["content"];
|
|
|
1236 |
|
|
|
1237 |
#取得目標url
|
|
|
1238 |
$targetUrl=$headUrl."&checksum=".$checkSum;
|
| 226 |
liveuser |
1239 |
|
| 3 |
liveuser |
1240 |
#記錄進入會議室的網址
|
|
|
1241 |
$result["content"]=$targetUrl;
|
| 226 |
liveuser |
1242 |
|
| 3 |
liveuser |
1243 |
#設置執行正常
|
|
|
1244 |
$result["status"]="true";
|
| 226 |
liveuser |
1245 |
|
| 3 |
liveuser |
1246 |
#回傳結果
|
|
|
1247 |
return $result;
|
| 226 |
liveuser |
1248 |
|
| 3 |
liveuser |
1249 |
}#functino enterRoom end
|
| 226 |
liveuser |
1250 |
|
| 3 |
liveuser |
1251 |
/*
|
|
|
1252 |
#函式說明:
|
|
|
1253 |
#取得會議室的錄影資料
|
|
|
1254 |
#回傳結果:
|
|
|
1255 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1256 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1257 |
#$result["function"],當前執行的函式名稱.
|
|
|
1258 |
#$result["requestUrl"],要求的網址.
|
|
|
1259 |
#$result["content"],回應的xml物件.
|
|
|
1260 |
#$result["xml"],回應的xml格式內容.
|
|
|
1261 |
#必填參數:
|
|
|
1262 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
1263 |
$conf["fileArgu"]=__FILE__;
|
|
|
1264 |
#$conf["bbbUrl"],字串,提供bbb服務的主機名稱.
|
|
|
1265 |
$conf["bbbUrl"]="";
|
|
|
1266 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
1267 |
$conf["SharedSecret"]="";
|
|
|
1268 |
#可省略參數:
|
|
|
1269 |
#$conf["meetingID"],字串,會議室識別碼,有的話可以找特定的會議室錄影資料.
|
|
|
1270 |
#$conf["meetingID"]="";
|
|
|
1271 |
#$conf["recordID"],字串,有的話可以指定要找的特定一個錄影.
|
|
|
1272 |
#$conf["recordID"]="";
|
|
|
1273 |
#參考資料:
|
|
|
1274 |
#https://docs.bigbluebutton.org/dev/api.html#getrecordings
|
|
|
1275 |
#備註:
|
|
|
1276 |
#建構中.
|
|
|
1277 |
*/
|
|
|
1278 |
public static function getRecord(&$conf){
|
| 226 |
liveuser |
1279 |
|
| 3 |
liveuser |
1280 |
#初始化要回傳的結果
|
|
|
1281 |
$result=array();
|
|
|
1282 |
|
|
|
1283 |
#取得當前執行的函數名稱
|
|
|
1284 |
$result["function"]=__FUNCTION__;
|
|
|
1285 |
|
|
|
1286 |
#如果沒有參數
|
|
|
1287 |
if(func_num_args()==0){
|
|
|
1288 |
|
|
|
1289 |
#設置執行失敗
|
|
|
1290 |
$result["status"]="false";
|
|
|
1291 |
|
|
|
1292 |
#設置執行錯誤訊息
|
|
|
1293 |
$result["error"]="函數".$result["function"]."需要參數";
|
|
|
1294 |
|
|
|
1295 |
#回傳結果
|
|
|
1296 |
return $result;
|
|
|
1297 |
|
|
|
1298 |
}#if end
|
|
|
1299 |
|
|
|
1300 |
#取得參數
|
|
|
1301 |
$result["argu"]=$conf;
|
|
|
1302 |
|
|
|
1303 |
#如果 $conf 不為陣列
|
|
|
1304 |
if(gettype($conf)!=="array"){
|
|
|
1305 |
|
|
|
1306 |
#設置執行失敗
|
|
|
1307 |
$result["status"]="false";
|
|
|
1308 |
|
|
|
1309 |
#設置執行錯誤訊息
|
|
|
1310 |
$result["error"][]="\$conf變數須為陣列形態";
|
|
|
1311 |
|
|
|
1312 |
#如果傳入的參數為 null
|
|
|
1313 |
if($conf===null){
|
|
|
1314 |
|
|
|
1315 |
#設置執行錯誤訊息
|
|
|
1316 |
$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
|
|
|
1317 |
|
|
|
1318 |
}#if end
|
|
|
1319 |
|
|
|
1320 |
#回傳結果
|
|
|
1321 |
return $result;
|
|
|
1322 |
|
|
|
1323 |
}#if end
|
|
|
1324 |
|
|
|
1325 |
#檢查參數
|
|
|
1326 |
#函式說明:
|
|
|
1327 |
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
|
|
|
1328 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1329 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1330 |
#$result["function"],當前執行的函式名稱.
|
|
|
1331 |
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
|
|
|
1332 |
#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
|
|
|
1333 |
#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
|
|
|
1334 |
#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
|
|
|
1335 |
#必填寫的參數:
|
|
|
1336 |
#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
|
|
|
1337 |
$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
|
|
|
1338 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
|
|
|
1339 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","bbbUrl","SharedSecret");
|
|
|
1340 |
#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double");
|
|
|
1341 |
$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string","string");
|
|
|
1342 |
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
|
|
|
1343 |
$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
|
|
|
1344 |
#可以省略的參數:
|
|
|
1345 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
|
|
|
1346 |
#$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
|
|
|
1347 |
#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
|
|
1348 |
$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("meetingID","recordID");
|
|
|
1349 |
#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
|
|
1350 |
$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string");
|
|
|
1351 |
#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,"null"代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
|
|
1352 |
$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,null);
|
|
|
1353 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
|
|
1354 |
#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
|
|
|
1355 |
$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
|
|
|
1356 |
unset($conf["variableCheck::checkArguments"]);
|
|
|
1357 |
|
|
|
1358 |
#如果檢查參數失敗
|
|
|
1359 |
if($checkResult["status"]=="false"){
|
|
|
1360 |
|
|
|
1361 |
#設置執行失敗
|
|
|
1362 |
$result["status"]="false";
|
|
|
1363 |
|
|
|
1364 |
#設置執行錯誤
|
|
|
1365 |
$result["error"]=$checkResult;
|
|
|
1366 |
|
|
|
1367 |
#回傳結果
|
|
|
1368 |
return $result;
|
|
|
1369 |
|
|
|
1370 |
}#if end
|
|
|
1371 |
|
|
|
1372 |
#如果檢查參數不通過
|
|
|
1373 |
if($checkResult["passed"]=="false"){
|
|
|
1374 |
|
|
|
1375 |
#設置執行失敗
|
|
|
1376 |
$result["status"]="false";
|
|
|
1377 |
|
|
|
1378 |
#設置執行錯誤
|
|
|
1379 |
$result["error"]=$checkResult;
|
|
|
1380 |
|
|
|
1381 |
#回傳結果
|
|
|
1382 |
return $result;
|
|
|
1383 |
|
|
|
1384 |
}#if end
|
| 226 |
liveuser |
1385 |
|
| 3 |
liveuser |
1386 |
#base url
|
|
|
1387 |
$baseUrl=$conf["bbbUrl"]."/bigbluebutton/api/";
|
| 226 |
liveuser |
1388 |
|
| 3 |
liveuser |
1389 |
#api name
|
|
|
1390 |
$apiName="getRecordings";
|
| 226 |
liveuser |
1391 |
|
| 3 |
liveuser |
1392 |
#參數為空
|
|
|
1393 |
$getParamsArray=array();
|
| 226 |
liveuser |
1394 |
|
| 3 |
liveuser |
1395 |
#如果有設定 $conf["meetingID"]
|
|
|
1396 |
if(isset($conf["meetingID"])){
|
| 226 |
liveuser |
1397 |
|
| 3 |
liveuser |
1398 |
#設定參數
|
|
|
1399 |
$getParamsArray["meetingID"]=$conf["meetingID"];
|
| 226 |
liveuser |
1400 |
|
| 3 |
liveuser |
1401 |
}#if end
|
| 226 |
liveuser |
1402 |
|
| 3 |
liveuser |
1403 |
#如果有設定 recordID
|
|
|
1404 |
if(isset($conf["recordID"])){
|
| 226 |
liveuser |
1405 |
|
| 3 |
liveuser |
1406 |
#設定參數
|
|
|
1407 |
$getParamsArray["recordID"]=$conf["recordID"];
|
| 226 |
liveuser |
1408 |
|
| 3 |
liveuser |
1409 |
}#if end
|
| 226 |
liveuser |
1410 |
|
| 3 |
liveuser |
1411 |
#to get query string
|
|
|
1412 |
$getParams=http_build_query($getParamsArray);
|
| 226 |
liveuser |
1413 |
|
| 3 |
liveuser |
1414 |
#目標網址的開頭
|
|
|
1415 |
$headUrl=$baseUrl.$apiName."?".$getParams;
|
| 226 |
liveuser |
1416 |
|
| 3 |
liveuser |
1417 |
#函式說明:
|
|
|
1418 |
#計算checksum
|
|
|
1419 |
#回傳結果:
|
|
|
1420 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1421 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1422 |
#$result["function"],當前執行的函式名稱.
|
|
|
1423 |
#$result["content"],內容.
|
|
|
1424 |
#必填參數:
|
|
|
1425 |
#$conf["input"],字串,要計算checksum的內容.
|
|
|
1426 |
$conf["bigbluebutton::getCheckSum"]["input"]=$apiName.$getParams;
|
|
|
1427 |
#$conf["sharedSecret"],字串,SharedSecret.
|
|
|
1428 |
$conf["bigbluebutton::getCheckSum"]["SharedSecret"]=$conf["SharedSecret"];
|
|
|
1429 |
#可省略參數:
|
|
|
1430 |
#無.
|
|
|
1431 |
#備註:
|
|
|
1432 |
#無.
|
|
|
1433 |
$getCheckSum=bigbluebutton::getCheckSum($conf["bigbluebutton::getCheckSum"]);
|
|
|
1434 |
unset($conf["bigbluebutton::getCheckSum"]);
|
|
|
1435 |
|
|
|
1436 |
#如果執行失敗
|
|
|
1437 |
if($getCheckSum["status"]==="false"){
|
| 226 |
liveuser |
1438 |
|
| 3 |
liveuser |
1439 |
#設置執行不正常
|
|
|
1440 |
$result ["status"]="false";
|
|
|
1441 |
|
|
|
1442 |
#設置執行錯誤
|
|
|
1443 |
$result["error"]=$getCheckSum;
|
|
|
1444 |
|
|
|
1445 |
#回傳結果
|
|
|
1446 |
return $result;
|
| 226 |
liveuser |
1447 |
|
| 3 |
liveuser |
1448 |
}#if end
|
|
|
1449 |
|
|
|
1450 |
#取得checksum
|
|
|
1451 |
$getParamsArray["checksum"]=$getCheckSum["content"];
|
|
|
1452 |
|
|
|
1453 |
#to get query string
|
|
|
1454 |
$getParams=http_build_query($getParamsArray);
|
| 226 |
liveuser |
1455 |
|
| 3 |
liveuser |
1456 |
#目標網址的開頭
|
|
|
1457 |
$targetUrl=$baseUrl.$apiName."?".$getParams;
|
|
|
1458 |
|
|
|
1459 |
#要求的網址
|
|
|
1460 |
$result["requestUrl"]=$targetUrl;
|
| 226 |
liveuser |
1461 |
|
| 3 |
liveuser |
1462 |
#函式說明:
|
|
|
1463 |
#運行curl cmd
|
|
|
1464 |
#回傳結果:
|
|
|
1465 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1466 |
#$result["error"],錯誤訊息陣列.
|
|
|
1467 |
#$result["function"],當前執行的函式名稱.
|
|
|
1468 |
#$result["content"],取得的回應內容.
|
|
|
1469 |
#$result["cookie"],cookie檔案的位置與名稱.
|
|
|
1470 |
#$result["cmd"],執行的command.
|
|
|
1471 |
#$result["argu],使用的參數.
|
|
|
1472 |
#必填參數:
|
|
|
1473 |
#$conf["url"],字串,目標url.
|
|
|
1474 |
$conf["catchWebContent::curlCmd"]["url"]=$targetUrl;
|
|
|
1475 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
|
|
1476 |
$conf["catchWebContent::curlCmd"]["fileArgu"]=$conf["fileArgu"];
|
|
|
1477 |
#可省略參數:
|
|
|
1478 |
#$conf["header"],字串陣列,要傳送的header.
|
|
|
1479 |
#$conf["header"]=array();
|
|
|
1480 |
#$conf["allowAnySSLcertificate"],字串,是否允許不可信任的SSL憑證,預設為"true".
|
|
|
1481 |
#$conf["allowAnySSLcertificate"]="";
|
|
|
1482 |
#$conf["postVar"],字串陣列,每個要傳送的post變數名稱(陣列的key值)與數值.
|
|
|
1483 |
#$conf["postVar"]=array();
|
|
|
1484 |
#$conf["rawPost"]="字串",要傳送的raw post內容.
|
|
|
1485 |
#$conf["rawPost"]="";
|
|
|
1486 |
#$conf["urlEncode"],字串,post的內容是否要url_encode,"true"代表要,預設為"false"代表不要.
|
|
|
1487 |
#$conf["urlEncode"]="false";
|
|
|
1488 |
#$conf["agent"],字串,user agent的名稱.
|
|
|
1489 |
$conf["catchWebContent::curlCmd"]["agent"]="qbpwcf";
|
|
|
1490 |
#$conf["cookie"],字串,cookie位置與檔案位置.
|
|
|
1491 |
#$conf["cookie"]="";
|
|
|
1492 |
#$conf["forceNewCookie"],字串,是否要重置cookie,"true"代表要,"false"代表不要,預設為"false".
|
|
|
1493 |
#$conf["forceNewCookie"]="";
|
|
|
1494 |
#備註:
|
|
|
1495 |
#無.
|
|
|
1496 |
$curlCmd=catchWebContent::curlCmd($conf["catchWebContent::curlCmd"]);
|
|
|
1497 |
unset($conf["catchWebContent::curlCmd"]);
|
|
|
1498 |
|
|
|
1499 |
#如果執行失敗
|
|
|
1500 |
if($curlCmd["status"]==="false"){
|
| 226 |
liveuser |
1501 |
|
| 3 |
liveuser |
1502 |
#設置執行不正常
|
|
|
1503 |
$result ["status"]="false";
|
|
|
1504 |
|
|
|
1505 |
#設置執行錯誤
|
|
|
1506 |
$result["error"]=$curlCmd;
|
|
|
1507 |
|
|
|
1508 |
#回傳結果
|
|
|
1509 |
return $result;
|
| 226 |
liveuser |
1510 |
|
| 3 |
liveuser |
1511 |
}#if end
|
|
|
1512 |
|
|
|
1513 |
#xml字串
|
|
|
1514 |
$xmlStr="";
|
|
|
1515 |
|
|
|
1516 |
#如果有xml內容
|
|
|
1517 |
if(count($curlCmd["content"])>1){
|
| 226 |
liveuser |
1518 |
|
| 3 |
liveuser |
1519 |
#針對每行輸出
|
|
|
1520 |
for($i=0;$i<count($curlCmd["content"]);$i++){
|
| 226 |
liveuser |
1521 |
|
| 3 |
liveuser |
1522 |
#傳接xml內容
|
|
|
1523 |
$xmlStr=$xmlStr.$curlCmd["content"][$i];
|
| 226 |
liveuser |
1524 |
|
| 3 |
liveuser |
1525 |
}#for end
|
| 226 |
liveuser |
1526 |
|
| 3 |
liveuser |
1527 |
}#if end
|
|
|
1528 |
|
|
|
1529 |
#涵式說明:
|
|
|
1530 |
#解析xml字串.
|
|
|
1531 |
#回傳結果:
|
|
|
1532 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
|
|
1533 |
#$reuslt["error"],執行不正常結束的錯訊息陣列.
|
|
|
1534 |
#$result["function"],當前執行的函式名稱.
|
|
|
1535 |
#$result["content"],xml物件.
|
|
|
1536 |
#$result["xmlStr"],xml格式的內容.
|
|
|
1537 |
#必填參數:
|
|
|
1538 |
#$conf["xmlString"],字串,要解析的xml字串.
|
|
|
1539 |
$conf["xml::parseXMLstring"]["xmlString"]=$xmlStr;
|
|
|
1540 |
#可省略參數:
|
|
|
1541 |
#無.
|
|
|
1542 |
#備註:
|
|
|
1543 |
#無.
|
|
|
1544 |
$parseXMLstring=xml::parseXMLstring($conf["xml::parseXMLstring"]);
|
|
|
1545 |
unset($conf["xml::parseXMLstring"]);
|
|
|
1546 |
|
|
|
1547 |
#如果解析失敗
|
|
|
1548 |
if($parseXMLstring["status"]==="false"){
|
| 226 |
liveuser |
1549 |
|
| 3 |
liveuser |
1550 |
#設置執行不正常
|
|
|
1551 |
$result["status"]="false";
|
|
|
1552 |
|
|
|
1553 |
#設置執行錯誤
|
|
|
1554 |
$result["error"]=$parseXMLstring;
|
|
|
1555 |
|
|
|
1556 |
#回傳結果
|
|
|
1557 |
return $result;
|
| 226 |
liveuser |
1558 |
|
| 3 |
liveuser |
1559 |
}#if end
|
| 226 |
liveuser |
1560 |
|
| 3 |
liveuser |
1561 |
#取得xml物件的內容
|
|
|
1562 |
$result["content"]=$parseXMLstring["content"];
|
|
|
1563 |
|
|
|
1564 |
#取得回應的xml格式內容
|
|
|
1565 |
$result["xml"]=$parseXMLstring["xmlStr"];
|
|
|
1566 |
|
|
|
1567 |
#設置執行正常
|
|
|
1568 |
$result["status"]="true";
|
| 226 |
liveuser |
1569 |
|
| 3 |
liveuser |
1570 |
#回傳結果
|
|
|
1571 |
return $result;
|
| 226 |
liveuser |
1572 |
|
| 3 |
liveuser |
1573 |
}#function getRecord end
|
|
|
1574 |
|
|
|
1575 |
}#class bigbluebutton end
|
|
|
1576 |
|
|
|
1577 |
?>
|