This commit is contained in:
FusionPBX 2016-12-03 13:33:47 -07:00 committed by GitHub
parent 99e0dfac48
commit 9fb41cb357
1 changed files with 18 additions and 12 deletions

View File

@ -255,9 +255,11 @@
public function voicemail_delete() { public function voicemail_delete() {
//get the voicemail id
$this->get_voicemail_id();
//check if for valid input //check if for valid input
if (is_numeric($this->voicemail_id) if (is_uuid($this->voicemail_uuid)
&& is_uuid($this->voicemail_uuid)
&& is_uuid($this->domain_uuid)) { && is_uuid($this->domain_uuid)) {
//input is valid //input is valid
} }
@ -269,11 +271,13 @@
$this->message_delete(); $this->message_delete();
//delete voicemail recordings folder (includes greetings) //delete voicemail recordings folder (includes greetings)
$file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id; if (is_numeric($this->voicemail_id)) {
foreach (glob($file_path."/*.*") as $file_name) { $file_path = $_SESSION['switch']['voicemail']['dir']."/default/".$_SESSION['domain_name']."/".$this->voicemail_id;
unlink($file_name); foreach (glob($file_path."/*.*") as $file_name) {
unlink($file_name);
}
@rmdir($file_path);
} }
@rmdir($file_path);
//delete voicemail destinations //delete voicemail destinations
$sql = "delete from v_voicemail_destinations "; $sql = "delete from v_voicemail_destinations ";
@ -284,12 +288,14 @@
unset($sql, $prep_statement); unset($sql, $prep_statement);
//delete voicemail greetings //delete voicemail greetings
$sql = "delete from v_voicemail_greetings "; if (is_numeric($this->voicemail_id)) {
$sql .= "where domain_uuid = '".$this->domain_uuid."' "; $sql = "delete from v_voicemail_greetings ";
$sql .= "and voicemail_id = '".$this->voicemail_id."' "; $sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$prep_statement = $this->db->prepare(check_sql($sql)); $sql .= "and voicemail_id = '".$this->voicemail_id."' ";
$prep_statement->execute(); $prep_statement = $this->db->prepare(check_sql($sql));
unset($sql, $prep_statement); $prep_statement->execute();
unset($sql, $prep_statement);
}
//delete voicemail options //delete voicemail options
$sql = "delete from v_voicemail_options "; $sql = "delete from v_voicemail_options ";