Update voicemail_edit.php (#6723)

* Update voicemail_edit.php
This commit is contained in:
Anthony
2023-05-26 16:17:53 -06:00
committed by GitHub
parent 75ea925753
commit 164b8b842c
+25 -13
View File
@@ -49,7 +49,7 @@
$destination = new destinations; $destination = new destinations;
//action add or update //action add or update
if (is_uuid($_REQUEST["id"])) { if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update"; $action = "update";
$voicemail_uuid = $_REQUEST["id"]; $voicemail_uuid = $_REQUEST["id"];
} }
@@ -57,9 +57,19 @@
$action = "add"; $action = "add";
} }
//set the defaults
$voicemail_id = '';
$voicemail_password = '';
$voicemail_alternate_greet_id = '';
$voicemail_description = '';
$voicemail_destinations_assigned = '';
$show_option_delete = '';
$voicemail_option_digits = '';
$voicemail_option_description = '';
//get http variables and set them to php variables //get http variables and set them to php variables
$referer_path = $_REQUEST["referer_path"]; $referer_path = $_REQUEST["referer_path"] ?? '';
$referer_query = $_REQUEST["referer_query"]; $referer_query = $_REQUEST["referer_query"] ?? '';
if (count($_POST) > 0) { if (count($_POST) > 0) {
//process the http post data by submitted action //process the http post data by submitted action
@@ -286,7 +296,7 @@
} }
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") { if (!empty($_GET)&& is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) {
$voicemail_uuid = $_GET["id"]; $voicemail_uuid = $_GET["id"];
$sql = "select * from v_voicemails "; $sql = "select * from v_voicemails ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
@@ -295,7 +305,7 @@
$parameters['voicemail_uuid'] = $voicemail_uuid; $parameters['voicemail_uuid'] = $voicemail_uuid;
$database = new database; $database = new database;
$row = $database->select($sql, $parameters, 'row'); $row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) { if (!empty($row)) {
$voicemail_id = $row["voicemail_id"]; $voicemail_id = $row["voicemail_id"];
$voicemail_password = $row["voicemail_password"]; $voicemail_password = $row["voicemail_password"];
$greeting_id = $row["greeting_id"]; $greeting_id = $row["greeting_id"];
@@ -317,7 +327,9 @@
} }
//remove the spaces //remove the spaces
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); if (!empty($voicemail_mail_to)) {
$voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to);
}
//set the defaults //set the defaults
if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; } if (empty($voicemail_local_after_email)) { $voicemail_local_after_email = 'true'; }
@@ -396,15 +408,15 @@
$sql .= "from v_voicemails as v "; $sql .= "from v_voicemails as v ";
$sql .= "where v.domain_uuid = :domain_uuid and "; $sql .= "where v.domain_uuid = :domain_uuid and ";
$sql .= "v.voicemail_enabled = 'true' "; $sql .= "v.voicemail_enabled = 'true' ";
if (is_uuid($voicemail_uuid)) { if (is_uuid($voicemail_uuid ?? '')) {
$sql .= "and v.voicemail_uuid <> :voicemail_uuid "; $sql .= "and v.voicemail_uuid <> :voicemail_uuid ";
} }
if (is_array($voicemail_destinations) && @sizeof($voicemail_destinations) != 0) { if (!empty($voicemail_destinations)) {
$sql .= "and v.voicemail_uuid not in (".implode(',', $voicemail_destinations).") "; $sql .= "and v.voicemail_uuid not in (".implode(',', $voicemail_destinations).") ";
} }
$sql .= "order by v.voicemail_id asc"; $sql .= "order by v.voicemail_id asc";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
if (is_uuid($voicemail_uuid)) { if (is_uuid($voicemail_uuid ?? '')) {
$parameters['voicemail_uuid'] = $voicemail_uuid; $parameters['voicemail_uuid'] = $voicemail_uuid;
} }
$database = new database; $database = new database;
@@ -420,7 +432,7 @@
require_once "resources/header.php"; require_once "resources/header.php";
//password complexity //password complexity
$password_complexity = $_SESSION['voicemail']['password_complexity']['boolean']; $password_complexity = $_SESSION['voicemail']['password_complexity']['boolean'] ?? '';
if ($password_complexity == "true") { if ($password_complexity == "true") {
echo "<script>\n"; echo "<script>\n";
$req['length'] = $_SESSION['voicemail']['password_min_length']['numeric']; $req['length'] = $_SESSION['voicemail']['password_min_length']['numeric'];
@@ -656,7 +668,7 @@
echo "</tr>\n"; echo "</tr>\n";
} }
if (permission_exists('voicemail_transcription_enabled') && $_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") { if (permission_exists('voicemail_transcription_enabled') && !empty($_SESSION['voicemail']['transcribe_enabled']['boolean']) == "true") {
echo "<tr>\n"; echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n"; echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_transcription_enabled']."\n"; echo " ".$text['label-voicemail_transcription_enabled']."\n";
@@ -795,8 +807,8 @@
echo "<input type='hidden' name='voicemail_uuid' value='".escape($voicemail_uuid)."'>\n"; echo "<input type='hidden' name='voicemail_uuid' value='".escape($voicemail_uuid)."'>\n";
} }
$http_referer = parse_url($_SERVER["HTTP_REFERER"]); $http_referer = parse_url($_SERVER["HTTP_REFERER"]);
echo "<input type='hidden' name='referer_path' value='".escape($http_referer['path'])."'>\n"; echo "<input type='hidden' name='referer_path' value='".escape($http_referer['path'] ?? '')."'>\n";
echo "<input type='hidden' name='referer_query' value='".escape($http_referer['query'])."'>\n"; echo "<input type='hidden' name='referer_query' value='".escape($http_referer['query'] ?? '')."'>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n"; echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>"; echo "</form>";