diff --git a/app/fax/fax.php b/app/fax/fax.php
index 2601ca7662..81af0c8441 100644
--- a/app/fax/fax.php
+++ b/app/fax/fax.php
@@ -33,8 +33,10 @@ else {
echo "access denied";
exit;
}
-require_once "resources/header.php";
-require_once "resources/paging.php";
+
+//additional includes
+ require_once "resources/header.php";
+ require_once "resources/paging.php";
//add multi-lingual support
$language = new text;
@@ -44,18 +46,7 @@ require_once "resources/paging.php";
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
-//show the content
- echo "
\n";
- echo " \n";
- echo " \n";
- echo " ".$text['title-fax']."";
- echo "
\n";
- echo " ".$text['description']."\n";
- echo " | \n";
- echo "
\n";
- echo "
\n";
- echo "
\n";
-
+//get the fax extensions
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select count(*) as num_rows from v_fax ";
@@ -109,9 +100,20 @@ require_once "resources/paging.php";
$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);
+//show the content
+ echo "\n";
+ echo " \n";
+ echo " \n";
+ echo " ".$text['title-fax']." (".$num_rows.")";
+ echo "
\n";
+ echo " ".$text['description']."\n";
+ echo " | \n";
+ echo "
\n";
+ echo "
\n";
+ echo "
\n";
+
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
@@ -130,7 +132,7 @@ require_once "resources/paging.php";
echo "\n";
echo "\n";
- if ($result_count > 0) {
+ if ($num_rows > 0) {
foreach($result as $row) {
//remove the backslash
$row['fax_email'] = str_replace("\\", "", $row['fax_email']);
@@ -182,7 +184,7 @@ require_once "resources/paging.php";
//alternate the CSS class
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
- unset($sql, $result, $row_count);
+ unset($sql, $result);
} //end if results
echo "\n";
diff --git a/app/fax/fax_files.php b/app/fax/fax_files.php
index b79431d31f..8f83b675dd 100644
--- a/app/fax/fax_files.php
+++ b/app/fax/fax_files.php
@@ -172,24 +172,6 @@ else {
require_once "resources/header.php";
require_once "resources/paging.php";
-//show the header
- echo "\n";
- echo "
\n";
-
//prepare to page the results
$sql = "select count(*) as num_rows from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
@@ -234,10 +216,27 @@ else {
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
- $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- $result_count = count($result);
+ $fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
+//show the header
+ echo "\n";
+ echo "
\n";
+
//show the table and content
$c = 0;
$row_style["0"] = "row_style0";
@@ -255,8 +254,8 @@ else {
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo " | \n";
echo "
\n";
- if ($result_count > 0) {
- foreach($result as $row) {
+ if ($num_rows > 0) {
+ foreach($fax_files as $row) {
$file = basename($row['fax_file_path']);
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
$file_name = substr($file, 0, (strlen($file) -4));
@@ -382,7 +381,7 @@ else {
echo "\n";
$c = ($c) ? 0 : 1;
} //end foreach
- unset($sql, $result, $row_count);
+ unset($sql, $fax_files);
} //end if results
//show the paging controls