fusionpbx/app/extensions/extensions.php

455 lines
21 KiB
PHP
Raw Permalink Normal View History

<?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-2024
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
2022-10-11 01:28:02 +02:00
//includes files
Use magic constant dir (#6711) * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ * use magic constant __DIR__ to load only functions.php * replace spaces with tab character * update dirname command to use levels instead of nesting * use magic constant __DIR__ * update dirname command to use levels instead of nesting * Update access_control_edit.php * Update access_control_import.php * Update access_controls.php * Update dnd.php * Update access_controls_reload.php * Update call_center_agents.php * Update call_center_agents.php * Update fax_queue.php * Update login.php * Update pdo.php * Update pdo_vm.php * Update switch.php * Update index.php * Update css.php * Update v_mailto.php * Update fax_to_email.php --------- Co-authored-by: FusionPBX <markjcrane@gmail.com>
2023-06-15 19:28:23 +02:00
require_once dirname(__DIR__, 2) . "/resources/require.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
2019-11-18 21:31:06 +01:00
require_once "resources/paging.php";
//check permissions
if (permission_exists('extension_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
2024-07-27 01:04:02 +02:00
//initialize the database object
$database = new database;
//add multi-lingual support
$language = new text;
$text = $language->get();
2019-11-18 21:31:06 +01:00
//get posted data
2023-05-17 07:26:08 +02:00
if (!empty($_POST['extensions']) && is_array($_POST['extensions'])) {
2019-11-18 21:31:06 +01:00
$action = $_POST['action'];
$search = $_POST['search'];
$extensions = $_POST['extensions'];
}
2019-11-30 22:18:00 +01:00
//process the http post data by action
2023-05-17 07:26:08 +02:00
if (!empty($action) && !empty($extensions) && is_array($extensions) && @sizeof($extensions) != 0) {
2019-11-30 19:12:41 +01:00
switch ($action) {
case 'toggle':
if (permission_exists('extension_enabled')) {
2019-11-30 22:18:00 +01:00
$obj = new extension;
2019-11-30 19:12:41 +01:00
$obj->toggle($extensions);
}
break;
case 'delete_extension':
case 'delete_extension_voicemail':
2019-11-30 19:12:41 +01:00
if (permission_exists('extension_delete')) {
2019-11-30 22:18:00 +01:00
$obj = new extension;
if ($action == 'delete_extension_voicemail' && permission_exists('voicemail_delete')) {
$obj->delete_voicemail = true;
}
2019-11-30 19:12:41 +01:00
$obj->delete($extensions);
}
break;
2019-11-18 21:31:06 +01:00
}
2019-11-30 19:12:41 +01:00
header('Location: extensions.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
2019-11-18 21:31:06 +01:00
}
//get order and order by
$order_by = $_GET["order_by"] ?? 'extension';
$order = $_GET["order"] ?? 'asc';
$sort = $order_by == 'extension' ? 'natural' : null;
2015-03-22 09:48:50 +01:00
//get total extension count for domain
2023-05-24 23:39:10 +02: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'];
$total_extensions = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
}
2019-11-18 21:31:06 +01:00
//add the search term
2023-05-17 07:26:08 +02:00
$search = strtolower($_GET["search"] ?? '');
//get total extension count
$sql = "select count(*) from v_extensions ";
$sql .= "where true ";
2023-05-17 07:26:08 +02:00
if (!(!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all'))) {
2019-11-18 21:31:06 +01:00
$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-05-17 07:26:08 +02:00
$num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
2019-11-18 21:31:06 +01:00
$param = "&search=".$search;
2023-05-17 07:26:08 +02:00
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
2019-11-18 21:31:06 +01:00
$param .= "&show=all";
}
2023-05-17 07:26:08 +02:00
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0;
2019-11-18 21:31:06 +01: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
$offset = $rows_per_page * $page;
//get the extensions
$sql = "select e.*, ";
$sql .= "( ";
$sql .= " select device_uuid ";
$sql .= " from v_device_lines ";
2024-08-15 06:34:39 +02:00
$sql .= " where domain_uuid = e.domain_uuid ";
$sql .= " and user_id = e.extension ";
$sql .= " limit 1 ";
$sql .= ") AS device_uuid, ";
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 ";
$sql .= " where domain_uuid = e.domain_uuid ";
$sql .= " and user_id = e.extension ";
$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 ";
$sql .= " where domain_uuid = e.domain_uuid ";
$sql .= " and user_id = e.extension ";
$sql .= " limit 1) ";
$sql .= ") AS device_template, ";
}
$sql .= "true as true ";
$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.'%';
}
$sql .= order_by($order_by, $order, null, null, $sort);
2019-09-05 07:15:10 +02:00
$sql .= limit_offset($rows_per_page, $offset);
2023-05-17 07:26:08 +02:00
$extensions = $database->select($sql, $parameters ?? null, 'all');
2019-09-05 07:15:10 +02:00
unset($sql, $parameters);
2019-11-18 21:31:06 +01:00
//get the registrations
if (permission_exists('extension_registered')) {
$obj = new registrations;
2023-05-17 07:26:08 +02:00
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
$obj->show = 'all';
}
2019-11-18 21:31:06 +01:00
$registrations = $obj->get('all');
}
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
2019-09-05 07:15:10 +02:00
//include the header
2019-11-18 21:31:06 +01:00
$document['title'] = $text['title-extensions'];
2019-09-05 07:15:10 +02:00
require_once "resources/header.php";
2015-09-05 07:12:36 +02:00
//show the content
2019-11-18 21:31:06 +01:00
echo "<div class='action_bar' id='action_bar'>\n";
2024-09-07 00:43:42 +02:00
echo " <div class='heading'><b>".$text['header-extensions']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
2019-11-18 21:31:06 +01:00
echo " <div class='actions'>\n";
2023-09-22 00:34:23 +02:00
if (permission_exists('extension_import') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
2019-11-18 21:31:06 +01: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 23:39:10 +02:00
if (permission_exists('extension_add') && (!isset($_SESSION['limit']['extensions']['numeric']) || $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
2023-05-17 07:26:08 +02: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 21:31:06 +01:00
unset($margin_left);
}
if (permission_exists('extension_enabled') && $extensions) {
2023-05-17 07:26:08 +02: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 21:31:06 +01:00
unset($margin_left);
}
if (permission_exists('extension_delete') && $extensions) {
if (permission_exists('voicemail_delete')) {
2023-05-17 07:26:08 +02: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');"]);
}
else {
2023-05-17 07:26:08 +02: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');"]);
}
2019-11-18 21:31:06 +01:00
unset($margin_left);
}
echo "<form id='form_search' class='inline' method='get'>\n";
2017-12-09 21:08:09 +01:00
if (permission_exists('extension_all')) {
2023-05-17 07:26:08 +02:00
if (!empty($_GET['show']) && $_GET['show'] == 'all') {
2019-11-18 21:31:06 +01:00
echo " <input type='hidden' name='show' value='all'>";
2017-12-09 21:08:09 +01:00
}
else {
2019-11-18 21:31:06 +01:00
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
2017-12-09 21:08:09 +01: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)]);
if ($paging_controls_mini != '') {
2019-11-18 21:31:06 +01:00
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>";
}
2015-09-05 07:12:36 +02:00
echo " </form>\n";
2019-11-18 21:31:06 +01:00
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
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 21:31:06 +01: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";
2024-09-06 07:37:34 +02:00
echo "<div class='card'>\n";
2019-11-18 21:31:06 +01:00
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 07:26:08 +02: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 21:31:06 +01:00
echo " </th>\n";
}
2023-05-17 07:26:08 +02:00
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
2019-11-18 21:31:06 +01:00
echo "<th>".$text['label-domain']."</th>\n";
//echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
2017-12-09 21:08:09 +01:00
}
if (permission_exists('extension_registered')) {
echo "<th>&nbsp;</th>\n";
}
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
2019-11-18 21:31:06 +01:00
echo th_order_by('effective_caller_id_name', $text['label-effective_cid_name'], $order_by, $order, null, "class='hide-xs'");
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'");
}
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'");
}
if (permission_exists("extension_call_group")) {
echo th_order_by('call_group', $text['label-call_group'], $order_by, $order);
}
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'");
}
2019-08-16 19:25:32 +02:00
if (permission_exists("extension_user_context")) {
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
}
2019-11-18 21:31:06 +01: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'");
if (permission_exists('extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
2019-11-18 21:31:06 +01:00
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
2019-11-03 04:12:12 +01:00
if (is_array($extensions) && @sizeof($extensions) != 0) {
2019-11-18 21:31:06 +01:00
$x = 0;
2015-09-05 07:12:36 +02:00
foreach($extensions as $row) {
$list_row_url = '';
if (permission_exists('extension_edit')) {
2019-11-18 21:31:06 +01:00
$list_row_url = "extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.urlencode($page) : null);
if ($row['domain_uuid'] != $_SESSION['domain_uuid'] && permission_exists('domain_select')) {
$list_row_url .= '&domain_uuid='.urlencode($row['domain_uuid']).'&domain_change=true';
}
}
2019-11-18 21:31:06 +01: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";
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 21:31:06 +01:00
echo " <input type='hidden' name='extensions[$x][uuid]' value='".escape($row['extension_uuid'])."' />\n";
echo " </td>\n";
}
2023-05-17 07:26:08 +02:00
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('extension_all')) {
2019-11-18 21:31:06 +01:00
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
2017-12-09 21:08:09 +01:00
}
if (permission_exists('extension_registered')) {
$icon_registered_color = $_SESSION['extension']['icon_registered_color']['text'] ?? '#12d600';
$icon_unregistered_color = $_SESSION['extension']['icon_unregistered_color']['text'] ?? '#e21b1b';
$extension_number = $row['extension'].'@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
$extension_number_alias = $row['number_alias'];
if (!empty($extension_number_alias)) {
$extension_number_alias .= '@'.$_SESSION['domains'][$row['domain_uuid']]['domain_name'];
}
$found_count = 0;
if (is_array($registrations)) {
foreach ($registrations as $array) {
if ($extension_number == $array['user'] || ($extension_number_alias != '' && $extension_number_alias == $array['user'])) {
$found_count++;
}
}
}
if ($found_count > 0) {
echo " <td class='middle button center' style='text-align: center; cursor: help;' title=\"".($found_count > 1 ? $found_count.' '.$text['label-registrations'] : $text['label-registered'])."\">";
if ($found_count > 1) {
echo "<div style='display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: ".$icon_registered_color."; border: 1px solid ".color_adjust($icon_registered_color, -0.07)."; margin-top: 4px;'></div>\n";
}
echo " <div style='display: inline-block; width: 8px; height: 8px; line-height: 8px; border-radius: 50%; background-color: ".$icon_registered_color."; border: 1px solid ".color_adjust($icon_registered_color, -0.07)."; margin-top: 4px; ".($found_count > 1 ? 'margin-left: -7px;' : null)."'></div>\n";
}
else {
echo " <td class='middle button center' style='text-align: center; cursor: help;' title=\"".$text['label-unregistered']."\">";
echo "<div style='display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: ".$icon_unregistered_color."; border: 1px solid ".color_adjust($icon_unregistered_color, -0.15)."; margin-top: 4px;'></div>\n";
}
unset($extension_number, $extension_number_alias, $found_count, $array);
echo "</td>\n";
}
2019-11-18 21:31:06 +01:00
echo " <td>";
if (permission_exists('extension_edit')) {
2019-11-18 21:31:06 +01:00
echo "<a href='".$list_row_url."' title=\"".$text['button-edit']."\">".escape($row['extension'])."</a>";
}
else {
2018-06-03 05:25:11 +02:00
echo escape($row['extension']);
}
2019-11-18 21:31:06 +01:00
echo " </td>\n";
echo " <td class='hide-xs'>".escape($row['effective_caller_id_name'])."&nbsp;</td>\n";
if (permission_exists("outbound_caller_id_name")) {
echo " <td class='hide-sm-dn'>".escape($row['outbound_caller_id_name'])."&nbsp;</td>\n";
}
if (permission_exists("outbound_caller_id_number")) {
echo " <td class='hide-md-dn'>".escape($row['outbound_caller_id_number'])."&nbsp;</td>\n";
}
if (permission_exists("extension_call_group")) {
echo " <td>".escape($row['call_group'])."&nbsp;</td>\n";
}
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";
}
2019-08-16 19:25:32 +02:00
if (permission_exists("extension_user_context")) {
2019-11-18 21:31:06 +01:00
echo " <td>".escape($row['user_context'])."</td>\n";
2019-08-16 19:25:32 +02:00
}
2019-11-18 21:31:06 +01: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')"]);
}
2019-11-18 21:31:06 +01:00
else {
echo " <td class='center'>";
echo $text['label-'.$row['enabled']];
}
2019-11-18 21:31:06 +01:00
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['description'])."</td>\n";
if (permission_exists('extension_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
2019-11-18 21:31:06 +01: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";
}
2019-11-18 21:31:06 +01:00
echo "</tr>\n";
$x++;
}
}
2019-11-18 21:31:06 +01:00
echo "</table>\n";
2024-09-06 07:37:34 +02:00
echo "</div>\n";
2019-11-18 21:31:06 +01:00
echo "<br />\n";
echo "<div align='center'>".$paging_controls."</div>\n";
2019-11-18 21:31:06 +01:00
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
2019-11-18 21:31:06 +01:00
echo "</form>\n";
2019-11-18 21:31:06 +01:00
unset($extensions);
//show the footer
require_once "resources/footer.php";
2017-12-09 21:08:09 +01:00
2024-08-15 06:34:39 +02:00
?>