2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 00:04:57 +02:00
|
|
|
//get the https values and set as variables
|
2012-10-24 10:08:36 +02:00
|
|
|
$order_by = check_str($_GET["order_by"]);
|
2014-04-27 04:16:36 +02:00
|
|
|
$order = check_str($_GET["order"]);
|
2012-10-06 20:00:11 +02:00
|
|
|
|
2016-03-04 03:01:58 +01:00
|
|
|
//handle search term
|
|
|
|
|
$search = check_str($_GET["search"]);
|
|
|
|
|
if (strlen($search) > 0) {
|
|
|
|
|
$sql_mod = "and ( ";
|
|
|
|
|
$sql_mod .= "extension like '%".$search."%' ";
|
|
|
|
|
$sql_mod .= "or description like '%".$search."%' ";
|
|
|
|
|
$sql_mod .= ") ";
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-09 00:04:57 +02:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:06:08 +01:00
|
|
|
$language = new text;
|
2015-01-29 20:31:06 +01:00
|
|
|
$text = $language->get($_SESSION['domain']['language']['code'], 'app/calls');
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2012-10-09 00:04:57 +02:00
|
|
|
//begin the content
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
|
|
|
|
require_once "resources/paging.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2016-03-25 23:29:20 +01:00
|
|
|
//define select count query
|
|
|
|
|
$sql = "select count(extension_uuid) as count from v_extensions ";
|
|
|
|
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "and enabled = 'true' ";
|
|
|
|
|
if (!(if_group("admin") || if_group("superadmin"))) {
|
|
|
|
|
if (count($_SESSION['user']['extension']) > 0) {
|
|
|
|
|
$sql .= "and (";
|
|
|
|
|
$x = 0;
|
|
|
|
|
foreach($_SESSION['user']['extension'] as $row) {
|
|
|
|
|
if ($x > 0) { $sql .= "or "; }
|
|
|
|
|
$sql .= "extension = '".$row['user']."' ";
|
|
|
|
|
$x++;
|
|
|
|
|
}
|
|
|
|
|
$sql .= ")";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//used to hide any results when a user has not been assigned an extension
|
|
|
|
|
$sql .= "and extension = 'disabled' ";
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-04 03:01:58 +01:00
|
|
|
$sql .= $sql_mod; //add search mod from above
|
2016-03-25 23:29:20 +01:00
|
|
|
|
|
|
|
|
//execute select count query
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
2016-03-25 23:29:20 +01:00
|
|
|
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count = $row['count'];
|
|
|
|
|
unset ($prep_statement, $row);
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2016-03-04 03:01:58 +01:00
|
|
|
if ($is_included == 'true') {
|
|
|
|
|
$rows_per_page = 10;
|
2016-03-25 23:29:20 +01:00
|
|
|
if ($result_count > 10) {
|
|
|
|
|
echo "<script>document.getElementById('btn_viewall_callrouting').style.display = 'inline-block';</script>\n";
|
2016-03-04 03:01:58 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$rows_per_page = 150;
|
|
|
|
|
}
|
|
|
|
|
$param = "&search=".$search;
|
2012-06-04 16:58:40 +02:00
|
|
|
$page = $_GET['page'];
|
2014-04-27 04:16:36 +02:00
|
|
|
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
2016-03-25 23:29:20 +01:00
|
|
|
list($paging_controls_mini, $rows_per_page, $var_3) = paging($result_count, $param, $rows_per_page, true);
|
|
|
|
|
list($paging_controls, $rows_per_page, $var_3) = paging($result_count, $param, $rows_per_page);
|
2014-04-27 04:16:36 +02:00
|
|
|
$offset = $rows_per_page * $page;
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2016-03-25 23:29:20 +01:00
|
|
|
//rework select data query
|
|
|
|
|
$sql = str_replace('count(extension_uuid) as count', '*', $sql);
|
|
|
|
|
$sql .= " limit ".$rows_per_page." offset ".$offset." ";
|
|
|
|
|
|
|
|
|
|
//execute select data query
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
unset ($prep_statement, $sql);
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
2016-03-04 03:01:58 +01:00
|
|
|
if ($is_included != "true") {
|
|
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td align='left' width='100%'><b>".$text['title']."</b><br>\n";
|
|
|
|
|
echo " ".$text['description-2']."\n";
|
|
|
|
|
echo " ".$text['description-3']."\n";
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <form method='get' action=''>\n";
|
|
|
|
|
echo " <td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
|
|
|
|
|
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
|
|
|
|
|
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
|
|
|
|
if ($paging_controls_mini != '') {
|
|
|
|
|
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </form>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "<br />";
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2012-10-24 09:02:52 +02:00
|
|
|
echo "<th>".$text['table-extension']."</th>\n";
|
|
|
|
|
echo "<th>".$text['table-tools']."</th>\n";
|
|
|
|
|
echo "<th>".$text['table-description']."</th>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2012-09-29 23:53:24 +02:00
|
|
|
if ($result_count > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
foreach($result as $row) {
|
2014-06-21 09:04:04 +02:00
|
|
|
$tr_url = PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid'];
|
2014-06-21 10:52:47 +02:00
|
|
|
$tr_link = (permission_exists('call_forward') || permission_exists('follow_me') || permission_exists('do_not_disturb')) ? "href='".$tr_url."'" : null;
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<tr ".$tr_link.">\n";
|
2012-09-29 23:53:24 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['extension']."</td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
2014-06-21 09:04:04 +02:00
|
|
|
if (permission_exists('call_forward')) { echo "<a href='".$tr_url."'>".$text['label-call-forward']."</a> "; }
|
|
|
|
|
if (permission_exists('follow_me')) { echo "<a href='".$tr_url."'>".$text['label-follow-me']."</a> "; }
|
|
|
|
|
if (permission_exists('do_not_disturb')) { echo "<a href='".$tr_url."'>".$text['label-dnd']."</a>"; }
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
2012-09-29 23:53:24 +02:00
|
|
|
echo " <td valign='top' class='row_stylebg' width='40%'>".$row['description']." </td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
} //end if results
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
2016-03-04 03:01:58 +01:00
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
|
|
if (strlen($paging_controls) > 0 && ($is_included != "true")) {
|
|
|
|
|
echo "<center>".$paging_controls."</center>\n";
|
|
|
|
|
echo "<br><br>\n";
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
if ($is_included != "true") {
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
2012-10-24 10:08:36 +02:00
|
|
|
?>
|