Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; if (permission_exists('voicemail_message_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //get the uuid and voicemail_id if (strlen($_REQUEST["id"]) > 0) { $voicemail_uuid = check_str($_REQUEST["id"]); $sql = "select * from v_voicemails "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and voicemail_uuid = '$voicemail_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $voicemail_id = $row["voicemail_id"]; $voicemail_uuid = $row["voicemail_uuid"]; } unset ($prep_statement); } //set the voicemail_id array if (strlen($_REQUEST["id"]) == 0) { foreach ($_SESSION['user']['extension'] as $value) { $voicemail_id[]['voicemail_id'] = $value['user']; } } //download the message if (check_str($_REQUEST["action"]) == "download") { $voicemail_message_uuid = check_str($_REQUEST["uuid"]); require_once "resources/classes/voicemail.php"; $voicemail = new voicemail; $voicemail->db = $db; $voicemail->domain_uuid = $_SESSION['domain_uuid']; $voicemail->voicemail_uuid = $voicemail_uuid; $voicemail->voicemail_id = $voicemail_id; $voicemail->voicemail_message_uuid = $voicemail_message_uuid; $result = $voicemail->message_download(); unset($voicemail); exit; } //get the html values and set them as variables $order_by = check_str($_GET["order_by"]); $order = check_str($_GET["order"]); //additional includes require_once "includes/header.php"; require_once "includes/paging.php"; //show the content echo "
"; echo "\n"; echo "\n"; echo " "; echo ""; echo "
\n"; echo "
"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['title-voicemail_messages']." 
\n"; echo " ".$text['description-voicemail_message']."
\n"; echo "
\n"; $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "
\n"; echo "\n"; $table_header = "\n"; $table_header .= th_order_by('created_epoch', $text['label-created_epoch'], $order_by, $order); //$table_header .= th_order_by('read_epoch', $text['label-read_epoch'], $order_by, $order); $table_header .= th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order); $table_header .= th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order); $table_header .= th_order_by('message_length', $text['label-message_length'], $order_by, $order); $table_header .= "\n"; $table_header .= "\n"; //$table_header .= th_order_by('message_priority', $text['label-message_priority'], $order_by, $order); $table_header .= "\n"; $table_header .= "\n"; //get the voicemail messages require_once "app/voicemails/resources/classes/voicemail.php"; $voicemail = new voicemail; $voicemail->db = $db; $voicemail->domain_uuid = $_SESSION['domain_uuid']; //$voicemail->voicemail_uuid = $voicemail_uuid; $voicemail->voicemail_id = $voicemail_id; $voicemail->order_by = $order_by; $voicemail->order = $order; $result = $voicemail->messages(); $result_count = count($result); //loop throug the voicemail messages if ($result_count == 0) { echo "\n"; echo "\n"; echo "\n"; echo $table_header; } else { $previous_voicemail_id = ''; foreach($result as $row) { if ($previous_voicemail_id != $row['voicemail_id']) { echo "\n"; echo "\n"; echo "\n"; echo $table_header; } if ($row['message_status'] == '') { $style = "style=\"font-weight:bold;\""; } else { $style = ''; } echo "\n"; //echo " \n"; echo " \n"; echo " \n"; echo " \n"; //echo " \n"; echo " \n"; echo " \n"; //echo " \n"; echo " \n"; echo "\n"; $previous_voicemail_id = $row['voicemail_id']; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $result_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message_size']."".$text['label-tools']."\n"; $table_header .= "  \n"; $table_header .= "
\n"; echo "

\n"; echo " ".$text['label-mailbox'].": ".$voicemail_id." \n"; echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo "
\n"; echo "

\n"; echo " ".$text['label-mailbox'].": ".$row['voicemail_id']." \n"; echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo "
"; echo " ".$row['created_date']; echo "".$row['read_epoch']." ".$row['caller_id_name']." ".$row['caller_id_number']." ".$row['message_length_label']." ".$row['message_status']." ".$row['file_size_label']."\n"; //echo " \n"; //echo " ".$text['label-play']."\n"; //echo " \n"; echo "   \n"; echo " \n"; echo " ".$text['label-download']."\n"; echo " \n"; echo " ".$row['message_priority']." \n"; if (permission_exists('voicemail_message_delete')) { echo " $v_link_label_delete\n"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
  \n"; echo "  \n"; echo "
\n"; echo "
"; echo "
"; echo "

"; echo "
"; echo "
"; echo "

"; //include the footer require_once "includes/footer.php"; ?>