Update var_edit.php

This commit is contained in:
FusionPBX 2017-12-13 23:25:22 -07:00 committed by GitHub
parent 54965d114a
commit a3e5e033f3
1 changed files with 130 additions and 107 deletions

View File

@ -23,16 +23,20 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('var_add') || permission_exists('var_edit')) {
//includes
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('var_add') || permission_exists('var_edit')) {
//access granted
}
else {
}
else {
echo "access denied";
exit;
}
}
//add multi-lingual support
$language = new text;
@ -62,14 +66,16 @@ else {
$var_description = str_replace("''", "'", $var_description);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the post
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
//get the uuid
if ($action == "update") {
$var_uuid = check_str($_POST["var_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($var_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
//if (strlen($var_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
//if (strlen($var_cat) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
@ -91,6 +97,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('var_add')) {
//insert the variable
$var_uuid = uuid();
$sql = "insert into v_vars ";
$sql .= "(";
@ -128,6 +135,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the configuration
save_var_xml();
//set the message and redirect the user
messages::add($text['message-add']);
header("Location: vars.php");
return;
@ -158,12 +166,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//synchronize the configuration
save_var_xml();
//set the message and redirect the user
messages::add($text['message-update']);
header("Location: vars.php");
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
@ -340,7 +349,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <table>\n";
echo " <tr>\n";
echo " <tr><td width='200'>iLBC@30i</td><td>iLBC using mode=30 which will win in all cases.</td></tr>\n";
echo " <tr><td width='200'>opus@48000h@10i</td><td>Opus 48khz using 10 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@48000h@20i</td><td>Opus 48khz using 20 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@48000h@40i</td><td>Opus 48khz using 40 ms ptime</td></tr>\n";
echo " <tr><td>opus@16000h@10i</td><td>Opus 16khz using 10 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@16000h@20i</td><td>Opus 16khz using 20 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@16000h@40i</td><td>Opus 16khz using 40 ms ptime</td></tr>\n";
echo " <tr><td>opus@8000h@10i</td><td>Opus 8khz using 10 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@8000h@20i</td><td>Opus 8khz using 20 ms ptime (mono and stereo)</td></tr>\n";
echo " <tr><td>opus@8000h@40i</td><td>Opus 8khz using 40 ms ptime</td></tr>\n";
echo " <tr><td>opus@8000h@60i</td><td>Opus 8khz using 60 ms ptime</td></tr>\n";
echo " <tr><td>opus@8000h@80i</td><td>Opus 8khz using 80 ms ptime</td></tr>\n";
echo " <tr><td>opus@8000h@100i</td><td>Opus 8khz using 100 ms ptime</td></tr>\n";
echo " <tr><td>opus@8000h@120i</td><td>Opus 8khz using 120 ms ptime</td></tr>\n";
echo " <tr><td>iLBC@30i</td><td>iLBC using mode=30 which will win in all cases.</td></tr>\n";
echo " <tr><td>DVI4@8000h@20i</td><td>IMA ADPCM 8kHz using 20ms ptime. (multiples of 10)</td></tr>\n";
echo " <tr><td>DVI4@16000h@40i</td><td>IMA ADPCM 16kHz using 40ms ptime. (multiples of 10)</td></tr>\n";
echo " <tr><td>speex@8000h@20i</td><td>Speex 8kHz using 20ms ptime.</td></tr>\n";
@ -391,4 +413,5 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//include header
require_once "resources/footer.php";
?>