2012-06-04 14:58:40 +00: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>
|
2020-03-04 17:56:06 -07:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
2012-06-04 14:58:40 +00:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
2016-07-27 22:03:59 -07:00
|
|
|
|
2022-10-10 17:28:02 -06:00
|
|
|
//includes files
|
2023-06-15 14:28:23 -03:00
|
|
|
require_once dirname(__DIR__, 2) . "/resources/require.php";
|
2016-07-27 23:59:25 -06:00
|
|
|
require_once "resources/require.php";
|
|
|
|
|
require_once "resources/check_auth.php";
|
2019-11-18 13:31:06 -07:00
|
|
|
require_once "resources/paging.php";
|
2013-05-04 00:35:21 +00:00
|
|
|
|
2016-07-27 23:59:25 -06:00
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('extension_view')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-04 00:35:21 +00:00
|
|
|
//add multi-lingual support
|
2015-01-18 10:33:34 +00:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-05-04 00:35:21 +00:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
//get posted data
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_POST['extensions']) && is_array($_POST['extensions'])) {
|
2019-11-18 13:31:06 -07:00
|
|
|
$action = $_POST['action'];
|
|
|
|
|
$search = $_POST['search'];
|
|
|
|
|
$extensions = $_POST['extensions'];
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-30 14:18:00 -07:00
|
|
|
//process the http post data by action
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($action) && !empty($extensions) && is_array($extensions) && @sizeof($extensions) != 0) {
|
2019-11-30 11:12:41 -07:00
|
|
|
switch ($action) {
|
|
|
|
|
case 'toggle':
|
|
|
|
|
if (permission_exists('extension_enabled')) {
|
2019-11-30 14:18:00 -07:00
|
|
|
$obj = new extension;
|
2019-11-30 11:12:41 -07:00
|
|
|
$obj->toggle($extensions);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2020-02-18 07:44:01 -07:00
|
|
|
case 'delete_extension':
|
|
|
|
|
case 'delete_extension_voicemail':
|
2019-11-30 11:12:41 -07:00
|
|
|
if (permission_exists('extension_delete')) {
|
2019-11-30 14:18:00 -07:00
|
|
|
$obj = new extension;
|
2020-02-18 07:44:01 -07:00
|
|
|
if ($action == 'delete_extension_voicemail' && permission_exists('voicemail_delete')) {
|
|
|
|
|
$obj->delete_voicemail = true;
|
|
|
|
|
}
|
2019-11-30 11:12:41 -07:00
|
|
|
$obj->delete($extensions);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2019-11-18 13:31:06 -07:00
|
|
|
}
|
2019-11-30 11:12:41 -07:00
|
|
|
|
|
|
|
|
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
|
|
|
|
|
exit;
|
2019-11-18 13:31:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//get order and order by
|
2023-10-19 18:55:19 +00:00
|
|
|
$order_by = $_GET["order_by"] ?? 'extension';
|
|
|
|
|
$order = $_GET["order"] ?? 'asc';
|
|
|
|
|
$sort = $order_by == 'extension' ? 'natural' : null;
|
2015-03-22 08:48:50 +00:00
|
|
|
|
2020-11-19 17:18:51 -06:00
|
|
|
//get total extension count for domain
|
2023-05-24 15:39:10 -06:00
|
|
|
if (isset($_SESSION['limit']['extensions']['numeric'])) {
|
|
|
|
|
$sql = "select count(*) from v_extensions ";
|
|
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
$database = new database;
|
|
|
|
|
$total_extensions = $database->select($sql, $parameters, 'column');
|
|
|
|
|
unset($sql, $parameters);
|
|
|
|
|
}
|
2020-11-19 17:18:51 -06:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
//add the search term
|
2023-05-17 05:26:08 +00:00
|
|
|
$search = strtolower($_GET["search"] ?? '');
|
2016-03-03 19:01:58 -07:00
|
|
|
|
2019-08-06 19:49:59 -06:00
|
|
|
//get total extension count
|
2023-12-16 11:56:30 -07:00
|
|
|
$sql = "select count(*) from v_extensions ";
|
|
|
|
|
$sql .= "where true ";
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!(!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all'))) {
|
2019-11-18 13:31:06 -07:00
|
|
|
$sql .= "and domain_uuid = :domain_uuid ";
|
2019-08-06 19:49:59 -06:00
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
2016-03-29 03:42:24 -06:00
|
|
|
}
|
2023-12-16 11:56:30 -07:00
|
|
|
if (!empty($search)) {
|
|
|
|
|
$sql .= "and ( ";
|
|
|
|
|
$sql .= " lower(extension) like :search ";
|
|
|
|
|
$sql .= " or lower(number_alias) like :search ";
|
|
|
|
|
$sql .= " or lower(effective_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(effective_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(outbound_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(outbound_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(emergency_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(emergency_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(directory_first_name) like :search ";
|
|
|
|
|
$sql .= " or lower(directory_last_name) like :search ";
|
|
|
|
|
if (permission_exists("extension_call_group")) {
|
|
|
|
|
$sql .= " or lower(call_group) like :search ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= " or lower(user_context) like :search ";
|
|
|
|
|
$sql .= " or lower(enabled) like :search ";
|
|
|
|
|
$sql .= " or lower(description) like :search ";
|
|
|
|
|
$sql .= ") ";
|
|
|
|
|
$parameters['search'] = '%'.$search.'%';
|
|
|
|
|
}
|
2019-08-06 19:49:59 -06:00
|
|
|
$database = new database;
|
2023-05-17 05:26:08 +00:00
|
|
|
$num_rows = $database->select($sql, $parameters ?? null, 'column');
|
2015-03-22 08:17:04 +00:00
|
|
|
|
|
|
|
|
//prepare to page the results
|
2016-03-28 23:02:11 -06:00
|
|
|
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
2019-11-18 13:31:06 -07:00
|
|
|
$param = "&search=".$search;
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
$param .= "&show=all";
|
|
|
|
|
}
|
2023-05-17 05:26:08 +00:00
|
|
|
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
2019-11-18 13:31:06 -07:00
|
|
|
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); //bottom
|
|
|
|
|
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); //top
|
2019-09-10 18:07:49 -06:00
|
|
|
$offset = $rows_per_page * $page;
|
2015-03-22 08:17:04 +00:00
|
|
|
|
|
|
|
|
//get the extensions
|
2023-12-16 11:56:30 -07:00
|
|
|
$sql = "select e.*, ";
|
|
|
|
|
$sql .= "( ";
|
|
|
|
|
$sql .= " select device_uuid ";
|
|
|
|
|
$sql .= " from v_device_lines ";
|
|
|
|
|
$sql .= " where extension_uuid = e.extension_uuid ";
|
|
|
|
|
$sql .= " and user_id = e.extension ";
|
|
|
|
|
$sql .= " limit 1 ";
|
|
|
|
|
$sql .= ") AS device_uuid, ";
|
2023-12-16 13:08:34 -07:00
|
|
|
if (permission_exists("extension_device_address")) {
|
|
|
|
|
$sql .= "( ";
|
|
|
|
|
$sql .= " select device_address ";
|
|
|
|
|
$sql .= " from v_devices ";
|
|
|
|
|
$sql .= " where device_uuid in ( ";
|
|
|
|
|
$sql .= " select device_uuid ";
|
|
|
|
|
$sql .= " from v_device_lines ";
|
2024-01-03 10:41:06 -07:00
|
|
|
$sql .= " where domain_uuid = e.domain_uuid ";
|
2023-12-16 13:08:34 -07:00
|
|
|
$sql .= " and user_id = e.extension ";
|
2024-01-03 10:41:06 -07:00
|
|
|
$sql .= " and server_address = e.user_context ";
|
2023-12-16 13:08:34 -07:00
|
|
|
$sql .= " limit 1) ";
|
|
|
|
|
$sql .= ") AS device_address, ";
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists("extension_device_template")) {
|
|
|
|
|
$sql .= "( ";
|
|
|
|
|
$sql .= " select device_template ";
|
|
|
|
|
$sql .= " from v_devices ";
|
|
|
|
|
$sql .= " where device_uuid in ( ";
|
|
|
|
|
$sql .= " select device_uuid ";
|
|
|
|
|
$sql .= " from v_device_lines ";
|
2024-01-03 10:41:06 -07:00
|
|
|
$sql .= " where domain_uuid = e.domain_uuid ";
|
2023-12-16 13:08:34 -07:00
|
|
|
$sql .= " and user_id = e.extension ";
|
2024-01-03 10:41:06 -07:00
|
|
|
$sql .= " and server_address = e.user_context ";
|
2023-12-16 13:08:34 -07:00
|
|
|
$sql .= " limit 1) ";
|
|
|
|
|
$sql .= ") AS device_template, ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= "true as true ";
|
2023-12-16 11:56:30 -07:00
|
|
|
$sql .= "from v_extensions as e ";
|
|
|
|
|
$sql .= "where true ";
|
|
|
|
|
if (!(!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all'))) {
|
|
|
|
|
$sql .= "and domain_uuid = :domain_uuid ";
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($search)) {
|
|
|
|
|
$sql .= "and ( ";
|
|
|
|
|
$sql .= " lower(extension) like :search ";
|
|
|
|
|
$sql .= " or lower(number_alias) like :search ";
|
|
|
|
|
$sql .= " or lower(effective_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(effective_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(outbound_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(outbound_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(emergency_caller_id_name) like :search ";
|
|
|
|
|
$sql .= " or lower(emergency_caller_id_number) like :search ";
|
|
|
|
|
$sql .= " or lower(directory_first_name) like :search ";
|
|
|
|
|
$sql .= " or lower(directory_last_name) like :search ";
|
|
|
|
|
if (permission_exists("extension_call_group")) {
|
|
|
|
|
$sql .= " or lower(call_group) like :search ";
|
|
|
|
|
}
|
|
|
|
|
$sql .= " or lower(user_context) like :search ";
|
|
|
|
|
$sql .= " or lower(enabled) like :search ";
|
|
|
|
|
$sql .= " or lower(description) like :search ";
|
|
|
|
|
$sql .= ") ";
|
|
|
|
|
$parameters['search'] = '%'.$search.'%';
|
|
|
|
|
}
|
2023-10-19 18:55:19 +00:00
|
|
|
$sql .= order_by($order_by, $order, null, null, $sort);
|
2019-09-04 23:15:10 -06:00
|
|
|
$sql .= limit_offset($rows_per_page, $offset);
|
2019-08-06 19:49:59 -06:00
|
|
|
$database = new database;
|
2023-05-17 05:26:08 +00:00
|
|
|
$extensions = $database->select($sql, $parameters ?? null, 'all');
|
2019-09-04 23:15:10 -06:00
|
|
|
unset($sql, $parameters);
|
2015-03-22 08:17:04 +00:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
//get the registrations
|
|
|
|
|
if (permission_exists('extension_registered')) {
|
|
|
|
|
$obj = new registrations;
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
2020-04-13 11:39:13 -06:00
|
|
|
$obj->show = 'all';
|
|
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
$registrations = $obj->get('all');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//create token
|
|
|
|
|
$object = new token;
|
|
|
|
|
$token = $object->create($_SERVER['PHP_SELF']);
|
2016-08-04 20:05:56 -06:00
|
|
|
|
2019-09-04 23:15:10 -06:00
|
|
|
//include the header
|
2019-11-18 13:31:06 -07:00
|
|
|
$document['title'] = $text['title-extensions'];
|
2019-09-04 23:15:10 -06:00
|
|
|
require_once "resources/header.php";
|
|
|
|
|
|
2015-09-04 23:12:36 -06:00
|
|
|
//show the content
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<div class='action_bar' id='action_bar'>\n";
|
|
|
|
|
echo " <div class='heading'><b>".$text['header-extensions']." (".$num_rows.")</b></div>\n";
|
|
|
|
|
echo " <div class='actions'>\n";
|
2023-09-21 16:34:23 -06:00
|
|
|
if (permission_exists('extension_import') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-import'],'icon'=>$_SESSION['theme']['button_icon_import'],'link'=>'extension_imports.php']);
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('extension_export')) {
|
|
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-export'],'icon'=>$_SESSION['theme']['button_icon_export'],'link'=>'extension_download.php']);
|
|
|
|
|
}
|
|
|
|
|
$margin_left = permission_exists('extension_import') || permission_exists('extension_export') ? "margin-left: 15px;" : null;
|
2023-05-24 15:39:10 -06:00
|
|
|
if (permission_exists('extension_add') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
|
2023-05-17 05:26:08 +00:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','style'=>($margin_left ?? ''),'link'=>'extension_edit.php']);
|
2019-11-18 13:31:06 -07:00
|
|
|
unset($margin_left);
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('extension_enabled') && $extensions) {
|
2023-05-17 05:26:08 +00:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
2019-11-18 13:31:06 -07:00
|
|
|
unset($margin_left);
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('extension_delete') && $extensions) {
|
2020-02-18 07:44:01 -07:00
|
|
|
if (permission_exists('voicemail_delete')) {
|
2023-05-17 05:26:08 +00:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-delete-options');"]);
|
2020-02-18 07:44:01 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2023-05-17 05:26:08 +00:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; '.($margin_left ?? ''),'onclick'=>"modal_open('modal-delete');"]);
|
2020-02-18 07:44:01 -07:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
unset($margin_left);
|
|
|
|
|
}
|
|
|
|
|
echo "<form id='form_search' class='inline' method='get'>\n";
|
2017-12-09 13:08:09 -07:00
|
|
|
if (permission_exists('extension_all')) {
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <input type='hidden' name='show' value='all'>";
|
2017-12-09 13:08:09 -07:00
|
|
|
}
|
|
|
|
|
else {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
|
2017-12-09 13:08:09 -07:00
|
|
|
}
|
|
|
|
|
}
|
2022-01-12 16:00:01 -07:00
|
|
|
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
|
|
|
|
|
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search']);
|
|
|
|
|
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'extensions.php','style'=>($search == '' ? 'display: none;' : null)]);
|
2016-03-03 19:01:58 -07:00
|
|
|
if ($paging_controls_mini != '') {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
|
2016-03-03 19:01:58 -07:00
|
|
|
}
|
2015-09-04 23:12:36 -06:00
|
|
|
echo " </form>\n";
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " </div>\n";
|
|
|
|
|
echo " <div style='clear: both;'></div>\n";
|
|
|
|
|
echo "</div>\n";
|
|
|
|
|
|
2020-03-25 16:52:30 -06:00
|
|
|
if (permission_exists('extension_enabled') && $extensions) {
|
|
|
|
|
echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('extension_delete') && $extensions) {
|
|
|
|
|
if (permission_exists('voicemail_delete')) {
|
|
|
|
|
echo modal::create([
|
|
|
|
|
'id'=>'modal-delete-options',
|
|
|
|
|
'title'=>$text['modal_title-confirmation'],
|
|
|
|
|
'message'=>$text['message-delete_selection'],
|
|
|
|
|
'actions'=>
|
|
|
|
|
button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'collapse'=>'hide-xs','onclick'=>'modal_close();']).
|
|
|
|
|
button::create(['type'=>'button','label'=>$text['label-extension_and_voicemail'],'icon'=>'voicemail','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete_extension_voicemail'); list_form_submit('form_list');"]).
|
|
|
|
|
button::create(['type'=>'button','label'=>$text['label-extension_only'],'icon'=>'phone-alt','collapse'=>'never','style'=>'float: right;','onclick'=>"modal_close(); list_action_set('delete_extension'); list_form_submit('form_list');"])
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'id'=>'btn_delete','icon'=>'check','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete_extension'); list_form_submit('form_list');"])]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
echo $text['description-extensions']."\n";
|
|
|
|
|
echo "<br /><br />\n";
|
|
|
|
|
|
|
|
|
|
echo "<form id='form_list' method='post'>\n";
|
|
|
|
|
echo "<input type='hidden' id='action' name='action' value=''>\n";
|
|
|
|
|
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
|
|
|
|
|
|
|
|
|
|
echo "<table class='list'>\n";
|
|
|
|
|
echo "<tr class='list-header'>\n";
|
|
|
|
|
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
|
|
|
|
echo " <th class='checkbox'>\n";
|
2023-05-17 05:26:08 +00:00
|
|
|
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".(empty($extensions) ? "style='visibility: hidden;'" : null).">\n";
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " </th>\n";
|
2016-03-16 18:48:42 -06:00
|
|
|
}
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<th>".$text['label-domain']."</th>\n";
|
|
|
|
|
//echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
|
2017-12-09 13:08:09 -07:00
|
|
|
}
|
2015-03-22 08:17:04 +00:00
|
|
|
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
|
2019-11-18 13:31:06 -07:00
|
|
|
echo th_order_by('effective_caller_id_name', $text['label-effective_cid_name'], $order_by, $order, null, "class='hide-xs'");
|
2020-07-07 11:04:17 -06:00
|
|
|
if (permission_exists("outbound_caller_id_name")) {
|
|
|
|
|
echo th_order_by('outbound_caller_id_name', $text['label-outbound_cid_name'], $order_by, $order, null, "class='hide-sm-dn'");
|
|
|
|
|
}
|
2023-12-16 13:08:34 -07:00
|
|
|
if (permission_exists("outbound_caller_id_number")) {
|
|
|
|
|
echo th_order_by('outbound_caller_id_number', $text['label-outbound_cid_number'], $order_by, $order, null, "class='hide-md-dn'");
|
|
|
|
|
}
|
2023-07-31 22:37:37 +00:00
|
|
|
if (permission_exists("extension_call_group")) {
|
|
|
|
|
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
|
|
|
|
|
}
|
2023-12-16 13:08:34 -07:00
|
|
|
if (permission_exists("extension_device_address")) {
|
|
|
|
|
echo th_order_by('device_address', $text['label-device_address'], $order_by, $order, null, "class='hide-md-dn'");
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists("extension_device_template")) {
|
|
|
|
|
echo th_order_by('device_template', $text['label-device_template'], $order_by, $order, null, "class='hide-md-dn'");
|
2023-12-16 10:15:22 -08:00
|
|
|
}
|
2019-08-16 11:25:32 -06:00
|
|
|
if (permission_exists("extension_user_context")) {
|
|
|
|
|
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
|
|
|
|
|
}
|
2016-07-27 23:59:25 -06:00
|
|
|
if (permission_exists('extension_registered')) {
|
2019-06-03 13:50:56 -06:00
|
|
|
echo "<th>".$text['label-is_registered']."</th>\n";
|
2016-07-27 22:03:59 -07:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order, null, "class='center'");
|
|
|
|
|
echo th_order_by('description', $text['label-description'], $order_by, $order, null, "class='hide-sm-dn'");
|
2023-05-17 05:26:08 +00:00
|
|
|
if (permission_exists('extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td class='action-button'> </td>\n";
|
2015-03-22 08:17:04 +00:00
|
|
|
}
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2019-11-02 21:12:12 -06:00
|
|
|
if (is_array($extensions) && @sizeof($extensions) != 0) {
|
2019-11-18 13:31:06 -07:00
|
|
|
$x = 0;
|
2015-09-04 23:12:36 -06:00
|
|
|
foreach($extensions as $row) {
|
2019-09-10 18:07:49 -06:00
|
|
|
if (permission_exists('extension_edit')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
$list_row_url = "extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.urlencode($page) : null);
|
2019-09-10 18:07:49 -06:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
|
|
|
|
if (permission_exists('extension_enabled') || permission_exists('extension_delete')) {
|
|
|
|
|
echo " <td class='checkbox'>\n";
|
2022-01-13 11:37:59 -07:00
|
|
|
echo " <input type='checkbox' name='extensions[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <input type='hidden' name='extensions[$x][uuid]' value='".escape($row['extension_uuid'])."' />\n";
|
|
|
|
|
echo " </td>\n";
|
2016-03-16 18:48:42 -06:00
|
|
|
}
|
2023-05-17 05:26:08 +00:00
|
|
|
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
|
2017-12-09 13:08:09 -07:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td>";
|
2015-03-22 08:17:04 +00:00
|
|
|
if (permission_exists('extension_edit')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['extension'])."</a>";
|
2015-03-22 08:17:04 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-02 21:25:11 -06:00
|
|
|
echo escape($row['extension']);
|
2015-03-22 08:17:04 +00:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " </td>\n";
|
|
|
|
|
|
|
|
|
|
echo " <td class='hide-xs'>".escape($row['effective_caller_id_name'])." </td>\n";
|
2020-07-07 11:04:17 -06:00
|
|
|
if (permission_exists("outbound_caller_id_name")) {
|
|
|
|
|
echo " <td class='hide-sm-dn'>".escape($row['outbound_caller_id_name'])." </td>\n";
|
|
|
|
|
}
|
2023-12-16 13:08:34 -07:00
|
|
|
if (permission_exists("outbound_caller_id_number")) {
|
|
|
|
|
echo " <td class='hide-md-dn'>".escape($row['outbound_caller_id_number'])." </td>\n";
|
|
|
|
|
}
|
2023-07-31 22:37:37 +00:00
|
|
|
if (permission_exists("extension_call_group")) {
|
|
|
|
|
echo " <td>".escape($row['call_group'])." </td>\n";
|
|
|
|
|
}
|
2023-12-16 13:08:34 -07:00
|
|
|
if (permission_exists("extension_device_address")) {
|
|
|
|
|
echo " <td class='hide-md-dn'><a href='" . PROJECT_PATH . "/app/devices/device_edit.php?id=".escape($row['device_uuid'])."'>".escape($row['device_address'])."</td>\n";
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists("extension_device_template")) {
|
|
|
|
|
echo " <td class='hide-md-dn'><a href='" . PROJECT_PATH . "/app/devices/device_edit.php?id=".escape($row['device_uuid'])."'>".escape($row['device_template'])."</td>\n";
|
2023-12-16 10:15:22 -08:00
|
|
|
}
|
2019-08-16 11:25:32 -06:00
|
|
|
if (permission_exists("extension_user_context")) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td>".escape($row['user_context'])."</td>\n";
|
2019-08-16 11:25:32 -06:00
|
|
|
}
|
2016-07-27 23:59:25 -06:00
|
|
|
if (permission_exists('extension_registered')) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td>";
|
2020-04-13 11:39:13 -06:00
|
|
|
$extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
2017-11-20 23:59:50 +03:00
|
|
|
$extension_number_alias = $row['number_alias'];
|
2023-05-05 13:46:37 -03:00
|
|
|
if (!empty($extension_number_alias)) {
|
2020-04-13 11:39:13 -06:00
|
|
|
$extension_number_alias .= '@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
2017-11-20 23:59:50 +03:00
|
|
|
}
|
|
|
|
|
$found_count = 0;
|
2019-09-27 15:52:14 -06:00
|
|
|
if (is_array($registrations)) {
|
|
|
|
|
foreach ($registrations as $array) {
|
2019-11-18 13:31:06 -07:00
|
|
|
if ($extension_number == $array['user'] || ($extension_number_alias != '' && $extension_number_alias == $array['user'])) {
|
2019-09-27 15:52:14 -06:00
|
|
|
$found_count++;
|
|
|
|
|
}
|
2017-11-20 23:59:50 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($found_count > 0) {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo $text['label-true']." (".$found_count.")";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo $text['label-false'];
|
2017-11-20 23:59:50 +03:00
|
|
|
}
|
2018-06-29 22:58:48 -06:00
|
|
|
unset($extension_number, $extension_number_alias, $found_count, $array);
|
2017-11-20 23:59:50 +03:00
|
|
|
echo " </td>\n";
|
|
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
if (permission_exists('extension_enabled')) {
|
|
|
|
|
echo " <td class='no-link center'>";
|
|
|
|
|
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
2015-03-22 08:17:04 +00:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
else {
|
|
|
|
|
echo " <td class='center'>";
|
|
|
|
|
echo $text['label-'.$row['enabled']];
|
2015-03-22 08:17:04 +00:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td class='description overflow hide-sm-dn'>".escape($row['description'])."</td>\n";
|
2023-05-17 05:26:08 +00:00
|
|
|
if (permission_exists('extension_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
2019-11-18 13:31:06 -07:00
|
|
|
echo " <td class='action-button'>";
|
|
|
|
|
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
|
|
|
|
echo " </td>\n";
|
2016-03-31 18:03:32 -06:00
|
|
|
}
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "</tr>\n";
|
|
|
|
|
$x++;
|
2016-03-31 18:03:32 -06:00
|
|
|
}
|
|
|
|
|
}
|
2015-03-22 08:17:04 +00:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "</table>\n";
|
|
|
|
|
echo "<br />\n";
|
|
|
|
|
echo "<div align='center'>".$paging_controls."</div>\n";
|
2019-09-10 18:07:49 -06:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
2016-03-03 19:01:58 -07:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
echo "</form>\n";
|
2016-03-03 19:01:58 -07:00
|
|
|
|
2019-11-18 13:31:06 -07:00
|
|
|
unset($extensions);
|
2016-03-31 18:03:32 -06:00
|
|
|
|
2012-06-04 14:58:40 +00:00
|
|
|
//show the footer
|
2013-07-06 06:29:50 +00:00
|
|
|
require_once "resources/footer.php";
|
2017-12-09 13:08:09 -07:00
|
|
|
|
2020-07-07 11:04:17 -06:00
|
|
|
?>
|
2023-12-16 13:08:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|