James Rose */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('sms_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //include the header require_once "resources/header.php"; require_once "resources/paging.php"; $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $sql = "select domain_name, extension, sms_message_uuid,start_stamp,from_numer,to_number,message,direction from v_sms_messages, v_domains, v_extensions where v_sms_messages.domain_uuid = v_domains.domain_uuid and v_sms_messages.extension_uuid = v_extensions.extension_uuid and v_domains.domain_uuid = '" . $domain_uuid . "' order by start_stamp"; error_log("SQL: " . print_r($sql,true)); $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); $result_count = count($result); unset ($prep_statement, $sql); $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //mod paging parameters for inclusion in column sort heading links $param = substr($param, 1); //remove leading '&' $param = substr($param, 0, strrpos($param, '&order_by=')); //remove trailing order by //show the results $col_count = 6; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; if ($_REQUEST['showall'] && permission_exists('xml_cdr_all')) { echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, null, null, $param); $col_count++; } echo th_order_by('extension', $text['label-extension'], $order_by, $order, null, null, $param); echo th_order_by('start_stamp', $text['label-start'], $order_by, $order, null, "style='text-align: center;'", $param); echo th_order_by('caller_id_number', $text['label-source'], $order_by, $order, null, null, $param); echo th_order_by('destination_number', $text['label-destination'], $order_by, $order, null, null, $param); echo th_order_by('message', $text['label-message'], $order_by, $order, null, null, $param); echo "\n"; if ($result_count > 0) { echo "\n"; //determine if theme images exist $theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/"; $theme_cdr_images_exist = ( file_exists($theme_image_path."icon_cdr_inbound_answered.png") && file_exists($theme_image_path."icon_cdr_inbound_voicemail.png") && file_exists($theme_image_path."icon_cdr_inbound_cancelled.png") && file_exists($theme_image_path."icon_cdr_inbound_failed.png") && file_exists($theme_image_path."icon_cdr_outbound_answered.png") && file_exists($theme_image_path."icon_cdr_outbound_cancelled.png") && file_exists($theme_image_path."icon_cdr_outbound_failed.png") && file_exists($theme_image_path."icon_cdr_local_answered.png") && file_exists($theme_image_path."icon_cdr_local_voicemail.png") && file_exists($theme_image_path."icon_cdr_local_cancelled.png") && file_exists($theme_image_path."icon_cdr_local_failed.png") ) ? true : false; foreach($result as $index => $row) { $tmp_start_epoch = ($_SESSION['domain']['time_format']['text'] == '12h') ? date("j M Y g:i:sa", $row['start_stamp']) : date("j M Y H:i:s", $row['start_epoch']); //determine call result and appropriate icon echo "\n"; //domain name if ($_REQUEST['showall'] && permission_exists('xml_cdr_all')) { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; $c = ($c) ? 0 : 1; } // end foreach unset($sql, $result, $row_count); } // end if //show the footer require_once "resources/footer.php"; ?>
 
\n"; if ($theme_cdr_images_exist) { $call_result = 'answered'; echo "\n"; } else { echo " "; } echo ""; echo $row['domain_name'].' '; echo " ".$row['extension']." ".$row['start_stamp']." ".$row['from_numer']." ".$row['to_number']." ".$row['message']."