2012-09-13 06:45:57 +02:00
< ? php
2012-10-05 07:50:20 +02:00
/*
FusionPBX
Version : MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 ( the " License " ); you may not use this file except in compliance with
the License . You may obtain a copy of the License at
http :// www . mozilla . org / MPL /
Software distributed under the License is distributed on an " AS IS " basis ,
WITHOUT WARRANTY OF ANY KIND , either express or implied . See the License
for the specific language governing rights and limitations under the
License .
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane < markjcrane @ fusionpbx . com >
2018-06-06 18:33:52 +02:00
Portions created by the Initial Developer are Copyright ( C ) 2008 - 2018
2012-10-05 07:50:20 +02:00
the Initial Developer . All Rights Reserved .
Contributor ( s ) :
Mark J Crane < markjcrane @ fusionpbx . com >
*/
2018-06-06 18:33:52 +02:00
//includes
require_once " root.php " ;
require_once " resources/require.php " ;
require_once " resources/check_auth.php " ;
//check permissions
if ( permission_exists ( 'conference_room_view' )) {
//access granted
}
else {
echo " access denied " ;
exit ;
}
2012-11-07 10:41:43 +01:00
//add multi-lingual support
2015-01-18 11:06:08 +01:00
$language = new text ;
$text = $language -> get ();
2012-11-07 10:41:43 +01:00
//additional includes
2013-07-06 08:29:50 +02:00
require_once " resources/header.php " ;
require_once " resources/paging.php " ;
2012-09-13 06:45:57 +02:00
2013-02-28 19:55:36 +01:00
//get the meeting_uuid using the pin number
2019-07-04 23:57:04 +02:00
$search = preg_replace ( '{\D}' , '' , $_GET [ " search " ]);
2013-02-28 19:55:36 +01:00
if ( strlen ( $search ) > 0 ) {
2019-07-04 23:57:04 +02:00
$sql = " select meeting_uuid " ;
$sql .= " from v_meetings " ;
2019-06-03 18:53:58 +02:00
$sql .= " where domain_uuid = :domain_uuid " ;
2019-07-04 23:57:04 +02:00
$sql .= " and ( " ;
$sql .= " moderator_pin = :search " ;
$sql .= " or participant_pin = :search " ;
$sql .= " ) " ;
2019-06-03 18:53:58 +02:00
$parameters [ 'domain_uuid' ] = $_SESSION [ 'domain_uuid' ];
2019-07-04 23:57:04 +02:00
$parameters [ 'search' ] = '%' . $search . '%' ;
2019-06-03 18:53:58 +02:00
$database = new database ;
2019-06-08 17:31:03 +02:00
$meeting_uuid = $database -> select ( $sql , $parameters , 'column' );
2013-02-28 19:55:36 +01:00
}
2012-11-07 09:51:36 +01:00
//if the $_GET array exists then process it
2013-02-28 19:55:36 +01:00
if ( count ( $_GET ) > 0 && strlen ( $_GET [ " search " ]) == 0 ) {
2012-11-07 09:51:36 +01:00
//get http GET variables and set them as php variables
2019-06-08 17:23:03 +02:00
$conference_room_uuid = $_GET [ " conference_room_uuid " ];
$record = $_GET [ " record " ];
$wait_mod = $_GET [ " wait_mod " ];
$announce = $_GET [ " announce " ];
$mute = $_GET [ " mute " ];
$sounds = $_GET [ " sounds " ];
$enabled = $_GET [ " enabled " ];
$meeting_uuid = $_GET [ " meeting_uuid " ];
2013-02-27 12:06:44 +01:00
2013-02-28 19:55:36 +01:00
//record announcement
2019-06-08 17:23:03 +02:00
if ( $record == " true " && is_uuid ( $meeting_uuid )) {
2013-02-27 12:06:44 +01:00
//prepare the values
$default_language = 'en' ;
$default_dialect = 'us' ;
$default_voice = 'callie' ;
2017-04-17 17:01:04 +02:00
$switch_cmd = " conference " . $meeting_uuid . " @ " . $_SESSION [ 'domain_name' ] . " play " . $_SESSION [ 'switch' ][ 'sounds' ][ 'dir' ] . " / " . $default_language . " / " . $default_dialect . " / " . $default_voice . " /ivr/ivr-recording_started.wav " ;
2013-02-27 12:06:44 +01:00
//connect to event socket
$fp = event_socket_create ( $_SESSION [ 'event_socket_ip_address' ], $_SESSION [ 'event_socket_port' ], $_SESSION [ 'event_socket_password' ]);
if ( $fp ) {
$switch_result = event_socket_request ( $fp , 'api ' . $switch_cmd );
}
}
2012-11-07 09:51:36 +01:00
2019-06-08 17:23:03 +02:00
//build the array
$array [ 'conference_rooms' ][ 0 ][ 'conference_room_uuid' ] = $conference_room_uuid ;
2012-11-07 09:51:36 +01:00
if ( strlen ( $record ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'record' ] = $record ;
2012-11-07 09:51:36 +01:00
}
if ( strlen ( $wait_mod ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'wait_mod' ] = $wait_mod ;
2012-11-07 09:51:36 +01:00
}
if ( strlen ( $announce ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'announce' ] = $announce ;
2012-11-07 09:51:36 +01:00
}
if ( strlen ( $mute ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'mute' ] = $mute ;
2012-11-07 09:51:36 +01:00
}
2013-02-01 13:23:39 +01:00
if ( strlen ( $sounds ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'sounds' ] = $sounds ;
2013-02-01 13:23:39 +01:00
}
2012-11-07 09:51:36 +01:00
if ( strlen ( $enabled ) > 0 ) {
2019-06-08 17:23:03 +02:00
$array [ 'conference_rooms' ][ 0 ][ 'enabled' ] = $enabled ;
2012-11-07 09:51:36 +01:00
}
2019-06-08 17:23:03 +02:00
//save to the data
2019-06-03 18:53:58 +02:00
$database = new database ;
2019-06-08 17:23:03 +02:00
$database -> app_name = 'conference_rooms' ;
$database -> app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e' ;
$database -> save ( $array );
$message = $database -> message ;
2019-07-04 23:57:04 +02:00
unset ( $array );
2012-11-07 09:51:36 +01:00
}
2012-10-27 08:47:47 +02:00
//get conference array
$switch_cmd = " conference xml_list " ;
$fp = event_socket_create ( $_SESSION [ 'event_socket_ip_address' ], $_SESSION [ 'event_socket_port' ], $_SESSION [ 'event_socket_password' ]);
if ( ! $fp ) {
2012-11-06 20:31:58 +01:00
//connection to even socket failed
2012-10-27 08:47:47 +02:00
}
else {
$xml_str = trim ( event_socket_request ( $fp , 'api ' . $switch_cmd ));
try {
$xml = new SimpleXMLElement ( $xml_str , true );
}
catch ( Exception $e ) {
//echo $e->getMessage();
}
foreach ( $xml -> conference as $row ) {
//convert the xml object to an array
$json = json_encode ( $row );
$row = json_decode ( $json , true );
//set the variables
$conference_name = $row [ '@attributes' ][ 'name' ];
$session_uuid = $row [ '@attributes' ][ 'uuid' ];
$member_count = $row [ '@attributes' ][ 'member-count' ];
//show the conferences that have a matching domain
$tmp_domain = substr ( $conference_name , - strlen ( $_SESSION [ 'domain_name' ]));
if ( $tmp_domain == $_SESSION [ 'domain_name' ]) {
2017-04-17 17:01:04 +02:00
$meeting_uuid = substr ( $conference_name , 0 , strlen ( $conference_name ) - strlen ( '@' . $_SESSION [ 'domain_name' ]));
2012-10-27 08:47:47 +02:00
$conference [ $meeting_uuid ][ " conference_name " ] = $conference_name ;
$conference [ $meeting_uuid ][ " session_uuid " ] = $session_uuid ;
$conference [ $meeting_uuid ][ " member_count " ] = $member_count ;
}
}
}
2012-09-13 06:45:57 +02:00
//get variables used to control the order
$order_by = $_GET [ " order_by " ];
$order = $_GET [ " order " ];
//show the content
2014-11-29 22:21:26 +01:00
echo " <table width='100%' cellpadding='0' cellspacing='0' border='0'> \n " ;
2012-09-13 06:45:57 +02:00
echo " <tr> \n " ;
2013-02-28 19:55:36 +01:00
echo " <form method='get' action=''> \n " ;
2015-08-03 23:17:05 +02:00
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'><b> " . $text [ 'title-conference_rooms' ] . " </b></td> \n " ;
2014-11-29 22:21:26 +01:00
echo " <td width='50%' align='right' valign='top'> \n " ;
2018-06-06 18:33:52 +02:00
echo " <input type='text' class='txt' style='width: 150px' name='search' value=' " . escape ( $search ) . " '> " ;
2013-02-28 19:55:36 +01:00
echo " <input type='submit' class='btn' name='submit' value=' " . $text [ 'button-search' ] . " '> " ;
echo " </td> \n " ;
echo " </form> \n " ;
2012-09-13 06:45:57 +02:00
echo " </tr> \n " ;
echo " </table> \n " ;
2014-11-29 22:21:26 +01:00
echo " <br /><br> \n " ;
2012-09-13 06:45:57 +02:00
2013-01-25 10:02:15 +01:00
//get the conference room count
2018-12-11 01:16:19 +01:00
$conference_center = new conference_centers ;
2013-01-25 10:02:15 +01:00
$conference_center -> db = $db ;
$conference_center -> domain_uuid = $_SESSION [ 'domain_uuid' ];
2013-02-28 19:55:36 +01:00
if ( strlen ( $meeting_uuid ) > 0 ) {
$conference_center -> meeting_uuid = $meeting_uuid ;
}
if ( strlen ( $search ) > 0 ) {
$conference_center -> search = $search ;
}
2013-04-23 01:05:08 +02:00
$row_count = $conference_center -> room_count ();
2012-09-13 06:45:57 +02:00
//prepare to page the results
2016-03-29 07:02:11 +02:00
$rows_per_page = ( $_SESSION [ 'domain' ][ 'paging' ][ 'numeric' ] != '' ) ? $_SESSION [ 'domain' ][ 'paging' ][ 'numeric' ] : 50 ;
2019-06-08 17:23:03 +02:00
$param = '' ;
$page = $_GET [ 'page' ];
2013-01-25 10:02:15 +01:00
if ( strlen ( $page ) == 0 ) { $page = 0 ; $_GET [ 'page' ] = 0 ; }
2014-02-21 04:56:30 +01:00
list ( $paging_controls , $rows_per_page , $var3 ) = paging ( $row_count , $param , $rows_per_page );
$offset = $rows_per_page * $page ;
2012-09-13 06:45:57 +02:00
2013-01-25 10:02:15 +01:00
//get the conference rooms
$conference_center -> rows_per_page = $rows_per_page ;
$conference_center -> offset = $offset ;
$conference_center -> order_by = $order_by ;
$conference_center -> order = $order ;
2013-02-28 19:55:36 +01:00
if ( strlen ( $meeting_uuid ) > 0 ) {
$conference_center -> meeting_uuid = $meeting_uuid ;
}
if ( strlen ( $search ) > 0 ) {
$conference_center -> search = $search ;
}
2013-01-25 10:02:15 +01:00
$result = $conference_center -> rooms ();
2012-09-13 06:45:57 +02:00
2013-01-25 10:02:15 +01:00
//prepare to alternate the row styles
$c = 0 ;
$row_style [ " 0 " ] = " row_style0 " ;
$row_style [ " 1 " ] = " row_style1 " ;
2012-10-27 08:47:47 +02:00
2013-01-25 10:02:15 +01:00
//table header
2014-06-22 05:24:36 +02:00
echo " <table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'> \n " ;
2013-01-25 10:02:15 +01:00
echo " <tr> \n " ;
//echo th_order_by('conference_center_uuid', 'Conference UUID', $order_by, $order);
//echo th_order_by('meeting_uuid', 'Meeting UUID', $order_by, $order);
2014-11-30 04:43:04 +01:00
echo " <th nowrap='nowrap'> " . $text [ 'label-name' ] . " </th> \n " ;
2013-04-16 09:11:41 +02:00
echo " <th nowrap='nowrap'> " . $text [ 'label-moderator-pin' ] . " </th> \n " ;
echo " <th nowrap='nowrap'> " . $text [ 'label-participant-pin' ] . " </th> \n " ;
2013-02-01 13:23:39 +01:00
//echo th_order_by('profile', $text['label-profile'], $order_by, $order);
2013-01-25 10:02:15 +01:00
echo th_order_by ( 'record' , $text [ 'label-record' ], $order_by , $order );
//echo th_order_by('max_members', 'Max', $order_by, $order);
2015-08-03 23:17:05 +02:00
echo th_order_by ( 'wait_mod' , $text [ 'label-wait_moderator' ], $order_by , $order );
2013-01-25 10:02:15 +01:00
echo th_order_by ( 'announce' , $text [ 'label-announce' ], $order_by , $order );
//echo th_order_by('enter_sound', 'Enter Sound', $order_by, $order);
echo th_order_by ( 'mute' , $text [ 'label-mute' ], $order_by , $order );
2013-02-01 13:23:39 +01:00
echo th_order_by ( 'sounds' , $text [ 'label-sounds' ], $order_by , $order );
echo " <th> " . $text [ 'label-members' ] . " </th> \n " ;
2013-01-25 10:02:15 +01:00
echo " <th> " . $text [ 'label-tools' ] . " </th> \n " ;
2013-02-27 11:10:24 +01:00
if ( permission_exists ( 'conference_room_enabled' )) {
echo th_order_by ( 'enabled' , $text [ 'label-enabled' ], $order_by , $order );
}
2013-01-25 10:02:15 +01:00
echo th_order_by ( 'description' , $text [ 'label-description' ], $order_by , $order );
echo " <td align='right' width='42' nowrap='nowrap'> \n " ;
if ( permission_exists ( 'conference_room_add' )) {
echo " <a href='conference_room_edit.php' alt='add'> $v_link_label_add </a> \n " ;
}
else {
echo " \n " ;
}
echo " </td> \n " ;
2014-06-22 05:24:36 +02:00
echo " </tr> \n " ;
2012-09-13 06:45:57 +02:00
2019-06-08 17:23:03 +02:00
//show the data
if ( is_array ( $result ) > 0 ) {
foreach ( $result as $row ) {
$meeting_uuid = $row [ 'meeting_uuid' ];
$conference_room_name = $row [ 'conference_room_name' ];
$moderator_pin = $row [ 'moderator_pin' ];
$participant_pin = $row [ 'participant_pin' ];
if ( strlen ( $moderator_pin ) == 9 ) {
$moderator_pin = substr ( $moderator_pin , 0 , 3 ) . " - " . substr ( $moderator_pin , 3 , 3 ) . " - " . substr ( $moderator_pin , - 3 ) . " \n " ;
}
if ( strlen ( $participant_pin ) == 9 ) {
$participant_pin = substr ( $participant_pin , 0 , 3 ) . " - " . substr ( $participant_pin , 3 , 3 ) . " - " . substr ( $participant_pin , - 3 ) . " \n " ;
}
2013-02-01 13:23:39 +01:00
2019-06-08 17:23:03 +02:00
$tr_link = ( permission_exists ( 'conference_room_edit' )) ? " href='conference_room_edit.php?id= " . escape ( $row [ 'conference_room_uuid' ]) . " ' " : null ;
echo " <tr " . $tr_link . " > \n " ;
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " . (( $conference_room_name != '' ) ? " <a " . $tr_link . " > " . escape ( $conference_room_name ) . " </a> " : " " ) . " </td> \n " ;
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " . $moderator_pin . " </td> \n " ;
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " . $participant_pin . " </td> \n " ;
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['conference_center_uuid'])." </td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['meeting_uuid'])." </td>\n";
//echo " <td valign='middle' class='".$row_style[$c]."'>".escape($row['profile'])." </td>\n";
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'record' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &record=false&meeting_uuid= " . escape ( $meeting_uuid ) . " \" > " . $text [ 'label-true' ] . " </a> " ;
}
else {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &record=true&meeting_uuid= " . escape ( $meeting_uuid ) . " \" > " . $text [ 'label-false' ] . " </a> " ;
}
echo " \n " ;
echo " </td> \n " ;
//echo " <td valign='middle' class='".$row_style[$c]."'>".$row['max_members']." </td>\n";
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'wait_mod' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &wait_mod=false \" > " . $text [ 'label-true' ] . " </a> " ;
}
else {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &wait_mod=true \" > " . $text [ 'label-false' ] . " </a> " ;
}
echo " \n " ;
echo " </td> \n " ;
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'announce' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &announce=false \" > " . $text [ 'label-true' ] . " </a> " ;
}
else {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &announce=true \" > " . $text [ 'label-false' ] . " </a> " ;
}
echo " \n " ;
echo " </td> \n " ;
2012-11-07 09:51:36 +01:00
2019-06-08 17:23:03 +02:00
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'mute' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &mute=false \" > " . $text [ 'label-true' ] . " </a> " ;
}
else {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &mute=true \" > " . $text [ 'label-false' ] . " </a> " ;
}
echo " </td> \n " ;
2013-02-01 13:23:39 +01:00
2019-06-08 17:23:03 +02:00
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'sounds' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &sounds=false \" > " . $text [ 'label-true' ] . " </a> " ;
}
else {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &sounds=true \" > " . $text [ 'label-false' ] . " </a> " ;
}
echo " \n " ;
echo " </td> \n " ;
if ( strlen ( $conference [ $meeting_uuid ][ " session_uuid " ])) {
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " . escape ( $conference [ $meeting_uuid ][ " member_count " ]) . " </td> \n " ;
}
else {
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '>0</td> \n " ;
}
echo " <td valign='middle' class=' " . $row_style [ $c ] . " ' nowrap='nowrap'> \n " ;
echo " <a href=' " . PROJECT_PATH . " /app/conferences_active/conference_interactive.php?c= " . escape ( $row [ 'meeting_uuid' ]) . " '> " . $text [ 'label-view' ] . " </a> \n " ;
echo " <a href='conference_sessions.php?id= " . escape ( $row [ 'meeting_uuid' ]) . " '> " . $text [ 'label-sessions' ] . " </a> \n " ;
echo " </td> \n " ;
2013-02-01 13:23:39 +01:00
2019-06-08 17:23:03 +02:00
if ( permission_exists ( 'conference_room_enabled' )) {
echo " <td valign='middle' class=' " . $row_style [ $c ] . " '> " ;
if ( $row [ 'enabled' ] == " true " ) {
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &enabled=false \" > " . $text [ 'label-true' ] . " </a> " ;
2013-01-25 10:02:15 +01:00
}
else {
2019-06-08 17:23:03 +02:00
echo " <a href= \" ?conference_room_uuid= " . escape ( $row [ 'conference_room_uuid' ]) . " &enabled=true \" > " . $text [ 'label-false' ] . " </a> " ;
2013-02-01 13:23:39 +01:00
}
echo " \n " ;
echo " </td> \n " ;
2019-06-08 17:23:03 +02:00
}
2013-02-01 13:23:39 +01:00
2019-06-08 17:23:03 +02:00
echo " <td valign='middle' class='row_stylebg'> " ;
echo " " . escape ( $row [ 'description' ]) . " \n " ;
echo " \n " ;
echo " </td> \n " ;
2012-09-13 06:45:57 +02:00
2019-06-08 17:23:03 +02:00
echo " <td class='list_control_icons'> " ;
if ( permission_exists ( 'conference_room_edit' )) {
echo " <a href='conference_room_edit.php?id= " . escape ( $row [ 'conference_room_uuid' ]) . " ' alt=' " . $text [ 'label-edit' ] . " '> $v_link_label_edit </a> " ;
}
if ( permission_exists ( 'conference_room_delete' )) {
echo " <a href='conference_room_delete.php?id= " . escape ( $row [ 'conference_room_uuid' ]) . " ' alt=' " . $text [ 'label-delete' ] . " ' onclick= \" return confirm(' " . $text [ 'confirm-delete' ] . " ') \" > $v_link_label_delete </a> " ;
}
echo " </td> \n " ;
echo " </tr> \n " ;
if ( $c == 0 ) { $c = 1 ; } else { $c = 0 ; }
} //end foreach
unset ( $sql , $result , $row_count );
} //end if results
//show paging
echo " <tr> \n " ;
echo " <td colspan='13' align='left'> \n " ;
echo " <table width='100%' cellpadding='0' cellspacing='0'> \n " ;
echo " <tr> \n " ;
echo " <td width='33.3%' nowrap> </td> \n " ;
echo " <td width='33.3%' align='center' nowrap> $paging_controls </td> \n " ;
echo " <td class='list_control_icons'> " ;
if ( permission_exists ( 'conference_room_add' )) {
echo " <a href='conference_room_edit.php' alt='add'> $v_link_label_add </a> " ;
}
echo " </td> \n " ;
echo " </tr> \n " ;
echo " </table> \n " ;
echo " </td> \n " ;
2013-01-25 10:02:15 +01:00
echo " </tr> \n " ;
2012-09-13 06:45:57 +02:00
2013-01-25 10:02:15 +01:00
//close the tables
2012-09-13 06:45:57 +02:00
echo " </table> " ;
2014-11-29 22:21:26 +01:00
echo " <br><br> " ;
2012-09-13 06:45:57 +02:00
//include the footer
2013-07-06 08:29:50 +02:00
require_once " resources/footer.php " ;
2018-06-06 18:33:52 +02:00
?>