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"]);
|
|
|
|
|
$order = check_str($_GET["order"]);
|
2012-10-06 20:00:11 +02:00
|
|
|
|
2012-10-09 00:04:57 +02:00
|
|
|
//add multi-lingual support
|
2012-10-24 10:08:36 +02:00
|
|
|
unset($text);
|
2012-10-09 00:04:57 +02:00
|
|
|
echo "<!--\n";
|
2012-10-24 10:08:36 +02:00
|
|
|
require_once "app/calls/app_languages.php";
|
2012-10-09 00:04:57 +02:00
|
|
|
echo "-->\n";
|
2012-10-24 09:02:52 +02:00
|
|
|
foreach($text as $key => $value) {
|
2012-10-24 10:08:36 +02:00
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
2012-10-06 20:00:11 +02:00
|
|
|
}
|
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
|
|
|
echo "<div align='center'>";
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
|
|
|
|
echo "<tr class='border'>\n";
|
|
|
|
|
echo " <td align=\"center\">\n";
|
|
|
|
|
echo " <br>";
|
|
|
|
|
|
|
|
|
|
if ($is_included != "true") {
|
|
|
|
|
echo " <table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
|
|
|
|
|
echo " <tr>\n";
|
2012-10-24 09:02:52 +02:00
|
|
|
echo " <td align='left'><b>".$text['title']."</b><br>\n";
|
2012-10-24 10:08:36 +02:00
|
|
|
echo " ".$text['description-2']."\n";
|
2012-10-24 09:02:52 +02:00
|
|
|
echo " ".$text['description-3']." \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo " <br />";
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-29 23:53:24 +02:00
|
|
|
$sql = "select * from v_extensions ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$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' ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (strlen($order_by)> 0) {
|
|
|
|
|
$sql .= "order by $order_by $order ";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$sql .= "order by extension asc ";
|
|
|
|
|
}
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$num_rows = count($result);
|
|
|
|
|
unset ($prep_statement, $result, $sql);
|
|
|
|
|
|
|
|
|
|
$rows_per_page = 150;
|
|
|
|
|
$param = "";
|
|
|
|
|
$page = $_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;
|
|
|
|
|
|
2012-09-29 23:53:24 +02:00
|
|
|
$sql = "select * from v_extensions ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$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 {
|
|
|
|
|
//hide any results when a user has not been assigned an extension
|
|
|
|
|
$sql .= "and extension = 'disabled' ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (strlen($order_by)> 0) {
|
|
|
|
|
$sql .= "order by $order_by $order ";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$sql .= "order by extension asc ";
|
|
|
|
|
}
|
|
|
|
|
$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);
|
|
|
|
|
unset ($prep_statement, $sql);
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
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) {
|
|
|
|
|
echo "<tr >\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";
|
|
|
|
|
if (permission_exists('call_forward')) {
|
2012-11-21 07:05:45 +01:00
|
|
|
echo " <a href='".PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']."&a=call_forward' alt='Call Forward'>".$text['label-call-forward']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " \n";
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('follow_me')) {
|
2012-11-21 07:05:45 +01:00
|
|
|
echo " <a href='".PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']."&a=follow_me' alt='Follow Me'>".$text['label-follow-me']."</a> \n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " \n";
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('do_not_disturb')) {
|
2012-11-21 07:05:45 +01:00
|
|
|
echo " <a href='".PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']."&a=do_not_disturb' alt='Do Not Disturb'>".$text['label-dnd']."</a> \n";
|
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
|
|
|
|
|
|
|
|
|
|
if (strlen($paging_controls) > 0) {
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td colspan='5' align='left'>\n";
|
|
|
|
|
echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td width='33.3%' nowrap> </td>\n";
|
|
|
|
|
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "</table>";
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "</div>";
|
|
|
|
|
echo "<br>";
|
|
|
|
|
echo "<br>";
|
|
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
|
|
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
|
|
|
?>
|