joisarjignesh /
bigbluebutton
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace JoisarJignesh\Bigbluebutton; |
||
| 4 | |||
| 5 | use BigBlueButton\BigBlueButton; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use BigBlueButton\Parameters\CreateMeetingParameters; |
||
| 7 | use BigBlueButton\Parameters\DeleteRecordingsParameters; |
||
| 8 | use BigBlueButton\Parameters\EndMeetingParameters; |
||
| 9 | use BigBlueButton\Parameters\GetMeetingInfoParameters; |
||
| 10 | use BigBlueButton\Parameters\GetRecordingsParameters; |
||
| 11 | use BigBlueButton\Parameters\HooksCreateParameters; |
||
| 12 | use BigBlueButton\Parameters\HooksDestroyParameters; |
||
| 13 | use BigBlueButton\Parameters\IsMeetingRunningParameters; |
||
| 14 | use BigBlueButton\Parameters\JoinMeetingParameters; |
||
| 15 | use BigBlueButton\Parameters\PublishRecordingsParameters; |
||
| 16 | use BigBlueButton\Parameters\SetConfigXMLParameters; |
||
| 17 | use JoisarJignesh\Bigbluebutton\Bigbluebutton as BigBlueButtonServer; |
||
| 18 | use JoisarJignesh\Bigbluebutton\Services\InitConfigXml; |
||
| 19 | use JoisarJignesh\Bigbluebutton\Services\InitExtra; |
||
| 20 | use JoisarJignesh\Bigbluebutton\Services\InitHooks; |
||
| 21 | use JoisarJignesh\Bigbluebutton\Services\InitMeeting; |
||
| 22 | use JoisarJignesh\Bigbluebutton\Services\InitRecordings; |
||
| 23 | |||
| 24 | class Bbb |
||
| 25 | { |
||
| 26 | use InitMeeting, |
||
| 27 | InitRecordings, |
||
| 28 | InitHooks, |
||
| 29 | InitConfigXml, |
||
| 30 | InitExtra; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var |
||
| 34 | */ |
||
| 35 | private $response; |
||
| 36 | /** |
||
| 37 | * @var BigBlueButton |
||
| 38 | */ |
||
| 39 | protected $bbb; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Bbb constructor. |
||
| 43 | * |
||
| 44 | * @param BigBlueButton $bbb |
||
| 45 | */ |
||
| 46 | public function __construct(BigBlueButton $bbb) |
||
| 47 | { |
||
| 48 | $this->bbb = $bbb; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * for specific server instance. |
||
| 53 | * |
||
| 54 | * @param $serverName |
||
| 55 | * |
||
| 56 | * @return Bbb |
||
| 57 | * @throws \Exception |
||
| 58 | */ |
||
| 59 | public function server($serverName) |
||
| 60 | { |
||
| 61 | if (is_null(config("bigbluebutton.servers.{$serverName}", null))) { |
||
| 62 | throw new \Exception("Could not found {$serverName} server configuration in config file"); |
||
| 63 | } |
||
| 64 | |||
| 65 | return new self( |
||
| 66 | new BigBlueButtonServer( |
||
| 67 | config("bigbluebutton.servers.{$serverName}.BBB_SERVER_BASE_URL"), |
||
| 68 | config("bigbluebutton.servers.{$serverName}.BBB_SECURITY_SALT") |
||
| 69 | ) |
||
| 70 | ); |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @return self |
||
| 75 | */ |
||
| 76 | public function make() |
||
| 77 | { |
||
| 78 | return $this; |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @return BigBlueButton |
||
| 83 | */ |
||
| 84 | public function source() |
||
| 85 | { |
||
| 86 | return $this->bbb; |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * check url and secret is working. |
||
| 91 | * @return bool |
||
| 92 | */ |
||
| 93 | public function isConnect() |
||
| 94 | { |
||
| 95 | $response = $this->initIsConnect(); |
||
| 96 | if ($response['flag'] === true) { |
||
| 97 | return true; |
||
| 98 | } |
||
| 99 | |||
| 100 | return false; |
||
| 101 | } |
||
| 102 | |||
| 103 | /** |
||
| 104 | * Return a list of all meetings. |
||
| 105 | * |
||
| 106 | * @return \Illuminate\Support\Collection |
||
| 107 | */ |
||
| 108 | public function all() |
||
| 109 | { |
||
| 110 | $this->response = $this->bbb->getMeetings(); |
||
| 111 | View Code Duplication | if ($this->response->success()) { |
|
| 112 | if (! is_null($this->response->getRawXml()->meetings->meeting) && count($this->response->getRawXml()->meetings->meeting) > 0) { |
||
| 113 | $meetings = []; |
||
| 114 | foreach ($this->response->getRawXml()->meetings->meeting as $meeting) { |
||
| 115 | $meetings[] = XmlToArray($meeting); |
||
| 116 | } |
||
| 117 | |||
| 118 | return collect(XmlToArray($meetings)); |
||
| 119 | } |
||
| 120 | } |
||
| 121 | |||
| 122 | return collect([]); |
||
| 123 | } |
||
| 124 | |||
| 125 | /** |
||
| 126 | * $meeting. |
||
| 127 | * |
||
| 128 | * @param $meeting |
||
| 129 | * |
||
| 130 | * required fields |
||
| 131 | * meetingID |
||
| 132 | * meetingName |
||
| 133 | * |
||
| 134 | * @return mixed |
||
| 135 | */ |
||
| 136 | View Code Duplication | public function create($meeting) |
|
| 137 | { |
||
| 138 | if (! $meeting instanceof CreateMeetingParameters) { |
||
| 139 | $meeting = $this->initCreateMeeting($meeting); |
||
| 140 | } |
||
| 141 | |||
| 142 | $this->response = $this->bbb->createMeeting($meeting); |
||
| 143 | if ($this->response->failed()) { |
||
| 144 | return $this->response->getMessage(); |
||
| 145 | } else { |
||
| 146 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 147 | } |
||
| 148 | } |
||
| 149 | |||
| 150 | /** |
||
| 151 | * @param $meeting |
||
| 152 | * |
||
| 153 | * required fields: |
||
| 154 | * meetingID |
||
| 155 | * |
||
| 156 | * @return bool |
||
| 157 | */ |
||
| 158 | View Code Duplication | public function isMeetingRunning($meeting) |
|
| 159 | { |
||
| 160 | if (! $meeting instanceof IsMeetingRunningParameters) { |
||
| 161 | $meeting = $this->initIsMeetingRunning($meeting); |
||
| 162 | } |
||
| 163 | |||
| 164 | $this->response = $this->bbb->isMeetingRunning($meeting); |
||
| 165 | if ($this->response->success()) { |
||
| 166 | $response = XmlToArray($this->response->getRawXml()); |
||
| 167 | if (isset($response['running']) && $response['running'] == 'true') { |
||
| 168 | return true; |
||
| 169 | } |
||
| 170 | } |
||
| 171 | |||
| 172 | return false; |
||
| 173 | } |
||
| 174 | |||
| 175 | /** |
||
| 176 | * Join meeting. |
||
| 177 | * |
||
| 178 | * @param $meeting |
||
| 179 | * required fields |
||
| 180 | * |
||
| 181 | * meetingID |
||
| 182 | * userName join by name |
||
| 183 | * password which role want to join |
||
| 184 | * |
||
| 185 | * @return string |
||
| 186 | */ |
||
| 187 | public function join($meeting) |
||
| 188 | { |
||
| 189 | if (! $meeting instanceof JoinMeetingParameters) { |
||
| 190 | $meeting = $this->initJoinMeeting($meeting); |
||
| 191 | } |
||
| 192 | |||
| 193 | if ($meeting->isRedirect()) { |
||
| 194 | return $this->bbb->getJoinMeetingURL($meeting); |
||
| 195 | } |
||
| 196 | |||
| 197 | return $this->bbb->joinMeeting($meeting)->getUrl(); |
||
| 198 | } |
||
| 199 | |||
| 200 | /** |
||
| 201 | * Returns information about the meeting. |
||
| 202 | * |
||
| 203 | * @param $meeting |
||
| 204 | * required fields |
||
| 205 | * meetingID |
||
| 206 | * moderatorPW must be there moderator password |
||
| 207 | * |
||
| 208 | * @return \Illuminate\Support\Collection |
||
| 209 | */ |
||
| 210 | View Code Duplication | public function getMeetingInfo($meeting) |
|
| 211 | { |
||
| 212 | if (! $meeting instanceof GetMeetingInfoParameters) { |
||
| 213 | $meeting = $this->initGetMeetingInfo($meeting); |
||
| 214 | } |
||
| 215 | |||
| 216 | $this->response = $this->bbb->getMeetingInfo($meeting); |
||
| 217 | if ($this->response->success()) { |
||
| 218 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 219 | } |
||
| 220 | |||
| 221 | return collect([]); |
||
| 222 | } |
||
| 223 | |||
| 224 | /** |
||
| 225 | * @param $parameters |
||
| 226 | * |
||
| 227 | * required fields |
||
| 228 | * meetingID |
||
| 229 | * meetingName |
||
| 230 | * userName |
||
| 231 | * attendeePW |
||
| 232 | * moderatorPW |
||
| 233 | * |
||
| 234 | * @return mixed |
||
| 235 | */ |
||
| 236 | public function start($parameters) |
||
| 237 | { |
||
| 238 | return $this->initStart($parameters); |
||
| 239 | } |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Close meeting. |
||
| 243 | * |
||
| 244 | * @param $meeting |
||
| 245 | * required fields: |
||
| 246 | * meetingID |
||
| 247 | * moderatorPW close meeting must be there moderator password |
||
| 248 | * |
||
| 249 | * @return bool |
||
| 250 | */ |
||
| 251 | public function close($meeting) |
||
| 252 | { |
||
| 253 | if (! $meeting instanceof EndMeetingParameters) { |
||
| 254 | $meeting = $this->initCloseMeeting($meeting); |
||
| 255 | } |
||
| 256 | |||
| 257 | $this->response = $this->bbb->endMeeting($meeting); |
||
| 258 | if ($this->response->success()) { |
||
| 259 | return true; |
||
| 260 | } |
||
| 261 | |||
| 262 | return false; |
||
| 263 | } |
||
| 264 | |||
| 265 | /** |
||
| 266 | * @param $recording |
||
| 267 | * required fields |
||
| 268 | * meetingID |
||
| 269 | * |
||
| 270 | * optional fields |
||
| 271 | * recordID |
||
| 272 | * state |
||
| 273 | * |
||
| 274 | * @return \Illuminate\Support\Collection |
||
| 275 | */ |
||
| 276 | public function getRecordings($recording) |
||
| 277 | { |
||
| 278 | if (! $recording instanceof GetRecordingsParameters) { |
||
| 279 | $recording = $this->initGetRecordings($recording); |
||
| 280 | } |
||
| 281 | |||
| 282 | $this->response = $this->bbb->getRecordings($recording); |
||
| 283 | View Code Duplication | if ($this->response->success() && ! is_null($this->response->getRawXml()->recordings->recording) && count($this->response->getRawXml()->recordings->recording) > 0) { |
|
| 284 | $recordings = []; |
||
| 285 | foreach ($this->response->getRawXml()->recordings->recording as $r) { |
||
| 286 | $recordings[] = XmlToArray($r); |
||
| 287 | } |
||
| 288 | |||
| 289 | return collect($recordings); |
||
| 290 | } |
||
| 291 | |||
| 292 | return collect([]); |
||
| 293 | } |
||
| 294 | |||
| 295 | /** |
||
| 296 | * @param $recording |
||
| 297 | * recordID as string(separated by comma) |
||
| 298 | * publish as bool |
||
| 299 | * |
||
| 300 | * @return bool |
||
| 301 | */ |
||
| 302 | View Code Duplication | public function publishRecordings($recording) |
|
| 303 | { |
||
| 304 | if (! $recording instanceof PublishRecordingsParameters) { |
||
| 305 | $recording = $this->initPublishRecordings($recording); |
||
| 306 | } |
||
| 307 | |||
| 308 | $this->response = $this->bbb->publishRecordings($recording); |
||
| 309 | if ($this->response->success()) { |
||
| 310 | $response = XmlToArray($this->response->getRawXml()); |
||
| 311 | if (isset($response['published']) && $response['published'] == 'true') { |
||
| 312 | return true; |
||
| 313 | } |
||
| 314 | } |
||
| 315 | |||
| 316 | return false; |
||
| 317 | } |
||
| 318 | |||
| 319 | /** |
||
| 320 | * @param $recording |
||
| 321 | * |
||
| 322 | * required fields |
||
| 323 | * recordingID |
||
| 324 | * |
||
| 325 | * @return \Illuminate\Support\Collection |
||
| 326 | */ |
||
| 327 | public function deleteRecordings($recording) |
||
| 328 | { |
||
| 329 | if (! $recording instanceof DeleteRecordingsParameters) { |
||
| 330 | $recording = $this->initDeleteRecordings($recording); |
||
| 331 | } |
||
| 332 | |||
| 333 | $this->response = $this->bbb->deleteRecordings($recording); |
||
| 334 | |||
| 335 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 336 | } |
||
| 337 | |||
| 338 | /** |
||
| 339 | * @param $configXml |
||
| 340 | * |
||
| 341 | * @return \Illuminate\Support\Collection |
||
| 342 | * @throws \Exception |
||
| 343 | */ |
||
| 344 | public function setConfigXml($configXml) |
||
| 345 | { |
||
| 346 | if (! $configXml instanceof SetConfigXMLParameters) { |
||
| 347 | $configXml = $this->initSetConfigXml($configXml); |
||
| 348 | } |
||
| 349 | |||
| 350 | $this->response = $this->bbb->setConfigXML($configXml); |
||
| 351 | |||
| 352 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 353 | } |
||
| 354 | |||
| 355 | /** |
||
| 356 | * @return \BigBlueButton\Responses\GetDefaultConfigXMLResponse |
||
| 357 | */ |
||
| 358 | public function getDefaultConfigXml() |
||
| 359 | { |
||
| 360 | $this->response = $this->bbb->getDefaultConfigXML(); |
||
| 361 | |||
| 362 | return $this->response; |
||
| 363 | } |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @return \Illuminate\Support\Collection |
||
| 367 | */ |
||
| 368 | public function getApiVersion() |
||
| 369 | { |
||
| 370 | $this->response = $this->bbb->getApiVersion(); |
||
| 371 | |||
| 372 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 373 | } |
||
| 374 | |||
| 375 | /** |
||
| 376 | * @param $hooks |
||
| 377 | * |
||
| 378 | * @return \Illuminate\Support\Collection |
||
| 379 | */ |
||
| 380 | public function hooksCreate($hooks) |
||
| 381 | { |
||
| 382 | if (! $hooks instanceof HooksCreateParameters) { |
||
| 383 | $hooks = $this->initHooksCreate($hooks); |
||
| 384 | } |
||
| 385 | |||
| 386 | $this->response = $this->bbb->hooksCreate($hooks); |
||
| 387 | |||
| 388 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 389 | } |
||
| 390 | |||
| 391 | /** |
||
| 392 | * @param $hooks |
||
| 393 | * |
||
| 394 | * @return \Illuminate\Support\Collection |
||
| 395 | */ |
||
| 396 | public function hooksDestroy($hooks) |
||
| 397 | { |
||
| 398 | if (! $hooks instanceof HooksDestroyParameters) { |
||
| 399 | $hooks = $this->initHooksDestroy($hooks); |
||
| 400 | } |
||
| 401 | |||
| 402 | $this->response = $this->bbb->hooksDestroy($hooks); |
||
| 403 | |||
| 404 | return collect(XmlToArray($this->response->getRawXml())); |
||
| 405 | } |
||
| 406 | } |
||
| 407 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: