source: spip-zone/_plugins_/bigbluebutton/bbb_api.php @ 84157

Last change on this file since 84157 was 43038, checked in by cyp@…, 10 years ago

Première importation du plugin

File size: 24.3 KB
Line 
1<?php
2/*
3Copyright 2010 Blindside Networks
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19Versions:
20   1.0  --  Initial version written by DJP
21                   (email: djp [a t ]  architectes DOT .org)
22   1.1  --  Updated by Omar Shammas and Sebastian Schneider
23                    (email : omar DOT shammas [a t ] g m ail DOT com)
24                    (email : seb DOT sschneider [ a t ] g m ail DOT com)
25   1.2  --  Updated by Omar Shammas
26                    (email : omar DOT shammas [a t ] g m ail DOT com)
27*/
28
29function bbb_wrap_simplexml_load_file($url){
30
31        if (extension_loaded('curl')) {
32                $ch = curl_init() or die ( curl_error() );
33                $timeout = 10;
34                curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
35                curl_setopt( $ch, CURLOPT_URL, $url );
36                curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
37                curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
38                $data = curl_exec( $ch );
39                curl_close( $ch );
40
41                if($data)
42                        return (new SimpleXMLElement($data));
43                else
44                        return false;
45        }
46
47        return (simplexml_load_file($url));
48}
49
50
51
52/*
53@param
54$userName = userName AND meetingID (string)
55$welcomeString = welcome message (string)
56
57$modPW = moderator password (string)
58$vPW = viewer password (string)
59$voiceBridge = voice bridge (integer)
60$logout = logout url (url)
61*/
62// create a meeting and return the url to join as moderator
63
64
65// TODO::
66// create some set methods
67class BigBlueButton {
68
69        var $userName = array();
70        var $meetingID; // the meeting id
71
72        var $welcomeString;
73        // the next 2 fields are maybe not needed?!?
74        var $modPW; // the moderator password
75        var $attPW; // the attendee pw
76
77        var $securitySalt; // the security salt; gets encrypted with sha1
78        var $URL; // the url the bigbluebutton server is installed
79        var $sessionURL; // the url for the administrator to join the sessoin
80        var $userURL;
81
82        var $conferenceIsRunning = false;
83
84        // this constructor is used to create a BigBlueButton Object
85        // use this object to create servers
86        // Use is either 0 arguments or all 7 arguments
87        public function __construct() {
88                $numargs = func_num_args();
89
90                if( $numargs == 0 ) {
91                #       echo "Constructor created";
92                }
93                // pass the information to the class variables
94                else if( $numargs >= 6 ) {
95                        $this->userName = func_get_arg(0);
96                        $this->meetingID = func_get_arg(1);
97                        $this->welcomeString = func_get_arg(2);
98                        $this->modPW = func_get_arg(3);
99                        $this->attPW = func_get_arg(4);
100                        $this->securitySalt = func_get_arg(5);
101                        $this->URL = func_get_arg(6);
102
103
104                        $arg_list = func_get_args();
105                        #debug output for the number of arguments
106                        #       for ($i = 0; $i < $numargs; $i++) {
107                        #               echo "Argument $i is: " . $arg_list[$i] . "<br />\n";
108                        #       }
109
110                        //    $this->createMeeting( $this->userName, $this->meetingID, $this->welcomeString, $this->modPW, $this->attPW, $this->securitySalt, $this->URL );
111                         //   echo "Object created";
112                        //       echo '<br />';
113                }// end else if
114        }
115
116        //------------------------------------------------GET URLs-------------------------------------------------
117        /**
118        *This method returns the url to join the specified meeting.
119        *
120        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
121        *@param username -- the display name to be used when the user joins the meeting
122        *@param PW -- the attendee or moderator password of the meeting
123        *@param SALT -- the security salt of the bigbluebutton server
124        *@param URL -- the url of the bigbluebutton server
125        *
126        *@return The url to join the meeting
127        */
128        public function joinURL( $meetingID, $userName, $PW, $SALT, $URL ) {
129                $url_join = $URL."api/join?";
130                $params = 'meetingID='.urlencode($meetingID).'&fullName='.urlencode($userName).'&password='.urlencode($PW);
131                return ($url_join.$params.'&checksum='.sha1("join".$params.$SALT) );
132        }
133
134
135        /**
136        *This method returns the url to join the specified meeting.
137        *
138        *@param name -- a name fot the meeting
139        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
140        *@param attendeePW -- the attendee of the meeting
141        *@param moderatorPW -- the moderator of the meeting
142        *@param welcome -- the welcome message that gets displayed on the chat window
143        *@param logoutURL -- the URL that the bbb client will go to after users logouut
144        *@param SALT -- the security salt of the bigbluebutton server
145        *@param URL -- the url of the bigbluebutton server
146        *
147        *@return The url to join the meeting
148        */
149        public function createMeetingURL($name, $meetingID, $attendeePW, $moderatorPW, $welcome, $logoutURL, $SALT, $URL ) {
150                $url_create = $URL."api/create?";
151                $voiceBridge = 70000 + rand(0, 9999);
152
153                $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&voiceBridge='.$voiceBridge.'&logoutURL='.urlencode($logoutURL);
154
155                if( trim( $welcome ) )
156                        $params .= '&welcome='.urlencode($welcome);
157
158                return ( $url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
159        }
160
161
162        /**
163        *This method returns the url to check if the specified meeting is running.
164        *
165        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
166        *@param SALT -- the security salt of the bigbluebutton server
167        *@param URL -- the url of the bigbluebutton server
168        *
169        *@return The url to check if the specified meeting is running.
170        */
171        public function isMeetingRunningURL( $meetingID, $URL, $SALT ) {
172                $base_url = $URL."api/isMeetingRunning?";
173                $params = 'meetingID='.urlencode($meetingID);
174                return ($base_url.$params.'&checksum='.sha1("isMeetingRunning".$params.$SALT) );
175        }
176
177        /**
178        *This method returns the url to getMeetingInfo of the specified meeting.
179        *
180        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
181        *@param modPW -- the moderator password of the meeting
182        *@param SALT -- the security salt of the bigbluebutton server
183        *@param URL -- the url of the bigbluebutton server
184        *
185        *@return The url to check if the specified meeting is running.
186        */
187        public function getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) {
188                $base_url = $URL."api/getMeetingInfo?";
189                $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
190                return ( $base_url.$params.'&checksum='.sha1("getMeetingInfo".$params.$SALT));
191        }
192
193        /**
194        *This method returns the url for listing all meetings in the bigbluebutton server.
195        *
196        *@param SALT -- the security salt of the bigbluebutton server
197        *@param URL -- the url of the bigbluebutton server
198        *
199        *@return The url of getMeetings.
200        */
201        public function getMeetingsURL($URL, $SALT) {
202                $base_url = $URL."api/getMeetings?";
203                $params = 'random='.(rand() * 1000 );
204                return ( $base_url.$params.'&checksum='.sha1("getMeetings".$params.$SALT));
205        }
206
207        /**
208        *This method returns the url to end the specified meeting.
209        *
210        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
211        *@param modPW -- the moderator password of the meeting
212        *@param SALT -- the security salt of the bigbluebutton server
213        *@param URL -- the url of the bigbluebutton server
214        *
215        *@return The url to end the specified meeting.
216        */
217        public function endMeetingURL( $meetingID, $modPW, $URL, $SALT ) {
218                $base_url = $URL."api/end?";
219                $params = 'meetingID='.urlencode($meetingID).'&password='.urlencode($modPW);
220                return ( $base_url.$params.'&checksum='.sha1("end".$params.$SALT) );
221        }
222
223        //-----------------------------------------------CREATE----------------------------------------------------
224        /**
225        *This method creates a meeting and returnS the join url for moderators.
226        *
227        *@param username
228        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
229        *@param welcomeString -- the welcome message to be displayed when a user logs in to the meeting
230        *@param mPW -- the moderator password of the meeting
231        *@param aPW -- the attendee password of the meeting
232        *@param SALT -- the security salt of the bigbluebutton server
233        *@param URL -- the url of the bigbluebutton server
234        *@param logoutURL -- the url the user should be redirected to when they logout of bigbluebutton
235        *
236        *@return The joinURL if successful or an error message if unsuccessful
237        */
238        public function createMeetingAndGetJoinURL( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL ) {
239
240                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::createMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL ) );
241
242                if( $xml && $xml->returncode == 'SUCCESS' ) {
243                        return ( BigBlueButton::joinURL( $meetingID, $username, $mPW, $SALT, $URL ) );
244                }
245                else if( $xml ) {
246                        return ( $xml->messageKey.' : '.$xml->message );
247                }
248                else {
249                        return ('Unable to fetch URL '.$url_create.$params.'&checksum='.sha1("create".$params.$SALT) );
250                }
251        }
252
253        /**
254        *This method creates a meeting and return an array of the xml packet
255        *
256        *@param username
257        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
258        *@param welcomeString -- the welcome message to be displayed when a user logs in to the meeting
259        *@param mPW -- the moderator password of the meeting
260        *@param aPW -- the attendee password of the meeting
261        *@param SALT -- the security salt of the bigbluebutton server
262        *@param URL -- the url of the bigbluebutton server
263        *@param logoutURL -- the url the user should be redirected to when they logout of bigbluebutton
264        *
265        *@return
266        *       - Null if unable to reach the bigbluebutton server
267        *       - If failed it returns an array containing a returncode, messageKey, message.
268        *       - If success it returns an array containing a returncode, messageKey, message, meetingID, attendeePW, moderatorPW, hasBeenForciblyEnded.
269        */
270        public function createMeetingArray( $username, $meetingID, $welcomeString, $mPW, $aPW, $SALT, $URL, $logoutURL ) {
271
272                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::createMeetingURL($username, $meetingID, $aPW, $mPW, $welcomeString, $logoutURL, $SALT, $URL ) );
273
274                if( $xml ) {
275                        if($xml->meetingID) return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
276                        else return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
277                }
278                else {
279                        return null;
280                }
281        }
282
283        //-------------------------------------------getMeetingInfo---------------------------------------------------
284        /**
285        *This method calls the getMeetingInfo on the bigbluebutton server and returns an xml packet.
286        *
287        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
288        *@param modPW -- the moderator password of the meeting
289        *@param SALT -- the security salt of the bigbluebutton server
290        *@param URL -- the url of the bigbluebutton server
291        *
292        *@return An xml packet.
293        *       If failed it returns an xml packet containing a returncode, messagekey, and message.
294        *       If success it returnsan xml packet containing a returncode,
295        */
296        public function getMeetingInfo( $meetingID, $modPW, $URL, $SALT ) {
297                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
298                if($xml){
299                        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
300                }
301                return false;
302        }
303
304        /**
305        *This method calls the getMeetingInfo on the bigbluebutton server and returns an array.
306        *
307        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
308        *@param modPW -- the moderator password of the meeting
309        *@param SALT -- the security salt of the bigbluebutton server
310        *@param URL -- the url of the bigbluebutton server
311        *
312        *@return An Array.
313        *       - Null if unable to reach the bigbluebutton server
314        *       - If failed it returns an array containing a returncode, messagekey, message.
315        *       - If success it returns an array containing a meetingID, moderatorPW, attendeePW, hasBeenForciblyEnded, running, startTime, endTime,
316                  participantCount, moderatorCount, attendees.
317        */
318        public function getMeetingInfoArray( $meetingID, $modPW, $URL, $SALT ) {
319                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
320
321                if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null){//The meetings were returned
322                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
323                }
324                else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
325                        return array( 'meetingID' => $xml->meetingID, 'moderatorPW' => $xml->moderatorPW, 'attendeePW' => $xml->attendeePW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded, 'running' => $xml->running, 'startTime' => $xml->startTime, 'endTime' => $xml->endTime, 'participantCount' => $xml->participantCount, 'moderatorCount' => $xml->moderatorCount, 'attendees' => $xml->attendees );
326                }
327                else if( ($xml && $xml->returncode == 'FAILED') || $xml) { //If the xml packet returned failure it displays the message to the user
328                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
329                }
330                else { //If the server is unreachable, then prompts the user of the necessary action
331                        return null;
332                }
333
334        }
335
336        //-----------------------------------------------getMeetings------------------------------------------------------
337        /**
338        *This method calls getMeetings on the bigbluebutton server, then calls getMeetingInfo for each meeting and concatenates the result.
339        *
340        *@param URL -- the url of the bigbluebutton server
341        *@param SALT -- the security salt of the bigbluebutton server
342        *
343        *@return
344        *       - If failed then returns a boolean of false.
345        *       - If succeeded then returns an xml of all the meetings.
346        */
347        public function getMeetings( $URL, $SALT ) {
348                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingsURL( $URL, $SALT ) );
349                if( $xml && $xml->returncode == 'SUCCESS' ) {
350                        if( $xml->messageKey )
351                                return ( $xml->message->asXML() );
352                        ob_start();
353                        echo '<meetings>';
354                        if( count( $xml->meetings ) && count( $xml->meetings->meeting ) ) {
355                                foreach ($xml->meetings->meeting as $meeting)
356                                {
357                                        echo '<meeting>';
358                                        echo BigBlueButton::getMeetingInfo($meeting->meetingID, $meeting->moderatorPW, $URL, $SALT);
359                                        echo '</meeting>';
360                                }
361                        }
362                        echo '</meetings>';
363                        return (ob_get_clean());
364                }
365                else {
366                        return (false);
367                }
368        }
369
370        /**
371        *This method calls getMeetings on the bigbluebutton server, then calls getMeetingInfo for each meeting and concatenates the result.
372        *
373        *@param URL -- the url of the bigbluebutton server
374        *@param SALT -- the security salt of the bigbluebutton server
375        *
376        *@return
377        *       - Null if the server is unreachable
378        *       - If FAILED then returns an array containing a returncode, messageKey, message.
379        *       - If SUCCESS then returns an array of all the meetings. Each element in the array is an array containing a meetingID,
380                  moderatorPW, attendeePW, hasBeenForciblyEnded, running.
381        */
382        public function getMeetingsArray( $URL, $SALT ) {
383                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingsURL( $URL, $SALT ) );
384
385                if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey ) {//The meetings were returned
386                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
387                }
388                else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
389
390                        foreach ($xml->meetings->meeting as $meeting)
391                        {
392            //$meetings[] = BigBlueButton::getMeetingInfo($meeting->meetingID, $meeting->moderatorPW, $URL, $SALT);
393                                $meetings[] = array( 'meetingID' => $meeting->meetingID, 'moderatorPW' => $meeting->moderatorPW, 'attendeePW' => $meeting->attendeePW, 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded, 'running' => $meeting->running );
394                        }
395
396                        return $meetings;
397
398                }
399                else if( $xml ) { //If the xml packet returned failure it displays the message to the user
400                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
401                }
402                else { //If the server is unreachable, then prompts the user of the necessary action
403                        return null;
404                }
405        }
406
407        //----------------------------------------------getUsers---------------------------------------
408        /**
409        *This method prints the usernames of the attendees in the specified conference.
410        *
411        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
412        *@param modPW -- the moderator password of the meeting
413        *@param URL -- the url of the bigbluebutton server
414        *@param SALT -- the security salt of the bigbluebutton server
415        *@param UNAME -- is a boolean to determine how the username is formatted when printed. Default if false.
416        *
417        *@return A boolean of true if the attendees were printed successfully and false otherwise.
418        */
419        public function getUsers( $meetingID, $modPW, $URL, $SALT, $UNAME = false ) {
420                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
421                if( $xml && $xml->returncode == 'SUCCESS' ) {
422                        ob_start();
423                        if( count( $xml->attendees ) && count( $xml->attendees->attendee ) ) {
424                                foreach ( $xml->attendees->attendee as $attendee ) {
425                                        if( $UNAME  == true ) {
426                                                echo "User name: ".$attendee->fullName.'<br />';
427                                        }
428                                        else {
429                                                echo $attendee->fullName.'<br />';
430                                        }
431                                }
432                        }
433                        return (ob_end_flush());
434                }
435                else {
436                        return (false);
437                }
438        }
439
440        /**
441        *This method returns an array of the attendees in the specified meeting.
442        *
443        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
444        *@param modPW -- the moderator password of the meeting
445        *@param URL -- the url of the bigbluebutton server
446        *@param SALT -- the security salt of the bigbluebutton server
447        *
448        *@return
449        *       - Null if the server is unreachable.
450        *       - If FAILED, returns an array containing a returncode, messageKey, message.
451        *       - If SUCCESS, returns an array of array containing the userID, fullName, role of each attendee
452        */
453        public function getUsersArray( $meetingID, $modPW, $URL, $SALT ) {
454                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::getMeetingInfoURL( $meetingID, $modPW, $URL, $SALT ) );
455
456                if( $xml && $xml->returncode == 'SUCCESS' && $xml->messageKey == null ) {//The meetings were returned
457                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
458                }
459                else if($xml && $xml->returncode == 'SUCCESS'){ //If there were meetings already created
460                        foreach ($xml->attendees->attendee as $attendee){
461                                        $users[] = array(  'userID' => $attendee->userID, 'fullName' => $attendee->fullName, 'role' => $attendee->role );
462                        }
463                        return $users;
464                }
465                else if( $xml ) { //If the xml packet returned failure it displays the message to the user
466                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
467                }
468                else { //If the server is unreachable, then prompts the user of the necessary action
469                        return null;
470                }
471        }
472
473
474        //------------------------------------------------Other Methods------------------------------------
475        /**
476        *This method calls end meeting on the specified meeting in the bigbluebutton server.
477        *
478        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
479        *@param modPW -- the moderator password of the meeting
480        *@param SALT -- the security salt of the bigbluebutton server
481        *@param URL -- the url of the bigbluebutton server
482        *
483        *@return
484        *       - Null if the server is unreachable
485        *       - An array containing a returncode, messageKey, message.
486        */
487        public function endMeeting( $meetingID, $modPW, $URL, $SALT ) {
488                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::endMeetingURL( $meetingID, $modPW, $URL, $SALT ) );
489
490                if( $xml ) { //If the xml packet returned failure it displays the message to the user
491                        return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
492                }
493                else { //If the server is unreachable, then prompts the user of the necessary action
494                        return null;
495                }
496
497        }
498
499        /**
500        *This method check the BigBlueButton server to see if the meeting is running (i.e. there is someone in the meeting)
501        *
502        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
503        *@param SALT -- the security salt of the bigbluebutton server
504        *@param URL -- the url of the bigbluebutton server
505        *
506        *@return A boolean of true if the meeting is running and false if it is not running
507        */
508        public function isMeetingRunning( $meetingID, $URL, $SALT ) {
509                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::isMeetingRunningURL( $meetingID, $URL, $SALT ) );
510                if( $xml && $xml->returncode == 'SUCCESS' )
511                        return ( ( $xml->running == 'true' ) ? true : false);
512                else
513                        return ( false );
514        }
515
516        /**
517        *This method calls isMeetingRunning on the BigBlueButton server.
518        *
519        *@param meetingID -- the unique meeting identifier used to store the meeting in the bigbluebutton server
520        *@param SALT -- the security salt of the bigbluebutton server
521        *@param URL -- the url of the bigbluebutton server
522        *
523        *@return
524        *       - If SUCCESS it returns an xml packet
525        *       - If the FAILED or the server is unreachable returns a string of 'false'
526        */
527        public function getMeetingXML( $meetingID, $URL, $SALT ) {
528                $xml = bbb_wrap_simplexml_load_file( BigBlueButton::isMeetingRunningURL( $meetingID, $URL, $SALT ) );
529                if( $xml && $xml->returncode == 'SUCCESS')
530                        return ( str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())));
531                else
532                        return 'false';
533        }
534
535
536
537
538
539
540
541
542
543        // TODO: WRITE AN ITERATOR WHICH GOES OVER WHATEVER IT IS BEING TOLD IN THE API AND LIST INFORMATION
544        /* we have to define at least 2 variable fields for getInformation to read out information at any position
545        The first is: An identifier to chose if we look for attendees or the meetings or something else
546        The second is: An identifier to chose what integrated functions are supposed to be used
547
548        @param IDENTIFIER -- needs to be put in for the function to identify the information to print out
549                                 current values which can be used are 'attendee' and 'meetings'
550        @param meetingID -- needs to be put in to identify the meeting
551        @param modPW -- needs to be put in if the users are supposed to be shown or to retrieve information about the meetings
552        @param URL -- needs to be put in the URL to the bigbluebutton server
553        @param SALT -- needs to be put in for the security salt calculation
554
555        Note: If 'meetings' is used, then only the parameters URL and SALT needs to be used
556                  If 'attendee' is used, then all the parameters needs to be used
557        */
558        public function getInformation( $IDENTIFIER, $meetingID, $modPW, $URL, $SALT ) {
559                // if the identifier is null or '', then return false
560                if( $IDENTIFIER == "" || $IDENTIFIER == null ) {
561                        echo "You need to type in a valid value into the identifier.";
562                        return false;
563                }
564                // if the identifier is attendee, call getUsers
565                else if( $IDENTIFIER == 'attendee' ) {
566                        return BigBlueButton::getUsers( $meetingID, $modPW, $URL, $SALT );
567                }
568                // if the identifier is meetings, call getMeetings
569                else if( $IDENTIFIER == 'meetings' ) {
570                        return BigBlueButton::getMeetings( $URL, $SALT );
571                }
572                // return nothing
573                else {
574                        return true;
575                }
576
577        }
578
579
580
581        function getServerIP() {
582                // get the server url
583                $sIP = $_SERVER['SERVER_ADDR'];
584                return $serverIP = 'http://'.$sIP.'/bigbluebutton/';
585        }
586}
587?>
Note: See TracBrowser for help on using the repository browser.