Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17a56bcc64 | |||
| e8891a6da9 | |||
| 1a455aca27 | |||
| 63a29cb54b | |||
| 17e63e2622 | |||
| a85f24c771 | |||
| e90f0f6c0a | |||
| e6a2c99352 | |||
| c9a07b3cd0 | |||
| 5063a61d03 |
@@ -578,7 +578,20 @@
|
||||
'icon'=>'external-link-alt',
|
||||
'id'=>'btn_dest_go',
|
||||
'title'=>$text2['button-edit'],
|
||||
'onclick'=>"let types = document.getElementById('{$destination_id}_type').options; let opts = document.getElementById('{$destination_id}').options; if(opts[opts.selectedIndex].id && opts[opts.selectedIndex].id.length > 0) {window.open('/app/'+types[types.selectedIndex].className+'/'+types[types.selectedIndex].id+'_edit.php?id='+opts[opts.selectedIndex].id, '_blank');}"
|
||||
'onclick'=>"
|
||||
let types = document.getElementById('{$destination_id}_type').options;
|
||||
let opts = document.getElementById('{$destination_id}').options;
|
||||
let selected_type = types[types.selectedIndex].className;
|
||||
let selected_id = opts[opts.selectedIndex].id;
|
||||
if (selected_id && selected_id.length > 0) {
|
||||
// Special case for call_center_queue
|
||||
if (selected_type === 'call_centers') {
|
||||
window.open('/app/'+selected_type+'/call_center_queue_edit.php?id='+selected_id, '_blank');
|
||||
} else {
|
||||
window.open('/app/'+selected_type+'/'+selected_id+'_edit.php?id='+selected_id, '_blank');
|
||||
}
|
||||
}
|
||||
"
|
||||
])."\n";
|
||||
|
||||
//debug information
|
||||
|
||||
+102
-7
@@ -1637,13 +1637,16 @@
|
||||
echo " <td class='vtable'>".$text['label-device_key_id']."</td>\n";
|
||||
}
|
||||
if ($vendor_count > 1 && !empty($row['device_key_vendor'])) {
|
||||
echo " <td class='vtable'><i>".ucwords($row['device_key_vendor'])."</i></td>\n";
|
||||
// echo " <td class='vtable'><i>".ucwords($row['device_key_vendor'])."</i></td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_vendor']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_type']."</td>\n";
|
||||
if ($show_key_subtype) {
|
||||
echo " <td class='vtable'>".$text['label-device_key_subtype']."</td>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$device_keys_generic_header_displayed = true;
|
||||
echo " <td class='vtable'>".$text['label-device_vendor']."</td>\n";
|
||||
echo " <td class='vtable'>".$text['label-device_key_type']."</td>\n";
|
||||
if ($show_key_subtype) {
|
||||
echo " <td class='vtable'>".$text['label-device_key_subtype']."</td>\n";
|
||||
@@ -1724,16 +1727,27 @@
|
||||
}
|
||||
|
||||
echo "<td align='left' nowrap='nowrap'>\n";
|
||||
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
|
||||
if (!empty($row['device_key_vendor'])) {
|
||||
$device_key_vendor = $row['device_key_vendor'];
|
||||
echo " <select class='formfld' name='device_keys[".$x."][device_key_vendor]' id='key_vendor_".$x."'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$device_key_vendor = $row['device_key_vendor'] ?? '';
|
||||
foreach ($device_vendors as $vendor) {
|
||||
$selected = '';
|
||||
if ($device_key_vendor == $vendor['name']) {
|
||||
$selected = "selected='selected'";
|
||||
}
|
||||
if (!empty($vendor['name'])) {
|
||||
echo " <option value='".escape($vendor['name'])."' $selected >".escape(ucwords($vendor['name']))."</option>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
|
||||
echo "<td align='left' nowrap='nowrap'>\n";
|
||||
//echo " <input class='formfld' type='text' name='device_keys[".$x."][device_key_type]' style='width: 120px;' maxlength='255' value=\"$row['device_key_type']\">\n";
|
||||
if (empty($row['device_key_vendor'])) {
|
||||
$device_key_vendor = $device_vendor;
|
||||
}
|
||||
|
||||
echo "<input type='hidden' id='key_vendor_".$x."' name='device_keys[".$x."][device_key_vendor]' value=\"".$device_key_vendor."\" />\n";
|
||||
|
||||
echo "<select class='formfld' name='device_keys[".$x."][device_key_type]' id='key_type_".$x."' onchange=\"document.getElementById('key_vendor_".$x."').value = this.options[this.selectedIndex].getAttribute('vendor');\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$previous_vendor = '';
|
||||
@@ -1831,6 +1845,87 @@
|
||||
echo " </tr>";
|
||||
}
|
||||
|
||||
// Filter device key types when a vendor is selected
|
||||
echo "<select id='hidden_device_key_types' style='display: none;'>\n";
|
||||
$prev_vendor = '';
|
||||
foreach ($vendor_functions as $function) {
|
||||
if ($function['vendor_name'] != $prev_vendor) {
|
||||
if ($prev_vendor !== '') {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".escape(ucwords($function['vendor_name']))."'>\n";
|
||||
$prev_vendor = $function['vendor_name'];
|
||||
}
|
||||
echo " <option value='".escape($function['value'])."' vendor='".escape($function['vendor_name'])."'>".($text['label-'.$function['type'] ?? ''] ?? $function['value'])."</option>\n";
|
||||
}
|
||||
if ($prev_vendor !== '') {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
?>
|
||||
<script>
|
||||
const hidden_select = document.getElementById('hidden_device_key_types');
|
||||
|
||||
if (hidden_select) {
|
||||
function populate_type_select(type_select, vendor_value) {
|
||||
// Clear current options
|
||||
type_select.innerHTML = '<option value=""></option>';
|
||||
|
||||
const options = hidden_select.querySelectorAll('option');
|
||||
const selected_vendor = (vendor_value || '').trim().toLowerCase();
|
||||
|
||||
let last_label = null;
|
||||
let current_group = null;
|
||||
|
||||
for (const option of options) {
|
||||
const option_vendor = (option.getAttribute('vendor') || '').trim().toLowerCase();
|
||||
|
||||
// Filter by vendor if one is selected
|
||||
if (selected_vendor !== '' && option_vendor !== selected_vendor) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (selected_vendor === '') {
|
||||
// When no vendor selected, append all options with optgroups
|
||||
const option_group = option.closest('optgroup');
|
||||
const option_label = option_group ? option_group.getAttribute('label') : null;
|
||||
|
||||
if (option_label && option_label !== last_label) {
|
||||
if (current_group) type_select.appendChild(current_group);
|
||||
current_group = document.createElement('optgroup');
|
||||
current_group.setAttribute('label', option_label);
|
||||
last_label = option_label;
|
||||
}
|
||||
|
||||
if (current_group) {
|
||||
current_group.appendChild(option.cloneNode(true));
|
||||
} else {
|
||||
type_select.appendChild(option.cloneNode(true));
|
||||
}
|
||||
} else {
|
||||
// When a vendor is selected, append options without optgroups
|
||||
type_select.appendChild(option.cloneNode(true));
|
||||
}
|
||||
}
|
||||
|
||||
// Append the final group if it exists
|
||||
if (current_group) type_select.appendChild(current_group);
|
||||
}
|
||||
|
||||
// Attach listener to every vendor select in the table
|
||||
document.querySelectorAll('select[name*="[device_key_vendor]"]').forEach(vendor_select => {
|
||||
vendor_select.addEventListener('change', function() {
|
||||
const type_select = this.closest('tr').querySelector('select[name*="[device_key_type]"]');
|
||||
if (!type_select) return;
|
||||
|
||||
populate_type_select(type_select, this.value);
|
||||
type_select.value = ''; // Reset selection when vendor changes
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
//device settings
|
||||
if (permission_exists('device_setting_edit')) {
|
||||
$device_setting_exists = false;
|
||||
|
||||
@@ -600,7 +600,7 @@
|
||||
echo " </td>\n";
|
||||
echo " <td class='formfld'>\n";
|
||||
//echo " <input class='formfld' type='text' name='device_profile_keys[$x][profile_key_type]' maxlength='255' value=\"".escape($row["profile_key_type"])."\">\n";
|
||||
echo " <select class='formfld' name='device_profile_keys[".$x."][profile_key_type]' id='key_type_".$x."'>\n";
|
||||
echo " <select class='formfld' name='device_profile_keys[".$x."][profile_key_type]' id='key_type_".$x."' onchange=\"document.getElementById('key_vendor_".$x."').value = this.options[this.selectedIndex].getAttribute('vendor');\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$previous_vendor = '';
|
||||
$i = 0;
|
||||
|
||||
@@ -314,14 +314,15 @@
|
||||
if ($permission['domain_select'] && $permission['domain_setting_add']) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','onclick'=>'show_domains();']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-cancel'],'id'=>'btn_copy_cancel','icon'=>$settings->get('theme', 'button_icon_cancel'),'style'=>'display: none;','onclick'=>'hide_domains();']);
|
||||
echo "<select name='domain_uuid' class='formfld' style='display: none; width: auto;' id='target_domain_uuid' onchange=\"document.getElementById('domain_uuid').value = this.options[this.selectedIndex].value;\">\n";
|
||||
echo " <select name='domain_uuid' class='formfld' style='display: none; width: auto;' id='target_domain_uuid' onchange=\"document.getElementById('domain_uuid').value = this.options[this.selectedIndex].value;\">\n";
|
||||
echo " <option value=''>(".$text['label-duplicate'].")</option>\n";
|
||||
echo " <option value='' selected='selected' disabled='disabled'>".$text['label-domain']."...</option>\n";
|
||||
foreach ($_SESSION['domains'] as $domain) {
|
||||
echo " <option value='".escape($domain["domain_uuid"])."'>".escape($domain["domain_name"])."</option>\n";
|
||||
}
|
||||
echo " </select>";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-paste'],'icon'=>$settings->get('theme', 'button_icon_paste'),'id'=>'btn_paste','style'=>'display: none;','onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-paste'],'icon'=>$settings->get('theme', 'button_icon_paste'),'id'=>'btn_paste','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
}
|
||||
if ($permission['default_setting_edit'] && $default_settings) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2025
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2026
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -137,6 +137,7 @@
|
||||
echo " $('#btn_copy').fadeOut(fade_speed, function() {\n";
|
||||
echo " $('#btn_copy_cancel').fadeIn(fade_speed);\n";
|
||||
echo " $('#target_domain').fadeIn(fade_speed);\n";
|
||||
echo " if (typeof window.sync_domain_search_select_visibility === 'function') { window.sync_domain_search_select_visibility('target_domain'); }\n";
|
||||
echo " $('#btn_paste').fadeIn(fade_speed);\n";
|
||||
echo " document.getElementById('domain_uuid_target').value = '';\n";
|
||||
echo " });";
|
||||
@@ -145,6 +146,7 @@
|
||||
echo " $('#btn_copy_cancel').fadeOut(fade_speed);\n";
|
||||
echo " $('#target_domain').fadeOut(fade_speed);\n";
|
||||
echo " $('#btn_paste').fadeOut(fade_speed, function() {\n";
|
||||
echo " if (typeof window.sync_domain_search_select_visibility === 'function') { window.sync_domain_search_select_visibility('target_domain'); }\n";
|
||||
echo " $('#btn_copy').fadeIn(fade_speed);\n";
|
||||
echo " document.getElementById('target_domain').selectedIndex = 0;\n";
|
||||
echo " document.getElementById('domain_uuid_target').value = '';\n";
|
||||
@@ -168,7 +170,7 @@
|
||||
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && $num_rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-copy'],'id'=>'btn_copy','icon'=>$settings->get('theme', 'button_icon_copy'),'id'=>'btn_copy','onclick'=>'show_domains();']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-cancel'],'id'=>'btn_copy_cancel','icon'=>$settings->get('theme', 'button_icon_cancel'),'style'=>'display: none;','onclick'=>'hide_domains();']);
|
||||
echo "<select class='formfld' style='display: none; width: auto;' id='target_domain' onchange=\"document.getElementById('domain_uuid_target').value = this.options[this.selectedIndex].value;\">\n";
|
||||
echo " <select class='formfld' style='display: none; width: auto;' id='target_domain' onchange=\"document.getElementById('domain_uuid_target').value = this.options[this.selectedIndex].value;\" data-domain-search='true'>\n";
|
||||
echo " <option value='".$domain_uuid."'>(".$text['label-duplicate'].")</option>\n";
|
||||
echo " <option value='' selected='selected' disabled='disabled'>".$text['label-domain']."...</option>\n";
|
||||
foreach ($_SESSION['domains'] as $domain) {
|
||||
@@ -180,7 +182,8 @@
|
||||
echo " <option value='default'>".$text['label-default_settings']."</option>\n";
|
||||
}
|
||||
echo " </select>";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-paste'],'icon'=>$settings->get('theme', 'button_icon_paste'),'id'=>'btn_paste','style'=>'display: none;','onclick'=>"if (confirm('".$text['confirm-copy']."')) { list_action_set('copy'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-paste'],'icon'=>$settings->get('theme', 'button_icon_paste'),'id'=>'btn_paste','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
|
||||
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
if (permission_exists('domain_setting_edit') && $num_rows) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$settings->get('theme', 'button_icon_toggle'),'name'=>'btn_toggle','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
|
||||
|
||||
@@ -619,6 +619,12 @@
|
||||
$sql = "update v_email_templates set template_enabled = 'true' where template_enabled is null";
|
||||
$database->execute($sql);
|
||||
unset($sql);
|
||||
|
||||
//email templates moved to core this removes the email_templates from the app directory
|
||||
$app_email_templates = dirname(__DIR__, 2).'/app/email_templates';
|
||||
if (file_exists($app_email_templates)) {
|
||||
recursive_delete($app_email_templates);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+10
-2
@@ -86,7 +86,10 @@
|
||||
|
||||
//get the count
|
||||
$sql = "select count(*) from view_groups \n";
|
||||
$sql .= "where true \n";
|
||||
$sql .= "where ( ";
|
||||
$sql .= " group_level <= :group_level ";
|
||||
$sql .= " or group_level is null ";
|
||||
$sql .= ") ";
|
||||
if ($show == 'all' && permission_exists('group_all')) {
|
||||
$sql .= "and (domain_uuid is not null or domain_uuid is null) ";
|
||||
}
|
||||
@@ -101,6 +104,7 @@
|
||||
$sql .= ") \n";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
$parameters['group_level'] = $_SESSION['user']['group_level'];
|
||||
$num_rows = $database->select($sql, $parameters ?? [], 'column');
|
||||
|
||||
//prepare to page the results
|
||||
@@ -124,7 +128,10 @@
|
||||
$sql .= "group_level, ";
|
||||
$sql .= "group_description ";
|
||||
$sql .= "from view_groups ";
|
||||
$sql .= "where true \n";
|
||||
$sql .= "where ( ";
|
||||
$sql .= " group_level <= :group_level ";
|
||||
$sql .= " or group_level is null ";
|
||||
$sql .= ") ";
|
||||
if ($show == 'all' && permission_exists('group_all')) {
|
||||
$sql .= "and (domain_uuid is not null or domain_uuid is null) ";
|
||||
}
|
||||
@@ -141,6 +148,7 @@
|
||||
}
|
||||
$sql .= order_by($order_by, $order, 'group_name', 'asc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$parameters['group_level'] = $_SESSION['user']['group_level'];
|
||||
$groups = $database->select($sql, $parameters ?? [], 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
|
||||
@@ -430,15 +430,35 @@
|
||||
|
||||
// Update the php-fpm.service file
|
||||
if (PHP_OS === 'Linux') {
|
||||
$php_version = implode('.', array_slice(explode('.', PHP_VERSION), 0, 2));
|
||||
$line_to_insert = "ReadWritePaths=/tmp /etc/freeswitch /usr/share/freeswitch /var/lib/freeswitch /var/cache/fusionpbx";
|
||||
// Get the PHP version
|
||||
$php_version = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION;
|
||||
|
||||
// Make sure the /usr/share/fusionpbx directory exists
|
||||
if (!file_exists('/usr/share/fusionpbx')) {
|
||||
mkdir('/usr/share/fusionpbx', 0755, true);
|
||||
}
|
||||
|
||||
// Build the read write paths array
|
||||
$read_write_paths[] = '/etc/freeswitch';
|
||||
$read_write_paths[] = '/usr/share/freeswitch';
|
||||
$read_write_paths[] = '/var/lib/freeswitch';
|
||||
$read_write_paths[] = $settings->get('cache', 'location', '/var/cache/fusionpbx');
|
||||
$read_write_paths[] = '/usr/share/fusionpbx';
|
||||
|
||||
// Build the line to add to the service file
|
||||
$line_to_insert = "ReadWritePaths=/tmp";
|
||||
foreach($read_write_paths as $read_write_path) {
|
||||
if (file_exists($read_write_path)) {
|
||||
$line_to_insert .= ' '.$read_write_path;
|
||||
}
|
||||
}
|
||||
$service_file = "/usr/lib/systemd/system/php".$php_version."-fpm.service";
|
||||
if (file_exists($service_file)) {
|
||||
// Get the file contents
|
||||
$file_contents = file_get_contents($service_file);
|
||||
|
||||
// Check if "/etc/freeswitch" exists in the file contents
|
||||
$file_updated = strpos($file_contents, '/etc/freeswitch') !== false;
|
||||
// Check if "ReadWritePaths" exists in the file contents
|
||||
$file_updated = strpos($file_contents, 'ReadWritePaths') !== false;
|
||||
|
||||
// Check if the service file is writable
|
||||
$file_writable = is_writable($service_file);
|
||||
|
||||
Reference in New Issue
Block a user