From 8ab2ad9b4c2929add14298df95727fcb02f802e1 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 30 Dec 2012 05:42:41 +0000 Subject: [PATCH] Update voicemail greetings so that it uses the new fusionpbx voicemail. --- app/voicemail_greetings/app_config.php | 3 +- .../voicemail_greeting_delete.php | 15 +-- .../voicemail_greeting_edit.php | 10 +- .../voicemail_greeting_play.php | 10 +- .../voicemail_greetings.php | 107 +++++++----------- 5 files changed, 63 insertions(+), 82 deletions(-) diff --git a/app/voicemail_greetings/app_config.php b/app/voicemail_greetings/app_config.php index 7971ca6684..d5759605cc 100644 --- a/app/voicemail_greetings/app_config.php +++ b/app/voicemail_greetings/app_config.php @@ -97,7 +97,8 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true'; $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_id'; + $apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'voicemail_id'; + $apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'user_id'; $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; $z++; diff --git a/app/voicemail_greetings/voicemail_greeting_delete.php b/app/voicemail_greetings/voicemail_greeting_delete.php index f943167308..22c9691284 100644 --- a/app/voicemail_greetings/voicemail_greeting_delete.php +++ b/app/voicemail_greetings/voicemail_greeting_delete.php @@ -35,13 +35,14 @@ else { exit; } - foreach($content_voicemail_greetings as $key => $value) { +//add multi-lingual support + foreach($content_voicemail_greetings as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } if (count($_GET)>0) { - $id = $_GET["id"]; - $user_id = $_GET["user_id"]; + $id = check_str($_GET["id"]); + $voicemail_id = check_str($_GET["voicemail_id"]); } if (strlen($id)>0) { @@ -49,7 +50,7 @@ if (strlen($id)>0) { $sql = "select * from v_voicemail_greetings "; $sql .= "where greeting_uuid = '$id' "; $sql .= "and domain_uuid = '$domain_uuid' "; - $sql .= "and user_id = '$user_id' "; + $sql .= "and voicemail_id = '$voicemail_id' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -63,13 +64,13 @@ if (strlen($id)>0) { $sql = "delete from v_voicemail_greetings "; $sql .= "where greeting_uuid = '$id' "; $sql .= "and domain_uuid = '$domain_uuid' "; - $sql .= "and user_id = '$user_id' "; + $sql .= "and voicemail_id = '$voicemail_id' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); unset($sql); //set the greeting directory - $v_greeting_dir = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domains'][$domain_uuid]['domain_name'].'/'.$user_id; + $v_greeting_dir = $_SESSION['switch']['storage']['dir'].'/voicemail/default/'.$_SESSION['domains'][$domain_uuid]['domain_name'].'/'.$voicemail_id; //delete the recording file unlink($v_greeting_dir."/".$greeting_name); @@ -77,7 +78,7 @@ if (strlen($id)>0) { //redirect the user require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "".$text['confirm-delete-2']."\n"; echo "
\n"; diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index 5f71142282..f9300d6023 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -50,7 +50,7 @@ else { } //get the form value and set to php variables - $user_id = check_str($_REQUEST["user_id"]); + $voicemail_id = check_str($_REQUEST["voicemail_id"]); if (count($_POST)>0) { $greeting_name = check_str($_POST["greeting_name"]); $greeting_description = check_str($_POST["greeting_description"]); @@ -106,7 +106,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "".$text['confirm-add']."\n"; echo "
\n"; @@ -145,7 +145,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); require_once "includes/header.php"; - echo "\n"; + echo "\n"; echo "
\n"; echo "".$text['confirm-update']."\n"; echo "
\n"; @@ -194,7 +194,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo "".$text['label-edit']['en-us']."\n"; } - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -223,7 +223,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if ($action == "update") { echo " \n"; } - echo " \n"; + echo " \n"; echo " \n"; echo " \n"; echo " "; diff --git a/app/voicemail_greetings/voicemail_greeting_play.php b/app/voicemail_greetings/voicemail_greeting_play.php index c5db3ec06f..d6125921a9 100644 --- a/app/voicemail_greetings/voicemail_greeting_play.php +++ b/app/voicemail_greetings/voicemail_greeting_play.php @@ -56,15 +56,13 @@ $type = $_GET['type']; //moh //rec $file_ext = substr($filename, -3); if ($file_ext == "wav") { //HTML5 method - echo "