Portions created by the Initial Developer are Copyright (C) 2008-2018 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('fax_extension_view')) { //access granted } else { echo "access denied"; exit; } //additional includes require_once "resources/header.php"; require_once "resources/paging.php"; //add multi-lingual support $language = new text; $text = $language->get(); //get the http get values and set them as php variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; //get record counts if (if_group("superadmin") || if_group("admin")) { //show all fax extensions $sql = "select count(*) from v_fax as f "; $sql .= "where f.domain_uuid = :domain_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; } else { //show only assigned fax extensions $sql = "select count(*) from v_fax as f, v_fax_users as u "; $sql .= "where f.fax_uuid = u.fax_uuid "; $sql .= "and f.domain_uuid = :domain_uuid "; $sql .= "and u.user_uuid = :user_uuid "; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['user_uuid'] = $_SESSION['user_uuid']; } $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); //prepare paging $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $param = ""; $page = check_str($_GET['page']); if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; //get records $sql = str_replace('count(*)', '*', $sql); $sql .= order_by($order_by, $order, 'f.fax_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $result = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); //show the content echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['title-fax']." (".$num_rows.")"; echo "

\n"; echo " ".$text['description']."\n"; echo "
\n"; echo "
\n"; $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "\n"; echo "\n"; echo th_order_by('fax_name', $text['label-name'], $order_by, $order); echo th_order_by('fax_extension', $text['label-extension'], $order_by, $order); echo th_order_by('fax_email', $text['label-email'], $order_by, $order); echo ""; echo th_order_by('fax_description', $text['label-description'], $order_by, $order); echo "\n"; echo "\n"; if (is_array($result) && @sizeof($result) != 0) { foreach($result as $row) { //remove the backslash $fax_email = str_replace("\\", "", $row['fax_email']); $fax_email = substr($fax_email, 0, 50); //show the fax extensions $tr_link = (permission_exists('fax_extension_edit')) ? "href='fax_edit.php?id=".escape($row['fax_uuid'])."'" : null; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; //alternate the CSS class if ($c==0) { $c=1; } else { $c=0; } } } unset($result, $row); echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-tools']."\n"; if (permission_exists('fax_extension_add')) { echo " $v_link_label_add\n"; } echo "
"; if (permission_exists('fax_extension_edit')) { echo "".escape($row['fax_name']).""; } else { echo escape($row['fax_name']); } echo " ".escape($row['fax_extension'])."".escape($fax_email)." ".escape($row['fax_description'])." "; if (permission_exists('fax_extension_edit')) { echo "$v_link_label_edit"; } if (permission_exists('fax_extension_delete')) { echo "$v_link_label_delete"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls"; if (permission_exists('fax_extension_add')) { echo "$v_link_label_add"; } echo "
\n"; echo "
"; echo "

"; //show the footer require_once "resources/footer.php"; ?>