Update conference_exec.php

This commit is contained in:
FusionPBX 2019-06-16 15:29:40 -06:00 committed by GitHub
parent 6422e7fd72
commit ede854a8e5
1 changed files with 103 additions and 25 deletions

View File

@ -30,7 +30,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -38,25 +38,29 @@
James Rose <james.o.rose@gmail.com> James Rose <james.o.rose@gmail.com>
*/ */
include "root.php";
require_once "resources/require.php"; //includes
require_once "resources/check_auth.php"; include "root.php";
if (permission_exists('conference_active_view')) { require_once "resources/require.php";
//access granted require_once "resources/check_auth.php";
}
else { //check permissions
echo "access denied"; if (permission_exists('conference_active_view')) {
exit; //access granted
} }
else {
echo "access denied";
exit;
}
//get the http values and set them as php variables //get the http values and set them as php variables
if (count($_GET)>0) { if (count($_GET) > 0) {
$cmd = trim(check_str($_GET["cmd"])); $cmd = trim($_GET["cmd"]);
$name = trim(check_str($_GET["name"])); $name = trim($_GET["name"]);
$uuid = trim(check_str($_GET["uuid"])); $uuid = trim($_GET["uuid"]);
$data = trim(check_str($_GET["data"])); $data = trim($_GET["data"]);
$id = trim(check_str($_GET["id"])); $id = trim($_GET["id"]);
$direction = trim(check_str($_GET["direction"])); $direction = trim($_GET["direction"]);
} }
//authorized commands //authorized commands
@ -68,10 +72,82 @@ else {
exit; exit;
} }
//check if the domain is in the switch_cmd //get the conference name
if(stristr($name, $_SESSION['domain_name']) === FALSE) { if (isset($name) && strlen($name) > 0) {
echo "access denied"; $name_array = explode('@', $name);
exit; $name = $name_array[0];
}
//validate the name
if (!is_uuid($name)) {
$sql = "select conference_name ";
$sql .= "from v_conferences ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and conference_name = :conference_name ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['conference_name'] = $name;
$database = new database;
$name = $database->select($sql, $parameters, 'column');
unset ($parameters, $sql);
}
//append the domain name to the conference name
$name = $name .'@'.$_SESSION['domain_name'];
//validate the uuid
if (!is_uuid($uuid)) {
$uuid = null;
}
//validate direction
switch ($direction) {
case "up":
break;
case "down":
break;
default:
$direction = null;
}
//validate the data
switch ($data) {
case "energy":
break;
case "volume_in":
break;
case "volume_out":
break;
case "record":
break;
case "norecord":
break;
case "kick":
break;
case "kick all":
break;
case "mute":
break;
case "unmute":
break;
case "mute non_moderator":
break;
case "unmute non_moderator":
break;
case "deaf":
break;
case "undeaf":
break;
case "lock":
break;
case "unlock":
break;
default:
$data = null;
}
//validate the numeric id
if (!is_numeric($id)) {
$direction = null;
} }
//define an alternative kick all //define an alternative kick all
@ -87,7 +163,9 @@ else {
$session_uuid = $xml->conference['uuid']; $session_uuid = $xml->conference['uuid'];
$x = 0; $x = 0;
foreach ($xml->conference->members->member as $row) { foreach ($xml->conference->members->member as $row) {
$switch_result = event_socket_request($fp, 'api uuid_kill '.$row->uuid); if (is_uuid($row->uuid)) {
$switch_result = event_socket_request($fp, 'api uuid_kill '.$row->uuid);
}
if ($x < 1) { if ($x < 1) {
usleep(500000); //500000 = 0.5 seconds usleep(500000); //500000 = 0.5 seconds
} }
@ -105,7 +183,7 @@ else {
$switch_cmd = $cmd . " "; $switch_cmd = $cmd . " ";
$switch_cmd .= $name . " "; $switch_cmd .= $name . " ";
$switch_cmd .= $data . " "; $switch_cmd .= $data . " ";
if (strlen($id) > 0) { if ($id && strlen($id) > 0) {
$switch_cmd .= " ".$id; $switch_cmd .= " ".$id;
} }