-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpage.texttospeech.php
More file actions
163 lines (121 loc) · 4.17 KB
/
page.texttospeech.php
File metadata and controls
163 lines (121 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/********************************************************************
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ==================================================================
*
* FreePBX Module: texttospeech
* Maintainer: Paul White <pwhite@hiddenmatrix.org>
*******************************************************************/
// Check for play_audio right off the bat on legacy fpbx
if ($tts_legacy_fpbx == true) {
if ($_REQUEST['action'] == "play_audio") {
include_once(dirname(__FILE__) . "/play_audio.php");
exit;
}
}
// Include the crypt helper for our audio player
require_once(dirname(__FILE__) . '/helpers/crypt.helper.php');
// Include the form helper, just in case this is a pre 2.10 freepbx
// system which doesn't include it by default
require_once(dirname(__FILE__) . '/helpers/form.helper.php');
// Reset our page tab order
$tabindex = 0;
// Flatten some variables from request
$display = $_REQUEST['display'];
if (isset($_REQUEST['delete'])) {
$action = 'delete';
}
// Copy destination over so process_request finds it
if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) {
$_REQUEST['destination'] = $_REQUEST[$_REQUEST['goto0']."0"];
}
else {
$_REQUEST['destination'] = '';
}
// Process our form variables
$tts_vars = texttospeech_process_request($_REQUEST);
texttospeech_debug_prefix($tts_vars);
// Handle form actions
switch ($action) {
case 'add':
// Adding an entry
texttospeech_add_entry($tts_vars);
if (texttospeech_auto_reload() === false) {
needreload();
}
redirect_standard('id');
break;
case 'edit':
// Modifying an entry
texttospeech_modify_entry($tts_vars);
/***** No longer need reload here since dialplan just calls AGI script *****
if (texttospeech_auto_reload() === false) {
needreload();
}
****************************************************************************/
texttospeech_run_test($tts_vars);
redirect_standard('id');
break;
case 'delete':
// Removing an entry
texttospeech_remove_entry($tts_vars['id']);
if (texttospeech_auto_reload() === false) {
needreload();
}
redirect_standard('id');
break;
default:
// Viewing an entry (or new entry page)
if (!empty($tts_vars['id'])) {
// Load our config information from the database
$tts_vars = texttospeech_load_entry($tts_vars['id']);
}
break;
}
$tts->set_tts_vars($tts_vars);
// Output rnav list
include_once(dirname(__FILE__) . '/views/rnav.php');
// Global table used multiple tiles
$table = new CI_Table;
// Start our configuration form
$fattrs = array( 'name' => 'texttospeech',
'onsubmit' => 'return tts_submit_check(texttospeech);'
);
echo form_open($_SERVER['REQUEST_URI'], $fattrs);
echo form_hidden('display', urlencode($display));
echo form_hidden('action', empty($tts_vars['id']) ? 'add' : 'edit');
echo form_hidden('id', $tts_vars['id']);
// Output top information
include_once(dirname(__FILE__) . '/views/top.php');
// Output General Settings section
include_once(dirname(__FILE__) . '/views/settings.php');
echo '<br><br>';
// Output source-specific settings
include_once(dirname(__FILE__) . '/views/source_settings.php');
echo '<br><br>';
// Output engine-specific settings
include_once(dirname(__FILE__) . '/views/engine_settings.php');
echo '<br><br>';
// Output dialplan settings
include_once(dirname(__FILE__) . '/views/dialplan_settings.php');
echo '<br>';
// Output submit/delete buttons
?>
<h6>
<input name="submit" type="submit" value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>">
<?php if( isset( $tts_vars['id'] ) ) echo ( ' <input name="delete" type="submit" value="'._("Delete").'" tabindex="++$tabindex">' ); ?>
</h6>
<?php
// Output Javascript
include_once(dirname(__FILE__) . '/views/javascript.php');
?>
</form>