mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Phrases: Ability to sequence playback of audio files in the IVR, initial groundwork for other switch phrase manipulation.
This commit is contained in:
@@ -353,7 +353,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " ".$text['label-extension'].":\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='number' name='ivr_menu_extension' maxlength='255' min='0' step='1' value='$ivr_menu_extension' required='required'>\n";
|
||||
echo " <input class='formfld' type='text' name='ivr_menu_extension' maxlength='255' value='$ivr_menu_extension' required='required'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-extension']."\n";
|
||||
echo "</td>\n";
|
||||
@@ -374,6 +374,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo " tb.type='text';\n";
|
||||
echo " tb.name=obj.name;\n";
|
||||
echo " tb.setAttribute('class', 'formfld');\n";
|
||||
echo " tb.setAttribute('style', 'width: 380px;');\n";
|
||||
echo " tb.value=obj.options[obj.selectedIndex].value;\n";
|
||||
echo " tbb=document.createElement('INPUT');\n";
|
||||
echo " tbb.setAttribute('class', 'btn');\n";
|
||||
@@ -396,30 +397,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "\n";
|
||||
}
|
||||
if (if_group("superadmin")) {
|
||||
echo " <select name='ivr_menu_greet_long' class='formfld' onchange='changeToInput(this);'>\n";
|
||||
echo " <select name='ivr_menu_greet_long' class='formfld' style='width: 400px;' onchange='changeToInput(this);'>\n";
|
||||
}
|
||||
else {
|
||||
echo " <select name='ivr_menu_greet_long' class='formfld'>\n";
|
||||
echo " <select name='ivr_menu_greet_long' class='formfld' style='width: 400px;'>\n";
|
||||
}
|
||||
//select
|
||||
if (if_group("superadmin")) {
|
||||
if (!$tmp_selected) {
|
||||
echo "<optgroup label='selected'>\n";
|
||||
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long)) {
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
|
||||
} elseif (substr($ivr_menu_greet_long, -3) == "wav" || substr($ivr_menu_greet_long, -3) == "mp3") {
|
||||
echo " <option value='".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
unset($tmp_selected);
|
||||
}
|
||||
//misc optgroup
|
||||
if (if_group("superadmin")) {
|
||||
echo "<optgroup label='misc'>\n";
|
||||
echo " <option value='phrase:'>phrase:</option>\n";
|
||||
echo " <option value='say:'>say:</option>\n";
|
||||
echo " <option value='tone_stream:'>tone_stream:</option>\n";
|
||||
echo " <option value='phrase:'>phrase:</option>\n";
|
||||
echo " <option value='say:'>say:</option>\n";
|
||||
echo " <option value='tone_stream:'>tone_stream:</option>\n";
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
//recordings
|
||||
@@ -435,10 +423,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
else {
|
||||
if ($ivr_menu_greet_long == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($ivr_menu_greet_long) > 0) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected=\"selected\">".$file."</option>\n";
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected=\"selected\">".$file."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,6 +434,22 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
closedir($dh);
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
//phrases
|
||||
echo "<optgroup label='phrases'>\n";
|
||||
$sql = "select * from v_phrases where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
if ($ivr_menu_greet_long == "phrase:".$row["phrase_name"].".".$domain_uuid) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' selected='selected'>".$row["phrase_name"]."</option>\n";
|
||||
} else {
|
||||
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."'>".$row["phrase_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($prep_statement);
|
||||
echo "</optgroup>\n";
|
||||
//sounds
|
||||
$dir_path = $_SESSION['switch']['sounds']['dir'];
|
||||
recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
|
||||
@@ -457,13 +461,26 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
}
|
||||
if ($ivr_menu_greet_long == $key) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='$key' selected='selected'>$key</option>\n";
|
||||
echo " <option value='$key' selected='selected'>$key</option>\n";
|
||||
} else {
|
||||
echo " <option value='$key'>$key</option>\n";
|
||||
echo " <option value='$key'>$key</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
//select
|
||||
if (if_group("superadmin")) {
|
||||
if (!$tmp_selected) {
|
||||
echo "<optgroup label='selected'>\n";
|
||||
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long)) {
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
|
||||
} elseif (substr($ivr_menu_greet_long, -3) == "wav" || substr($ivr_menu_greet_long, -3) == "mp3") {
|
||||
echo " <option value='".$ivr_menu_greet_long."' selected='selected'>".$ivr_menu_greet_long."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
unset($tmp_selected);
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-greet_long']."\n";
|
||||
@@ -477,14 +494,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
|
||||
echo "\n";
|
||||
echo " <select name='ivr_menu_greet_short' class='formfld' onchange='changeToInput(this);'>\n";
|
||||
echo " <option></option>\n";
|
||||
if (if_group("superadmin")) {
|
||||
echo "<select name='ivr_menu_greet_short' class='formfld' style='width: 400px;' onchange='changeToInput(this);'>\n";
|
||||
}
|
||||
else {
|
||||
echo "<select name='ivr_menu_greet_short' class='formfld' style='width: 400px;'>\n";
|
||||
}
|
||||
echo " <option></option>\n";
|
||||
//misc
|
||||
if (if_group("superadmin")) {
|
||||
echo "<optgroup label='misc'>\n";
|
||||
echo " <option value='phrase:'>phrase:</option>\n";
|
||||
echo " <option value='say:'>say:</option>\n";
|
||||
echo " <option value='tone_stream:'>tone_stream:</option>\n";
|
||||
echo " <option value='phrase:'>phrase:</option>\n";
|
||||
echo " <option value='say:'>say:</option>\n";
|
||||
echo " <option value='tone_stream:'>tone_stream:</option>\n";
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
//recordings
|
||||
@@ -500,10 +522,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
else {
|
||||
if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($ivr_menu_greet_short) > 0) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected='selected'>".$file."</option>\n";
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected='selected'>".$file."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,6 +533,22 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
closedir($dh);
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
//phrases
|
||||
echo "<optgroup label='phrases'>\n";
|
||||
$sql = "select * from v_phrases where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
if ($ivr_menu_greet_short == "phrase:".$row["phrase_name"].".".$domain_uuid) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."' selected='selected'>".$row["phrase_name"]."</option>\n";
|
||||
} else {
|
||||
echo " <option value='phrase:".$row["phrase_name"].".".$domain_uuid."'>".$row["phrase_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($prep_statement);
|
||||
echo "</optgroup>\n";
|
||||
//sounds
|
||||
$dir_path = $_SESSION['switch']['sounds']['dir'];
|
||||
recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
|
||||
@@ -522,9 +560,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
}
|
||||
if ($ivr_menu_greet_short == $key) {
|
||||
$tmp_selected = true;
|
||||
echo " <option value='$key' selected='selected'>$key</option>\n";
|
||||
echo " <option value='$key' selected='selected'>$key</option>\n";
|
||||
} else {
|
||||
echo " <option value='$key'>$key</option>\n";
|
||||
echo " <option value='$key'>$key</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,17 +572,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
if (!$tmp_selected && strlen($ivr_menu_greet_short) > 0) {
|
||||
echo "<optgroup label='selected'>\n";
|
||||
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short)) {
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
echo " <option value='".$_SESSION['switch']['recordings']['dir']."/".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
} elseif (substr($ivr_menu_greet_short, -3) == "wav" || substr($ivr_menu_greet_short, -3) == "mp3") {
|
||||
echo " <option value='".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
echo " <option value='".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
} else {
|
||||
echo " <option value='".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
echo " <option value='".$ivr_menu_greet_short."' selected='selected'>".$ivr_menu_greet_short."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
unset($tmp_selected);
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " </select>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
echo $text['description-greet_short']."\n";
|
||||
|
||||
147
app/phrases/app_config.php
Normal file
147
app/phrases/app_config.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = "Phrases";
|
||||
//5c6f597c-9b78-11e4-89d3-123b93f75cba
|
||||
$apps[$x]['uuid'] = "5c6f597c-9b78-11e4-89d3-123b93f75cba";
|
||||
$apps[$x]['category'] = "Switch";;
|
||||
$apps[$x]['subcategory'] = "";
|
||||
$apps[$x]['version'] = "0.1";
|
||||
$apps[$x]['license'] = "Mozilla Public License 1.1";
|
||||
$apps[$x]['url'] = "http://www.fusionpbx.com";
|
||||
$apps[$x]['description']['en-us'] = "Manager phrases primarily used with an IVR.";
|
||||
$apps[$x]['description']['es-cl'] = "Administrador de grabaciones, utilizadas primordialmente con un IVR";
|
||||
$apps[$x]['description']['es-mx'] = "";
|
||||
$apps[$x]['description']['de-de'] = "";
|
||||
$apps[$x]['description']['de-ch'] = "";
|
||||
$apps[$x]['description']['de-at'] = "";
|
||||
$apps[$x]['description']['fr-fr'] = "Gestion des enregistrements principalement utilisés dans les IVR";
|
||||
$apps[$x]['description']['fr-ca'] = "";
|
||||
$apps[$x]['description']['fr-ch'] = "";
|
||||
$apps[$x]['description']['pt-pt'] = "Gestor de gravações utilizadas principalmente com um IVR.";
|
||||
$apps[$x]['description']['pt-br'] = "";
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = "phrase_view";
|
||||
$apps[$x]['permissions'][0]['menu']['uuid'] = "a5caa6dc-a6d7-41c3-a484-e556ffd0d2ff";
|
||||
$apps[$x]['permissions'][0]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][0]['groups'][] = "superadmin";
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = "phrase_add";
|
||||
$apps[$x]['permissions'][1]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][1]['groups'][] = "superadmin";
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = "phrase_edit";
|
||||
$apps[$x]['permissions'][2]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][2]['groups'][] = "superadmin";
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = "phrase_delete";
|
||||
$apps[$x]['permissions'][3]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][3]['groups'][] = "superadmin";
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = "phrase_play";
|
||||
$apps[$x]['permissions'][4]['groups'][] = "user";
|
||||
$apps[$x]['permissions'][4]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][4]['groups'][] = "superadmin";
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_phrases";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phrase_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_name";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_language";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_description";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_enabled";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
//schema details
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_phrase_details";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phrase_detail_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phrase_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_phrases";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "phrase_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_group";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_tag";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_pattern";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_function";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_data";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_method";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_type";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "phrase_detail_order";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
|
||||
|
||||
?>
|
||||
103
app/phrases/app_defaults.php
Normal file
103
app/phrases/app_defaults.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//define array of settings
|
||||
$x = 0;
|
||||
$array[$x]['default_setting_category'] = 'switch';
|
||||
$array[$x]['default_setting_subcategory'] = 'phrases';
|
||||
$array[$x]['default_setting_name'] = 'dir';
|
||||
$array[$x]['default_setting_value'] = '/usr/local/freeswitch/conf/lang';
|
||||
$array[$x]['default_setting_enabled'] = 'true';
|
||||
$array[$x]['default_setting_description'] = '';
|
||||
$x++;
|
||||
|
||||
//iterate and add each, if necessary
|
||||
foreach ($array as $index => $default_settings) {
|
||||
|
||||
//add default settings
|
||||
$sql = "select count(*) as num_rows from v_default_settings ";
|
||||
$sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' ";
|
||||
$sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' ";
|
||||
$sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset($prep_statement);
|
||||
if ($row['num_rows'] == 0) {
|
||||
$orm = new orm;
|
||||
$orm->name('default_settings');
|
||||
$orm->save($array[$index]);
|
||||
$message = $orm->message;
|
||||
//print_r($message);
|
||||
}
|
||||
unset($row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//create phrases folder and add include line in xml for each language found
|
||||
if (strlen($_SESSION['switch']['phrases']['dir']) > 0) {
|
||||
if (is_readable($_SESSION['switch']['phrases']['dir'])) {
|
||||
$conf_lang_folders = glob($_SESSION['switch']['phrases']['dir']."/*");
|
||||
foreach ($conf_lang_folders as $conf_lang_folder) {
|
||||
//create phrases folder, if necessary
|
||||
if (!file_exists($conf_lang_folder."/phrases/")) {
|
||||
mkdir($conf_lang_folder."/phrases/", 0777);
|
||||
}
|
||||
//parse language, open xml file
|
||||
$conf_lang = substr($conf_lang_folder, -2);
|
||||
if (file_exists($conf_lang_folder."/".$conf_lang.".xml")) {
|
||||
$conf_lang_xml_file_lines = file($conf_lang_folder."/".$conf_lang.".xml");
|
||||
//check for phrases inclusion
|
||||
$phrases_include_found = false;
|
||||
foreach ($conf_lang_xml_file_lines as $conf_lang_xml_file_line) {
|
||||
if (substr_count($conf_lang_xml_file_line, "phrases/*.xml") > 0) { $phrases_include_found = true; }
|
||||
}
|
||||
if (!$phrases_include_found) {
|
||||
//loop through lines to find closing macros index
|
||||
foreach ($conf_lang_xml_file_lines as $conf_lang_xml_file_line_index => $conf_lang_xml_file_line) {
|
||||
if (substr_count($conf_lang_xml_file_line, "</macros>") > 0) {
|
||||
array_splice($conf_lang_xml_file_lines, $conf_lang_xml_file_line_index, 0, "\t\t\t\t<X-PRE-PROCESS cmd=\"include\" data=\"phrases/*.xml\"/>\n");
|
||||
}
|
||||
}
|
||||
//re-write xml file contents
|
||||
$conf_lang_xml_str = implode("", $conf_lang_xml_file_lines);
|
||||
$fh = fopen($conf_lang_folder."/".$conf_lang.".xml", "w");
|
||||
fwrite($fh, $conf_lang_xml_str);
|
||||
fclose($fh);
|
||||
}
|
||||
} //if
|
||||
} //foreach
|
||||
} //if
|
||||
} //if
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
219
app/phrases/app_languages.php
Normal file
219
app/phrases/app_languages.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
$text['title_phrases']['en-us'] = "Phrases";
|
||||
$text['title_phrases']['es-cl'] = "Grabaciones";
|
||||
$text['title_phrases']['pt-pt'] = "Gravações";
|
||||
$text['title_phrases']['fr-fr'] = "Guides Vocaux";
|
||||
|
||||
$text['title-add_phrase']['en-us'] = "Add Phrase";
|
||||
$text['title-add_phrase']['es-cl'] = "Añadir Frase";
|
||||
$text['title-add_phrase']['pt-pt'] = "Añadir Frase";
|
||||
$text['title-add_phrase']['fr-fr'] = "Ajouter Phrase";
|
||||
|
||||
$text['title-edit_phrase']['en-us'] = "Edit Phrase";
|
||||
$text['title-edit_phrase']['es-cl'] = "Editar Frase";
|
||||
$text['title-edit_phrase']['pt-pt'] = "Editar Frase";
|
||||
$text['title-edit_phrase']['fr-fr'] = "Modifier Phrase";
|
||||
|
||||
$text['header_phrases']['en-us'] = "Phrases";
|
||||
$text['header_phrases']['es-cl'] = "Grabaciones";
|
||||
$text['header_phrases']['pt-pt'] = "Gravações";
|
||||
$text['header_phrases']['fr-fr'] = "Guides Vocaux";
|
||||
|
||||
$text['header-add_phrase']['en-us'] = "Add Phrase";
|
||||
$text['header-add_phrase']['es-cl'] = "Añadir Frase";
|
||||
$text['header-add_phrase']['pt-pt'] = "Añadir Frase";
|
||||
$text['header-add_phrase']['fr-fr'] = "Ajouter Phrase";
|
||||
|
||||
$text['header-edit_phrase']['en-us'] = "Edit Phrase";
|
||||
$text['header-edit_phrase']['es-cl'] = "Editar Frase";
|
||||
$text['header-edit_phrase']['pt-pt'] = "Editar Frase";
|
||||
$text['header-edit_phrase']['fr-fr'] = "Modifier Phrase";
|
||||
|
||||
$text['description-phrases']['en-us'] = "Create phrases of audio files to be played in sequence.";
|
||||
$text['description-phrases']['es-cl'] = "Crear frases de archivos de audio para ser jugados en secuencia.";
|
||||
$text['description-phrases']['pt-pt'] = "Criar frases de arquivos de áudio para serem tocados em sequência.";
|
||||
$text['description-phrases']['fr-fr'] = "Créer des phrases de fichiers audio à jouer dans l'ordre.";
|
||||
|
||||
$text['label-name']['en-us'] = "Name";
|
||||
$text['label-name']['es-cl'] = "Nombre";
|
||||
$text['label-name']['pt-pt'] = "Nome";
|
||||
$text['label-name']['fr-fr'] = "Nom";
|
||||
|
||||
$text['description-name']['en-us'] = "Name for the phrase (Example: 'xyz_audio')";
|
||||
$text['description-name']['es-cl'] = "Nombre de la grabación. ejemplo: grabacion_x";
|
||||
$text['description-name']['pt-pt'] = "Nome da gravação. exemplo: recording_x";
|
||||
$text['description-name']['fr-fr'] = "Nom de l'enregistrement. exemple: enregistrement_x";
|
||||
|
||||
$text['label-language']['en-us'] = "Language";
|
||||
$text['label-language']['es-cl'] = "Idioma";
|
||||
$text['label-language']['pt-pt'] = "Língua";
|
||||
$text['label-language']['fr-fr'] = "Langue";
|
||||
|
||||
$text['description-language']['en-us'] = "Language used in the phrase.";
|
||||
$text['description-language']['es-cl'] = "El lenguaje utilizado en la frase.";
|
||||
$text['description-language']['pt-pt'] = "Linguagem utilizada na frase.";
|
||||
$text['description-language']['fr-fr'] = "Langue utilisée dans la phrase.";
|
||||
|
||||
$text['label-structure']['en-us'] = "Structure";
|
||||
$text['label-structure']['es-cl'] = "";
|
||||
$text['label-structure']['pt-pt'] = "";
|
||||
$text['label-structure']['fr-fr'] = "";
|
||||
|
||||
$text['description-structure']['en-us'] = "Define the various components that make up the phrase.";
|
||||
$text['description-structure']['es-cl'] = "";
|
||||
$text['description-structure']['pt-pt'] = "";
|
||||
$text['description-structure']['fr-fr'] = "";
|
||||
|
||||
$text['label-function']['en-us'] = "Function";
|
||||
$text['label-function']['es-cl'] = "";
|
||||
$text['label-function']['pt-pt'] = "";
|
||||
$text['label-function']['fr-fr'] = "";
|
||||
|
||||
$text['label-file']['en-us'] = "File";
|
||||
$text['label-file']['es-cl'] = "";
|
||||
$text['label-file']['pt-pt'] = "";
|
||||
$text['label-file']['fr-fr'] = "";
|
||||
|
||||
$text['label-order']['en-us'] = "Order";
|
||||
$text['label-order']['es-cl'] = "Orden";
|
||||
$text['label-order']['pt-pt'] = "Ordem";
|
||||
$text['label-order']['fr-fr'] = "Ordre";
|
||||
|
||||
$text['label-play_file']['en-us'] = "Play File";
|
||||
$text['label-play_file']['es-cl'] = "";
|
||||
$text['label-play_file']['pt-pt'] = "";
|
||||
$text['label-play_file']['fr-fr'] = "";
|
||||
|
||||
$text['label-say']['en-us'] = "Say";
|
||||
$text['label-say']['es-cl'] = "";
|
||||
$text['label-say']['pt-pt'] = "";
|
||||
$text['label-say']['fr-fr'] = "";
|
||||
|
||||
$text['label-execute']['en-us'] = "Execute";
|
||||
$text['label-execute']['es-cl'] = "";
|
||||
$text['label-execute']['pt-pt'] = "";
|
||||
$text['label-execute']['fr-fr'] = "";
|
||||
|
||||
$text['label-description']['en-us'] = "Description";
|
||||
$text['label-description']['es-cl'] = "Descripción";
|
||||
$text['label-description']['pt-pt'] = "Descrição";
|
||||
$text['label-description']['fr-fr'] = "Description";
|
||||
|
||||
$text['label-tools']['en-us'] = "Tools";
|
||||
$text['label-tools']['es-cl'] = "Instrumentos";
|
||||
$text['label-tools']['pt-pt'] = "Ferramentas";
|
||||
$text['label-tools']['fr-fr'] = "Outils";
|
||||
|
||||
$text['label-play']['en-us'] = "Play";
|
||||
$text['label-play']['es-cl'] = "Reproducir";
|
||||
$text['label-play']['pt-pt'] = "Tocar";
|
||||
$text['label-play']['fr-fr'] = "Jouer";
|
||||
|
||||
$text['label-pause']['en-us'] = "Pause";
|
||||
$text['label-pause']['es-cl'] = "Pausa";
|
||||
$text['label-pause']['pt-pt'] = "Pausa";
|
||||
$text['label-pause']['fr-fr'] = "Pause";
|
||||
|
||||
$text['label-enabled']['en-us'] = "Enabled";
|
||||
$text['label-enabled']['es-cl'] = "Activado";
|
||||
$text['label-enabled']['pt-pt'] = "Habilitada";
|
||||
$text['label-enabled']['fr-fr'] = "Actif";
|
||||
|
||||
$text['description-enabled']['en-us'] = "Set the status of the phrase.";
|
||||
$text['description-enabled']['es-cl'] = "Ajuste el estado de la frase.";
|
||||
$text['description-enabled']['pt-pt'] = "Defina o status da frase.";
|
||||
$text['description-enabled']['fr-fr'] = "Définition de l'état de la phrase.";
|
||||
|
||||
$text['label-true']['en-us'] = "True";
|
||||
$text['label-true']['es-cl'] = "Verdadero";
|
||||
$text['label-true']['pt-pt'] = "Sim";
|
||||
$text['label-true']['fr-fr'] = "Oui";
|
||||
|
||||
$text['label-false']['en-us'] = "False";
|
||||
$text['label-false']['es-cl'] = "Falso";
|
||||
$text['label-false']['pt-pt'] = "Não";
|
||||
$text['label-false']['fr-fr'] = "Non";
|
||||
|
||||
$text['confirm-delete']['en-us'] = "Do you really want to delete this?";
|
||||
$text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar esto?";
|
||||
$text['confirm-delete']['pt-pt'] = "Deseja realmente remover isto?";
|
||||
$text['confirm-delete']['fr-fr'] = "Voulez-vous vraiment supprimer cela?";
|
||||
|
||||
$text['message-add']['en-us'] = "Add Complete";
|
||||
$text['message-add']['es-cl'] = "Agregar Completado";
|
||||
$text['message-add']['pt-pt'] = "Adição Efectuada";
|
||||
$text['message-add']['fr-fr'] = "Ajouté";
|
||||
|
||||
$text['message-update']['en-us'] = "Update Complete";
|
||||
$text['message-update']['es-cl'] = "Actualización Completada";
|
||||
$text['message-update']['pt-pt'] = "Actualização Efectuada";
|
||||
$text['message-update']['fr-fr'] = "Mis à jour";
|
||||
|
||||
$text['message-delete']['en-us'] = "Delete Complete";
|
||||
$text['message-delete']['es-cl'] = "Eliminación Completa";
|
||||
$text['message-delete']['pt-pt'] = "Remoçãoo Realizada";
|
||||
$text['message-delete']['fr-fr'] = "Supprimé";
|
||||
|
||||
$text['message-required']['en-us'] = "Please provide: ";
|
||||
$text['message-required']['es-cl'] = "Por favor ingrese: ";
|
||||
$text['message-required']['pt-pt'] = "Por favor forneça: ";
|
||||
$text['message-required']['fr-fr'] = "Merci d'indiquer: ";
|
||||
|
||||
$text['button-add']['en-us'] = "Add";
|
||||
$text['button-add']['es-cl'] = "Agregar";
|
||||
$text['button-add']['pt-pt'] = "Adicionar";
|
||||
$text['button-add']['fr-fr'] = "Ajouter";
|
||||
|
||||
$text['button-edit']['en-us'] = "Edit";
|
||||
$text['button-edit']['es-cl'] = "Editar";
|
||||
$text['button-edit']['pt-pt'] = "Editar";
|
||||
$text['button-edit']['fr-fr'] = "Editer";
|
||||
|
||||
$text['button-delete']['en-us'] = "Delete";
|
||||
$text['button-delete']['es-cl'] = "Eliminar";
|
||||
$text['button-delete']['pt-pt'] = "Remover";
|
||||
$text['button-delete']['fr-fr'] = "Supprimer";
|
||||
|
||||
$text['button-back']['en-us'] = "Back";
|
||||
$text['button-back']['es-cl'] = "Volver";
|
||||
$text['button-back']['pt-pt'] = "Voltar";
|
||||
$text['button-back']['fr-fr'] = "Retour";
|
||||
|
||||
$text['button-save']['en-us'] = "Save";
|
||||
$text['button-save']['es-cl'] = "Guardar";
|
||||
$text['button-save']['pt-pt'] = "Gravar";
|
||||
$text['button-save']['fr-fr'] = "Sauvegarder";
|
||||
|
||||
$text['button-advanced']['en-us'] = "Advanced";
|
||||
$text['button-advanced']['es-cl'] = "Avanzado";
|
||||
$text['button-advanced']['pt-pt'] = "Avançadas";
|
||||
$text['button-advanced']['fr-fr'] = "Afficher les paramètres avancés";
|
||||
|
||||
|
||||
|
||||
?>
|
||||
21
app/phrases/app_menu.php
Normal file
21
app/phrases/app_menu.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = "Phrases";
|
||||
$apps[$x]['menu'][0]['title']['es-cl'] = "Grabaciones";
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-de'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = "";
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-fr'] = "Guides Vocaux";
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = "";
|
||||
$apps[$x]['menu'][0]['title']['fr-ch'] = "";
|
||||
$apps[$x]['menu'][0]['title']['pt-pt'] = "Gravações";
|
||||
$apps[$x]['menu'][0]['title']['pt-br'] = "";
|
||||
$apps[$x]['menu'][0]['uuid'] = "a5caa6dc-a6d7-41c3-a484-e556ffd0d2ff";
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = "fd29e39c-c936-f5fc-8e2b-611681b266b5";
|
||||
$apps[$x]['menu'][0]['category'] = "internal";
|
||||
$apps[$x]['menu'][0]['path'] = "/app/phrases/phrases.php";
|
||||
$apps[$x]['menu'][0]['groups'][] = "admin";
|
||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||
|
||||
?>
|
||||
71
app/phrases/phrase_delete.php
Normal file
71
app/phrases/phrase_delete.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/functions/save_phrases_xml.php";
|
||||
|
||||
if (permission_exists('phrase_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get values
|
||||
$phrase_uuid = $_GET["id"];
|
||||
|
||||
if ($phrase_uuid != '') {
|
||||
//delete phrase details
|
||||
$sql = "delete from v_phrase_details ";
|
||||
$sql .= "where phrase_uuid = '".$phrase_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//delete phrase
|
||||
$sql = "delete from v_phrases ";
|
||||
$sql .= "where phrase_uuid = '".$phrase_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
save_phrases_xml();
|
||||
|
||||
//redirect the user
|
||||
$_SESSION["message"] = $text['message-delete'];
|
||||
header("Location: phrases.php");
|
||||
return;
|
||||
?>
|
||||
63
app/phrases/phrase_detail_delete.php
Normal file
63
app/phrases/phrase_detail_delete.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/functions/save_phrases_xml.php";
|
||||
|
||||
if (permission_exists('phrase_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get values
|
||||
$phrase_detail_uuid = check_str($_GET["pdid"]);
|
||||
$phrase_uuid = check_str($_GET["pid"]);
|
||||
|
||||
//delete the detail entry
|
||||
if ($phrase_detail_uuid != '' && $phrase_uuid != '') {
|
||||
$sql = "delete from v_phrase_details ";
|
||||
$sql .= " where phrase_detail_uuid = '".$phrase_detail_uuid."'";
|
||||
$sql .= " and phrase_uuid = '".$phrase_uuid."' ";
|
||||
$sql .= " and domain_uuid = '".$domain_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
save_phrases_xml();
|
||||
|
||||
//redirect the user
|
||||
$_SESSION['message'] = $text['message-delete'];
|
||||
header('Location: phrase_edit.php?id='.$phrase_uuid);
|
||||
|
||||
?>
|
||||
463
app/phrases/phrase_edit.php
Normal file
463
app/phrases/phrase_edit.php
Normal file
@@ -0,0 +1,463 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
require_once "resources/functions/save_phrases_xml.php";
|
||||
|
||||
if (permission_exists('phrase_add') || permission_exists('phrase_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the action as an add or an update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$phrase_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get the form value and set to php variables
|
||||
if (count($_POST)>0) {
|
||||
$phrase_name = check_str($_POST["phrase_name"]);
|
||||
$phrase_language = check_str($_POST["phrase_language"]);
|
||||
$phrase_enabled = check_str($_POST["phrase_enabled"]);
|
||||
$phrase_description = check_str($_POST["phrase_description"]);
|
||||
|
||||
//clean the name
|
||||
$phrase_name = str_replace(" ", "_", $phrase_name);
|
||||
$phrase_name = str_replace("'", "", $phrase_name);
|
||||
}
|
||||
|
||||
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$phrase_uuid = check_str($_POST["phrase_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
if (strlen($phrase_name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
|
||||
if (strlen($phrase_language) == 0) { $msg .= $text['message-required']." ".$text['label-language']."<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/persist_form_var.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "resources/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('phrase_add')) {
|
||||
$phrase_uuid = uuid();
|
||||
$sql = "insert into v_phrases ";
|
||||
$sql .= "( ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "phrase_uuid, ";
|
||||
$sql .= "phrase_name, ";
|
||||
$sql .= "phrase_language, ";
|
||||
$sql .= "phrase_enabled, ";
|
||||
$sql .= "phrase_description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$phrase_uuid."', ";
|
||||
$sql .= "'".$phrase_name."', ";
|
||||
$sql .= "'".$phrase_language."', ";
|
||||
$sql .= "'".$phrase_enabled."', ";
|
||||
$sql .= "'".$phrase_description."' ";
|
||||
$sql .= ") ";
|
||||
//echo $sql."<br><br>";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($_POST['phrase_detail_function'] != '') {
|
||||
$_POST['phrase_detail_tag'] = 'action'; // default, for now
|
||||
$_POST['phrase_detail_group'] = "0"; // one group, for now
|
||||
|
||||
$phrase_detail_uuid = uuid();
|
||||
$sql = "insert into v_phrase_details ";
|
||||
$sql .= "( ";
|
||||
$sql .= "phrase_detail_uuid, ";
|
||||
$sql .= "phrase_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "phrase_detail_order, ";
|
||||
$sql .= "phrase_detail_tag, ";
|
||||
$sql .= "phrase_detail_pattern, ";
|
||||
$sql .= "phrase_detail_function, ";
|
||||
$sql .= "phrase_detail_data, ";
|
||||
$sql .= "phrase_detail_method, ";
|
||||
$sql .= "phrase_detail_type, ";
|
||||
$sql .= "phrase_detail_group ";
|
||||
$sql .= " ) ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$phrase_detail_uuid."', ";
|
||||
$sql .= "'".$phrase_uuid."', ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_order']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_tag']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_pattern']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_function']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_data']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_method']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_type']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_group']."' ";
|
||||
$sql .= ") ";
|
||||
//echo $sql."<br><br>";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
save_phrases_xml();
|
||||
|
||||
$_SESSION["message"] = $text['message-add'];
|
||||
header("Location: phrase_edit.php?id=".$phrase_uuid);
|
||||
return;
|
||||
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('phrase_edit')) {
|
||||
//update the database with the new data
|
||||
$sql = "update v_phrases set ";
|
||||
$sql .= "phrase_name = '".$phrase_name."', ";
|
||||
$sql .= "phrase_language = '".$phrase_language."', ";
|
||||
$sql .= "phrase_enabled = '".$phrase_enabled."', ";
|
||||
$sql .= "phrase_description = '".$phrase_description."' ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and phrase_uuid = '".$phrase_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
if ($_POST['phrase_detail_function'] != '') {
|
||||
$_POST['phrase_detail_tag'] = 'action'; // default, for now
|
||||
$_POST['phrase_detail_group'] = "0"; // one group, for now
|
||||
|
||||
$phrase_detail_uuid = uuid();
|
||||
$sql = "insert into v_phrase_details ";
|
||||
$sql .= "( ";
|
||||
$sql .= "phrase_detail_uuid, ";
|
||||
$sql .= "phrase_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "phrase_detail_order, ";
|
||||
$sql .= "phrase_detail_tag, ";
|
||||
$sql .= "phrase_detail_pattern, ";
|
||||
$sql .= "phrase_detail_function, ";
|
||||
$sql .= "phrase_detail_data, ";
|
||||
$sql .= "phrase_detail_method, ";
|
||||
$sql .= "phrase_detail_type, ";
|
||||
$sql .= "phrase_detail_group ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$phrase_detail_uuid."', ";
|
||||
$sql .= "'".$phrase_uuid."', ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_order']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_tag']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_pattern']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_function']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_data']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_method']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_type']."', ";
|
||||
$sql .= "'".$_POST['phrase_detail_group']."' ";
|
||||
$sql .= ") ";
|
||||
//echo $sql."<br><br>";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
save_phrases_xml();
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
header("Location: phrase_edit.php?id=".$phrase_uuid);
|
||||
return;
|
||||
|
||||
} //if ($action == "update")
|
||||
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$phrase_uuid = $_GET["id"];
|
||||
$sql = "select * from v_phrases ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and phrase_uuid = '".$phrase_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$phrase_name = $row["phrase_name"];
|
||||
$phrase_language = $row["phrase_language"];
|
||||
$phrase_enabled = $row["phrase_enabled"];
|
||||
$phrase_description = $row["phrase_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
if ($action == 'add') { $document['title'] = $text['title-add_phrase']; }
|
||||
if ($action == 'update') { $document['title'] = $text['title-edit_phrase']; }
|
||||
|
||||
//show the content
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td align='left' width='30%' nowrap valign='top'>";
|
||||
if ($action == "add") { echo "<b>".$text['title-add_phrase']."</b>"; }
|
||||
if ($action == "update") { echo "<b>".$text['title-edit_phrase']."</b>"; }
|
||||
echo " <br /><br />";
|
||||
echo " </td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'>";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='phrases.php'\" value='".$text['button-back']."'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='phrase_name' maxlength='255' value=\"$phrase_name\">\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$text['description-name']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-language']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='phrase_language' maxlength='255' value=\"$phrase_language\">\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$text['description-language']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (if_group("superadmin")) {
|
||||
echo "<script>\n";
|
||||
echo "var Objs;\n";
|
||||
echo "\n";
|
||||
echo "function changeToInput(obj){\n";
|
||||
echo " tb=document.createElement('INPUT');\n";
|
||||
echo " tb.type='text';\n";
|
||||
echo " tb.name=obj.name;\n";
|
||||
echo " tb.setAttribute('class', 'formfld');\n";
|
||||
echo " tb.setAttribute('style', 'width: 280px;');\n";
|
||||
echo " tb.value=obj.options[obj.selectedIndex].value;\n";
|
||||
echo " tbb=document.createElement('INPUT');\n";
|
||||
echo " tbb.setAttribute('class', 'btn');\n";
|
||||
echo " tbb.setAttribute('style', 'margin-left: 4px;');\n";
|
||||
echo " tbb.type='button';\n";
|
||||
echo " tbb.value=$('<div />').html('◁').text();\n";
|
||||
echo " tbb.objs=[obj,tb,tbb];\n";
|
||||
echo " tbb.onclick=function(){ Replace(this.objs); }\n";
|
||||
echo " obj.parentNode.insertBefore(tb,obj);\n";
|
||||
echo " obj.parentNode.insertBefore(tbb,obj);\n";
|
||||
echo " obj.parentNode.removeChild(obj);\n";
|
||||
echo "}\n";
|
||||
echo "\n";
|
||||
echo "function Replace(obj){\n";
|
||||
echo " obj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
|
||||
echo " obj[0].parentNode.removeChild(obj[1]);\n";
|
||||
echo " obj[0].parentNode.removeChild(obj[2]);\n";
|
||||
echo "}\n";
|
||||
echo "</script>\n";
|
||||
echo "\n";
|
||||
}
|
||||
echo "<tr>";
|
||||
echo "<td class='vncell' valign='top'>".$text['label-structure']."</td>";
|
||||
echo "<td class='vtable' align='left'>";
|
||||
echo " <table width='59%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vtable'>".$text['label-function']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-file']."</td>\n";
|
||||
echo " <td class='vtable' style='text-align: center;'>".$text['label-order']."</td>\n";
|
||||
echo " <td></td>\n";
|
||||
echo " </tr>\n";
|
||||
if (strlen($phrase_uuid) > 0) {
|
||||
$sql = "select * from v_phrase_details ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and phrase_uuid = '".$phrase_uuid."' ";
|
||||
$sql .= "order by phrase_detail_order asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable'>".$field['phrase_detail_function']." </td>\n";
|
||||
echo " <td class='vtable'>".$field['phrase_detail_data']." </td>\n";
|
||||
echo " <td class='vtable' style='text-align: center;'>".$field['phrase_detail_order']." </td>\n";
|
||||
echo " <td class='list_control_icons' style='text-align: left;'>";
|
||||
echo "<a href='phrase_detail_delete.php?pdid=".$field['phrase_detail_uuid']."&pid=".$phrase_uuid."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
unset($sql, $result);
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||
echo " <select name='phrase_detail_function' class='formfld' onchange=\"if (this.selectedIndex == 2) { changeToInput(getElementById('phrase_detail_data')); }\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo " <option value='play-file'>".$text['label-play_file']."</option>\n";
|
||||
if (if_group("superadmin")) {
|
||||
echo " <option value='execute'>".$text['label-execute']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left' nowrap='nowrap'>\n";
|
||||
echo " <select name='phrase_detail_data' id='phrase_detail_data' class='formfld' style='width: 300px' ".((if_group("superadmin")) ? "onchange='changeToInput(this);'" : null).">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//recordings
|
||||
if($dh = opendir($_SESSION['switch']['recordings']['dir']."/")) {
|
||||
$tmp_selected = false;
|
||||
$files = Array();
|
||||
echo " <optgroup label='recordings'>\n";
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($_SESSION['switch']['recordings']['dir'] . "/" . $file)) {
|
||||
//this is a directory
|
||||
}
|
||||
else {
|
||||
if ($ivr_menu_greet_short == $_SESSION['switch']['recordings']['dir']."/".$file && strlen($ivr_menu_greet_short) > 0) {
|
||||
$tmp_selected = true;
|
||||
echo "<option value='".$_SESSION['switch']['recordings']['dir']."/".$file."' selected='selected'>".$file."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$_SESSION['switch']['recordings']['dir']."/".$file."'>".$file."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
//sounds
|
||||
$dir_path = $_SESSION['switch']['sounds']['dir'];
|
||||
recur_sounds_dir($_SESSION['switch']['sounds']['dir']);
|
||||
echo " <optgroup label='sounds'>\n";
|
||||
foreach ($dir_array as $key => $value) {
|
||||
if (strlen($value) > 0) {
|
||||
if (substr($ivr_menu_greet_long, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
|
||||
$ivr_menu_greet_long = substr($ivr_menu_greet_long, 71);
|
||||
}
|
||||
if ($ivr_menu_greet_long == $key) {
|
||||
$tmp_selected = true;
|
||||
echo "<option value='$key' selected='selected'>$key</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='$key'>$key</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </optgroup>\n";
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable'>\n";
|
||||
echo " <select name='phrase_detail_order' class='formfld'>\n";
|
||||
for ($i = 0; $i <= 999; $i++) {
|
||||
$i_padded = str_pad($i, 3, '0', STR_PAD_LEFT);
|
||||
echo " <option value='".$i_padded."'>".$i_padded."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td>\n";
|
||||
echo " <input type='submit' class='btn' alt=\"".$text['button-add']."\" value=\"".$text['button-add']."\">\n";
|
||||
echo " </td>\n";
|
||||
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo " ".$text['description-structure']."\n";
|
||||
echo " <br />\n";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='phrase_enabled'>\n";
|
||||
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||
echo " <option value='false' ".(($phrase_enabled == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo $text['description-enabled']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='phrase_description' maxlength='255' value=\"".$phrase_description."\">\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='phrase_uuid' value='".$phrase_uuid."'>\n";
|
||||
}
|
||||
echo " <br />";
|
||||
echo " <input type='submit' name='submit' class='btn' alt=\"".$text['button-save']."\" value='".$text['button-save']."'>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
154
app/phrases/phrases.php
Normal file
154
app/phrases/phrases.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//check the permission
|
||||
if (!permission_exists('phrase_view')) {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add paging
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//include the header
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-phrases'];
|
||||
|
||||
//begin the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <b>".$text['header_phrases']."</b>\n";
|
||||
echo " <br /><br />\n";
|
||||
echo " ".$text['description-phrases']."\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
|
||||
$sql = "select * from v_phrases ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$num_rows = count($result);
|
||||
unset ($prep_statement, $result, $sql);
|
||||
|
||||
$rows_per_page = 50;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
$sql = "select * from v_phrases ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "order by ".((strlen($order_by) > 0) ? $order_by." ".$order." " : "phrase_name asc ");
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('phrase_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('phrase_language', $text['label-language'], $order_by, $order);
|
||||
echo th_order_by('phrase_enabled', $text['label-enabled'], $order_by, $order);
|
||||
echo th_order_by('phrase_description', $text['label-description'], $order_by, $order);
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('phrase_add')) {
|
||||
echo "<a href='phrase_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$tr_link = (permission_exists('phrase_edit')) ? "href='phrase_edit.php?id=".$row['phrase_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['phrase_name']."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['phrase_language']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['phrase_enabled']]." </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['phrase_description']." </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('phrase_edit')) {
|
||||
echo "<a href='phrase_edit.php?id=".$row['phrase_uuid']."' alt='".$text['button-edit']."'>".$v_link_label_edit."</a>";
|
||||
}
|
||||
if (permission_exists('phrase_delete')) {
|
||||
echo "<a href='phrase_delete.php?id=".$row['phrase_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$c = ($c==0) ? 1 : 0;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='4'> </td>\n";
|
||||
echo "<td class='list_control_icons'>";
|
||||
if (permission_exists('phrase_add')) {
|
||||
echo "<a href='phrase_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\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'>";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
81
app/phrases/resources/functions/save_phrases_xml.php
Normal file
81
app/phrases/resources/functions/save_phrases_xml.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
function save_phrases_xml() {
|
||||
|
||||
//skip saving the xml if the directory is not set
|
||||
if (strlen($_SESSION['switch']['phrases']['dir']) == 0) {
|
||||
return;
|
||||
}
|
||||
//declare the global variables
|
||||
global $db, $domain_uuid, $config;
|
||||
|
||||
//remove old phrase files for the domain
|
||||
$phrase_list = glob($_SESSION['switch']['phrases']['dir']."/*/phrases/".$domain_uuid.".xml");
|
||||
foreach ($phrase_list as $phrase_file) {
|
||||
unlink($phrase_file);
|
||||
}
|
||||
|
||||
//get the list of phrases and write the xml
|
||||
$sql = "select * from v_phrases ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and phrase_enabled = 'true' ";
|
||||
$sql .= "order by phrase_language asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$prev_language = '';
|
||||
foreach ($result as $row) {
|
||||
|
||||
if ($row['phrase_language'] != $prev_language) {
|
||||
if ($prev_language != '') {
|
||||
//output xml & close previous file
|
||||
$xml .= "</include>\n";
|
||||
fwrite($fout, $xml);
|
||||
unset($xml);
|
||||
fclose($fout);
|
||||
}
|
||||
|
||||
//create/open new xml file for writing
|
||||
$xml_path = $_SESSION['switch']['phrases']['dir']."/".$row['phrase_language']."/phrases/".$domain_uuid.".xml";
|
||||
$fout = fopen($xml_path, "w");
|
||||
$xml = "<include>\n";
|
||||
}
|
||||
|
||||
//build xml
|
||||
$xml .= " <macro name=\"".$row['phrase_name'].".".$domain_uuid."\">\n";
|
||||
$xml .= " <input pattern=\"(.*)\">\n";
|
||||
$xml .= " <match>\n";
|
||||
|
||||
$sql2 = "select * from v_phrase_details ";
|
||||
$sql2 .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql2 .= "and phrase_uuid = '".$row['phrase_uuid']."' ";
|
||||
$sql2 .= "order by phrase_detail_order";
|
||||
$prep_statement2 = $db->prepare(check_sql($sql2));
|
||||
$prep_statement2->execute();
|
||||
$result2 = $prep_statement2->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach ($result2 as &$row2) {
|
||||
$xml .= " <action function=\"".$row2['phrase_detail_function']."\" data=\"".$row2['phrase_detail_data']."\"/>\n";
|
||||
}
|
||||
unset($prep_statement2);
|
||||
$xml .= " </match>\n";
|
||||
$xml .= " </input>\n";
|
||||
$xml .= " </macro>\n";
|
||||
|
||||
$prev_language = $row['phrase_language'];
|
||||
|
||||
}
|
||||
|
||||
//output xml & close previous file
|
||||
$xml .= "</include>\n";
|
||||
|
||||
fwrite($fout, $xml);
|
||||
unset($xml);
|
||||
fclose($fout);
|
||||
|
||||
unset($prep_statement);
|
||||
|
||||
//apply settings
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
}
|
||||
?>
|
||||
50
app/phrases/root.php
Normal file
50
app/phrases/root.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
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>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,11 +1,12 @@
|
||||
<include>
|
||||
<language name="de" sound-prefix="/snds" tts-engine="cepstral" tts-voice="david">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/demo.xml"/>
|
||||
<!--voicemail_de_tts is purely implemented with tts, we need a files based implementation too -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/tts.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
<language name="de" sound-prefix="/snds" tts-engine="cepstral" tts-voice="david">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/demo.xml"/>
|
||||
<!--voicemail_de_tts is purely implemented with tts, we need a files based implementation too -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/tts.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="phrases/*.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
@@ -8,7 +8,8 @@
|
||||
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
|
||||
<X-PRE-PROCESS cmd="include" data="ivr/*.xml"/> <!-- IVR and custom phrases go here -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/voicemail_ivr.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="phrases/*.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
</include>
|
||||
@@ -1,12 +1,13 @@
|
||||
<include>
|
||||
<language name="fr" say-module="fr" sound-prefix="$${sounds_dir}/fr/ca/june" tts-engine="cepstral" tts-voice="david">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/demo.xml"/>
|
||||
<!-- voicemail_fr_tts is purely implemented with tts, we need a files based implementation too -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
<language name="fr" say-module="fr" sound-prefix="$${sounds_dir}/fr/ca/june" tts-engine="cepstral" tts-voice="david">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/demo.xml"/>
|
||||
<!-- voicemail_fr_tts is purely implemented with tts, we need a files based implementation too -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/> <!-- dir/tts.xml if you want to use tts and have cepstral -->
|
||||
<X-PRE-PROCESS cmd="include" data="phrases/*.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
@@ -1,11 +1,12 @@
|
||||
<include>
|
||||
<language name="he" sound-prefix="$${sounds_dir}/he/daniel" tts-engine="cepstral" tts-voice="daniel">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
<language name="he" sound-prefix="$${sounds_dir}/he/daniel" tts-engine="cepstral" tts-voice="daniel">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="dir/sounds.xml"/>
|
||||
<X-PRE-PROCESS cmd="include" data="phrases/*.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--тестовые файлы Вы звуковые файлы можно взять тут svn co http://svn.freeswitch.ru/bbv/mod_say_ru/ru/ -->
|
||||
<include>
|
||||
<language name="ru" sound-prefix="$${sounds_dir}/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
|
||||
<!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral -->
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
<language name="ru" sound-prefix="$${sounds_dir}/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
|
||||
<phrases>
|
||||
<macros>
|
||||
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
|
||||
<!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
|
||||
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral -->
|
||||
<X-PRE-PROCESS cmd="include" data="phrases/*.xml"/>
|
||||
</macros>
|
||||
</phrases>
|
||||
</language>
|
||||
</include>
|
||||
|
||||
Reference in New Issue
Block a user