$voicemail->db = $db;
        $voicemail->domain_uuid = $_SESSION['domain_uuid'];
        $voicemail->voicemail_id = $voicemail_id;
        $voicemail->voicemail_uuid = $voicemail_uuid;
        $voicemail->voicemail_message_uuid = $voicemail_message_uuid;
        $result = $voicemail->message_download();
        unset($voicemail);
        header("Location: voicemail_edit.php?id=" . $voicemail_uuid);
    }
    exit;
}
//get the html values and set them as variables
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//get the voicemail
$vm = new voicemail();
$vm->db = $db;
$vm->domain_uuid = $_SESSION['domain_uuid'];
$vm->voicemail_uuid = $voicemail_uuid;
$vm->order_by = $order_by;
$vm->order = $order;
$voicemails = $vm->messages();
//additional includes
$document['title'] = $text['title-voicemail_messages'];
require_once "resources/header.php";
require_once "resources/paging.php";
//show the content
echo "<b>" . $text['title-voicemail_messages'] . "</b>";
echo "<br><br>";
echo $text['description-voicemail_message'];
echo "<br><br>";
require_once "resources/check_auth.php";
if (permission_exists('voicemail_delete')) {
    //access granted
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//get the ids
if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
    $voicemail_uuids = $_REQUEST["id"];
    foreach ($voicemail_uuids as $voicemail_uuid) {
        $voicemail_uuid = check_str($voicemail_uuid);
        if ($voicemail_uuid != '') {
            //delete voicemail messages
            require_once "resources/classes/voicemail.php";
            $voicemail = new voicemail();
            $voicemail->db = $db;
            $voicemail->domain_uuid = $_SESSION['domain_uuid'];
            $voicemail->voicemail_uuid = $voicemail_uuid;
            $result = $voicemail->voicemail_delete();
            unset($voicemail);
        }
    }
}
//redirect the user
$_SESSION["message"] = $text['message-delete'];
header("Location: voicemails.php");
return;
} else {
    echo "access denied";
    exit;
}
//add multi-lingual support
$language = new text();
$text = $language->get();
//get submitted variables
$voicemail_messages = $_REQUEST["voicemail_messages"];
//toggle the voicemail message
$toggled = 0;
if (is_array($voicemail_messages) && sizeof($voicemail_messages) > 0) {
    require_once "resources/classes/voicemail.php";
    foreach ($voicemail_messages as $voicemail_uuid => $voicemail_message_uuids) {
        foreach ($voicemail_message_uuids as $voicemail_message_uuid) {
            $voicemail = new voicemail();
            $voicemail->db = $db;
            $voicemail->domain_uuid = $_SESSION['domain_uuid'];
            $voicemail->voicemail_uuid = check_str($voicemail_uuid);
            $voicemail->voicemail_message_uuid = check_str($voicemail_message_uuid);
            $result = $voicemail->message_toggle();
            unset($voicemail);
            $toggled++;
        }
    }
}
//set the referrer
$http_referer = parse_url($_SERVER["HTTP_REFERER"]);
$referer_path = $http_referer['path'];
$referer_query = $http_referer['query'];
//redirect the user
exit;
*/
//add multi-lingual support
$language = new text();
$text = $language->get();
//get submitted variables
if (count($_REQUEST) > 0) {
    $voicemail_messages = $_REQUEST["voicemail_messages"];
}
//delete the voicemail message
$deleted = 0;
if (is_array($voicemail_messages) && sizeof($voicemail_messages) > 0) {
    require_once "resources/classes/voicemail.php";
    foreach ($voicemail_messages as $voicemail_uuid => $voicemail_message_uuids) {
        foreach ($voicemail_message_uuids as $voicemail_message_uuid) {
            $voicemail = new voicemail();
            $voicemail->db = $db;
            $voicemail->domain_uuid = $_SESSION['domain_uuid'];
            $voicemail->voicemail_uuid = check_str($voicemail_uuid);
            $voicemail->voicemail_message_uuid = check_str($voicemail_message_uuid);
            $result = $voicemail->message_delete();
            unset($voicemail);
            $deleted++;
        }
    }
}
//set the referrer
$http_referer = parse_url($_SERVER["HTTP_REFERER"]);
$referer_path = $http_referer['path'];
$referer_query = $http_referer['query'];
//redirect the user