Fix a few more voicemail gui issues: make sure the back button returns to the correct page, fix the redirect after deleting a voicemail. Fix the voicemail delete mp3 files or other sounds files other than wav or mp3.
This commit is contained in:
parent
7bf66e93fc
commit
def55290ab
|
|
@ -35,8 +35,88 @@
|
|||
public $order_by;
|
||||
public $order;
|
||||
|
||||
public function messages() {
|
||||
public function voicemails() {
|
||||
//set the voicemail_uuid
|
||||
if (strlen($_REQUEST["id"]) > 0) {
|
||||
$voicemail_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
|
||||
//set the voicemail_id array
|
||||
foreach ($_SESSION['user']['extension'] as $value) {
|
||||
$voicemail_ids[]['voicemail_id'] = $value['user'];
|
||||
}
|
||||
|
||||
//get the uuid and voicemail_id
|
||||
$sql = "select * from v_voicemails ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
if (strlen($this->voicemail_uuid) > 0) {
|
||||
if (permission_exists('voicemail_delete')) {
|
||||
//view specific voicemail box usually reserved for an admin or superadmin
|
||||
$sql .= "and voicemail_uuid = '".$this->voicemail_uuid."' ";
|
||||
}
|
||||
else {
|
||||
//ensure that the requested voicemail id is assigned to this user
|
||||
$found = false;
|
||||
foreach($voicemail_ids as $row) {
|
||||
if ($voicemail_uuid == $row['voicemail_id']) {
|
||||
$sql .= "and voicemail_id = '".$row['voicemail_id']."' ";
|
||||
$found = true;
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
//id requested is not owned by the user return no results
|
||||
if (!$found) {
|
||||
$sql .= "and voicemail_uuid = '' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$x = 0;
|
||||
if (count($voicemail_ids) > 0) {
|
||||
//show only the assigned voicemail ids
|
||||
$sql .= "and (";
|
||||
foreach($voicemail_ids as $row) {
|
||||
if ($x == 0) {
|
||||
$sql .= "voicemail_id = '".$row['voicemail_id']."' ";
|
||||
}
|
||||
else {
|
||||
$sql .= " or voicemail_id = '".$row['voicemail_id']."'";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
else {
|
||||
//no assigned voicemail ids so return no results
|
||||
$sql .= "and voicemail_uuid = '' ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $this->db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function messages() {
|
||||
//get the voicemails
|
||||
$voicemails = $this->voicemails();
|
||||
|
||||
//add the voicemail messages to the array
|
||||
foreach ($voicemails as &$row) {
|
||||
//get the voicemail messages
|
||||
$this->voicemail_uuid = $row['voicemail_uuid'];
|
||||
$this->voicemail_id = $row['voicemail_id'];
|
||||
$result = $this->voicemail_messages();
|
||||
$voicemail_count = count($result);
|
||||
$row['messages'] = $result;
|
||||
}
|
||||
|
||||
//return the array
|
||||
return $voicemails;
|
||||
}
|
||||
|
||||
public function voicemail_messages() {
|
||||
$sql = "select * from v_voicemail_messages as m, v_voicemails as v ";
|
||||
$sql .= "where m.domain_uuid = '$this->domain_uuid' ";
|
||||
$sql .= "and m.voicemail_uuid = v.voicemail_uuid ";
|
||||
|
|
@ -142,8 +222,10 @@
|
|||
}
|
||||
|
||||
//delete the recording
|
||||
$file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$this->voicemail_id."/msg_".$this->voicemail_message_uuid.".wav";
|
||||
unlink($file_path);
|
||||
$file_path = $_SESSION['switch']['storage']['dir']."/voicemail/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
|
||||
foreach (glob($file_path."/msg_".$this->voicemail_message_uuid.".*") as $file_name) {
|
||||
unlink($file_name);
|
||||
}
|
||||
|
||||
//check the message waiting status
|
||||
$this->message_waiting();
|
||||
|
|
|
|||
|
|
@ -223,8 +223,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-voicemail']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='voicemails.php'\" value='".$text['button-back']."'></td>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-voicemail']."</b></td>\n";
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"javascript:history.back();\" value='".$text['button-back']."'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
|
|
|
|||
|
|
@ -40,12 +40,17 @@ else {
|
|||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//get the id
|
||||
//get the HTTP values and set them as variables
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$voicemail_uuid = check_str($_GET["voicemail_uuid"]);
|
||||
}
|
||||
|
||||
//set the referrer
|
||||
$http_referer = parse_url($_SERVER["HTTP_REFERER"]);
|
||||
$referer_path = $http_referer['path'];
|
||||
$referer_query = $http_referer['query'];
|
||||
|
||||
//delete the voicemail message
|
||||
if (strlen($id)>0) {
|
||||
require_once "resources/classes/voicemail.php";
|
||||
|
|
@ -53,7 +58,6 @@ else {
|
|||
$voicemail->db = $db;
|
||||
$voicemail->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$voicemail->voicemail_uuid = $voicemail_uuid;
|
||||
$voicemail->voicemail_id = $voicemail_id;
|
||||
$voicemail->voicemail_message_uuid = $id;
|
||||
$result = $voicemail->message_delete();
|
||||
unset($voicemail);
|
||||
|
|
@ -61,7 +65,12 @@ else {
|
|||
|
||||
//redirect the user
|
||||
require_once "resources/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_messages.php?id=$voicemail_uuid\">\n";
|
||||
if ($referer_path == "/app/voicemails/voicemail_messages.php") {
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_messages.php?".$referer_query."\">\n";
|
||||
}
|
||||
else {
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemails.php\">\n";
|
||||
}
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
|
|
|
|||
|
|
@ -45,80 +45,6 @@ else {
|
|||
$voicemail_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
|
||||
//set the voicemail_id array
|
||||
foreach ($_SESSION['user']['extension'] as $value) {
|
||||
$voicemail_ids[]['voicemail_id'] = $value['user'];
|
||||
}
|
||||
|
||||
//get the uuid and voicemail_id
|
||||
$sql = "select * from v_voicemails ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
if (strlen($voicemail_uuid) > 0) {
|
||||
if (permission_exists('voicemail_delete')) {
|
||||
//view specific voicemail box usually reserved for an admin or superadmin
|
||||
$sql .= "and voicemail_uuid = '$voicemail_uuid' ";
|
||||
}
|
||||
else {
|
||||
//ensure that the requested voicemail id is assigned to this user
|
||||
$found = false;
|
||||
foreach($voicemail_ids as $row) {
|
||||
if ($voicemail_uuid == $row['voicemail_id']) {
|
||||
$sql .= "and voicemail_id = '".$row['voicemail_id']."' ";
|
||||
$found = true;
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
//id requested is not owned by the user return no results
|
||||
if (!$found) {
|
||||
$sql .= "and voicemail_uuid = '' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$x = 0;
|
||||
if (count($voicemail_ids) > 0) {
|
||||
//show only the assigned voicemail ids
|
||||
$sql .= "and (";
|
||||
foreach($voicemail_ids as $row) {
|
||||
if ($x == 0) {
|
||||
$sql .= "voicemail_id = '".$row['voicemail_id']."' ";
|
||||
}
|
||||
else {
|
||||
$sql .= " or voicemail_id = '".$row['voicemail_id']."'";
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
else {
|
||||
//no assigned voicemail ids so return no results
|
||||
$sql .= "and voicemail_uuid = '' ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$voicemails = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement);
|
||||
|
||||
//add the voicemail messages to the array
|
||||
foreach ($voicemails as &$row) {
|
||||
//get the voicemail messages
|
||||
require_once "app/voicemails/resources/classes/voicemail.php";
|
||||
$voicemail = new voicemail;
|
||||
$voicemail->db = $db;
|
||||
$voicemail->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$voicemail->voicemail_uuid = $row['voicemail_uuid'];
|
||||
$voicemail->voicemail_id = $row['voicemail_id'];
|
||||
$voicemail->order_by = $order_by;
|
||||
$voicemail->order = $order;
|
||||
$result = $voicemail->messages();
|
||||
$voicemail_count = count($result);
|
||||
$row['messages'] = $result;
|
||||
}
|
||||
//echo "<pre>\n";
|
||||
//print_r($voicemails);
|
||||
//echo "</pre>\n";
|
||||
|
||||
//download the message
|
||||
if (check_str($_REQUEST["action"]) == "download") {
|
||||
$voicemail_message_uuid = check_str($_REQUEST["uuid"]);
|
||||
|
|
@ -138,6 +64,16 @@ else {
|
|||
$order_by = check_str($_GET["order_by"]);
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//get the voicemail
|
||||
require_once "app/voicemails/resources/classes/voicemail.php";
|
||||
$vm = new voicemail;
|
||||
$vm->db = $db;
|
||||
$vm->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$vm->voicemail_uuid = $voicemail_uuid;
|
||||
$vm->order_by = $order_by;
|
||||
$vm->order = $order;
|
||||
$voicemails = $vm->messages();
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
|
|
|||
Loading…
Reference in New Issue