Fix the interactive conference links.

This commit is contained in:
Mark Crane 2012-12-07 22:53:13 +00:00
parent e26100dbe9
commit 7a0761375c
1 changed files with 62 additions and 63 deletions

View File

@ -49,12 +49,6 @@ else {
exit; exit;
} }
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//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(check_str($_GET["cmd"]));
@ -70,75 +64,80 @@ else {
//authorized; //authorized;
} else { } else {
//not found. this command is not authorized //not found. this command is not authorized
echo $text['message-denied']; echo "access denied";
exit; exit;
} }
//check if the domain is in the switch_cmd //check if the domain is in the switch_cmd
if(stristr($name, $_SESSION['domain_name']) === FALSE) { if(stristr($name, $_SESSION['domain_name']) === FALSE) {
echo $text['message-denied']; echo "access denied";
exit; exit;
} }
if (count($_GET)>0) { //execute the command
if (strlen($cmd) > 0) { if (count($_GET) > 0) {
//prepare the switch cmd if (strlen($cmd) > 0) {
$switch_cmd = $cmd . " "; //prepare the switch cmd
$switch_cmd .= $name . " "; $switch_cmd = $cmd . " ";
$switch_cmd .= $data . " "; $switch_cmd .= $name . " ";
if (strlen($id) > 0) { $switch_cmd .= $data . " ";
$switch_cmd .= " ".$id; if (strlen($id) > 0) {
} $switch_cmd .= " ".$id;
}
//connect to event socket //connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) { if ($fp) {
if ($data == "energy") { if ($data == "energy") {
//conference 3001-example-domain.org energy 103 //conference 3001-example-domain.org energy 103
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result); $result_array = explode("=",$switch_result);
$tmp_value = $result_array[1]; $tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 100; } if ($direction == "up") { $tmp_value = $tmp_value + 100; }
if ($direction == "down") { $tmp_value = $tmp_value - 100; } if ($direction == "down") { $tmp_value = $tmp_value - 100; }
//echo "energy $tmp_value<br />\n"; //echo "energy $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
} }
elseif ($data == "volume_in") { elseif ($data == "volume_in") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result); $result_array = explode("=",$switch_result);
$tmp_value = $result_array[1]; $tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; } if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; } if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n"; //echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
} }
elseif ($data == "volume_out") { elseif ($data == "volume_out") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
$result_array = explode("=",$switch_result); $result_array = explode("=",$switch_result);
$tmp_value = $result_array[1]; $tmp_value = $result_array[1];
if ($direction == "up") { $tmp_value = $tmp_value + 1; } if ($direction == "up") { $tmp_value = $tmp_value + 1; }
if ($direction == "down") { $tmp_value = $tmp_value - 1; } if ($direction == "down") { $tmp_value = $tmp_value - 1; }
//echo "volume $tmp_value<br />\n"; //echo "volume $tmp_value<br />\n";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
} }
elseif ($data == "record") { elseif ($data == "record") {
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d"); $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$switch_cmd .= $recording_dir."/".$uuid.".wav"; $switch_cmd .= $recording_dir."/".$uuid.".wav";
if (!file_exists($recording_dir."/".$uuid.".wav")) { if (!file_exists($recording_dir."/".$uuid.".wav")) {
$switch_result = event_socket_request($fp, "api ".$switch_cmd);
}
}
elseif ($data == "norecord") {
//stop recording and rename the file
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$switch_cmd .= $recording_dir."/".$uuid.".wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
elseif ($data == "kick") {
$switch_result = event_socket_request($fp, "api ".$switch_cmd); $switch_result = event_socket_request($fp, "api ".$switch_cmd);
} }
//else {
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//}
//echo $switch_cmd."<br\n>";
} }
elseif ($data == "norecord") { }
//stop recording and rename the file
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$switch_cmd .= $recording_dir."/".$uuid.".wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//else {
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//}
}
} }
}
?> ?>