From 9fb41cb3576bfcae740113cb5d34ca7ec23ad06e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 3 Dec 2016 13:33:47 -0700 Subject: [PATCH] Update --- .../resources/classes/voicemail.php | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/app/voicemails/resources/classes/voicemail.php b/app/voicemails/resources/classes/voicemail.php index 7a0ab43cd5..95c54a864a 100644 --- a/app/voicemails/resources/classes/voicemail.php +++ b/app/voicemails/resources/classes/voicemail.php @@ -255,9 +255,11 @@ public function voicemail_delete() { + //get the voicemail id + $this->get_voicemail_id(); + //check if for valid input - if (is_numeric($this->voicemail_id) - && is_uuid($this->voicemail_uuid) + if (is_uuid($this->voicemail_uuid) && is_uuid($this->domain_uuid)) { //input is valid } @@ -269,11 +271,13 @@ $this->message_delete(); //delete voicemail recordings folder (includes greetings) - $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; - foreach (glob($file_path."/*.*") as $file_name) { - unlink($file_name); + if (is_numeric($this->voicemail_id)) { + $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; + foreach (glob($file_path."/*.*") as $file_name) { + unlink($file_name); + } + @rmdir($file_path); } - @rmdir($file_path); //delete voicemail destinations $sql = "delete from v_voicemail_destinations "; @@ -284,12 +288,14 @@ unset($sql, $prep_statement); //delete voicemail greetings - $sql = "delete from v_voicemail_greetings "; - $sql .= "where domain_uuid = '".$this->domain_uuid."' "; - $sql .= "and voicemail_id = '".$this->voicemail_id."' "; - $prep_statement = $this->db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql, $prep_statement); + if (is_numeric($this->voicemail_id)) { + $sql = "delete from v_voicemail_greetings "; + $sql .= "where domain_uuid = '".$this->domain_uuid."' "; + $sql .= "and voicemail_id = '".$this->voicemail_id."' "; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql, $prep_statement); + } //delete voicemail options $sql = "delete from v_voicemail_options ";