Update boolean toggle and the database boolean type (#7522)

* Change the data type to boolean

* Use boolean values in SQL and Conditional Statements

* Schema Data Types: Drop views so that alter tables statements complete

* Update settings.php

* Add extension for call_screen_enabled

* Gateway handle boolean
Add the boolean toggle
- distinct_to
- caller_id_in_from
- supress_cng
- extension_in_contact
- contact_in_ping

* Update gateways.php

* Update voicemail_edit.php

* Replace the ${caller_id_name} with the extensions caller id name

* Phrase - Edit: Update slide toggle with new select beneath.

* Update the input toggle style

* Set the input_toggle_style_switch as boolean

* Update the input toggle style

* Theme: Adjust CSS to wrap description text on form fields.

* Add domain_uuid and domain_name to the SQL SELECT

* Unset the parameters to fix the next query

* Gateway: Integrate new slide toggle switch.

* Dashboard: Update the input toggle style (#7499)

* Dashboard: Update the input toggle style

* Update dashboard_widget_edit.php

* Update dashboard_edit.php

* Inbound Route - Add: Integrate new slide toggle switch and boolean.

* User Settings: Integrate new slide toggle switch.

* Call Block Edit: Update the input toggle style (#7500)

* Bridge Edit: Update the input toggle style (#7501)

* Update phrases.php

* Update domain_edit.php

* Domain Settings Edit: Update the input toggle style

* User Edit: Update the input toggle style

* Update install.php

* Remove fields marked as deprecated

* Use boolean in the select statement

* Streams: New slide toggle and boolean.

* Streams: Remove unnecessary default.

* Queues (FIFO): New slide toggle.

* Call Detail Records: Update the input toggle style (#7503)

* Call Detail Records: Update the input toggle style

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Update xml_cdr_extension_summary.php

* Call Centers: Update the input toggle style (#7502)

* Call Centers: Update the input toggle style

* Update call_center_agent_edit.php

* Conference Centers: Update the input toggle style (#7506)

* Conference Centers: Update the input toggle style

* Update app_config.php

* Update conference_center_edit.php

* Use boolean data type (#7505)

* Call Flow Edit: Update the input toggle style (#7504)

* Devices: Update the input toggle style

* IVR Menus: New slide toggle.

* IVR Menu: Remove deprected file.

* SIP Profile - Edit: New slide toggle.

* Device Profiles: Update the input toggle style

* Ring Groups - List: Fix syntax.

* Theme: Fire onchange event when switching slide toggle control.

* Device Vendors: Update the input toggle style

* Update enabled boolean

* Update device_edit.php

* Ring Groups: New slide toggle.

* Update domain_edit.php

* Email Templates: Update the input toggle style

* Header: Correct default value on input toggle style.

* Default/Domain/User Settings: Adjust Select option label for better clarity.

* Use true boolean types for switch theme toggle or drop-down box (#7507)

* Groups: Update the input toggle style

* Conference Controls: Update the input toggle style (#7509)

* Conference Controls: Update the input toggle style

* Update conference_control_edit.php

* Update conference_control_details.php

* Update conference_control_detail_edit.php

* Conferences: Update the input toggle style (#7511)

* Use true boolean types for switch theme toggle or drop-down box (#7513)

* Dialplans: Update the input toggle style
Also updated outbound route add

* Ring Group: Only adjust ring group forward destination top margin when slide toggle enabled.

* Default/Domain/User Settings - List: Adjust for new 'Select Box' label on input_toggle_style value.

* Use true boolean types for switch theme toggle or drop-down box (#7514)

* Call Forward / Follow Me: Minor javascript adjustments to mirror previous behavior.

* Ring Groups [Dashboard]: New slide toggle.

* Get the contacts details with a seperate SQL Query

* Remove debug info

* Destinations: Update the input toggle style

* Conference Profiles: Update the input toggle style (#7515)

* Conference Profiles: Update the input toggle style

* Update conference_profiles.php

* Update conference_profile_params.php

* Update conference_profile_param_edit.php

* Update conference_profile_edit.php

* Extensions: Update the input toggle style

* Contacts: Update the input toggle style (#7517)

* Contacts: Update the input toggle style

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_edit.php

* Update contact_email_edit.php

* Update contact_phone_edit.php

* Update contact_relation_edit.php

* Update contact_setting_edit.php

* Update contact_url_edit.php

* Update contacts.php

* Voicemails: New slide toggle.

* Voicemail Greeting: New slide toggle.

* Modules: New slide toggle.

* Recordings: New slide toggle

* Variables: New slide toggle.

* Time Conditions: New slide toggle.

* Extensions - List: Remove invalid column name.

* Extension Settings: New slide toggle.

* Number Translations: New slide toggle and boolean.

* Sofia global settings: Update the input toggle style

* Update alter table convert to boolean

* Fix contact relation search (#7518)

* Sip Profile Edit: Fix setting enabled labels (#7519)

* Sip Profile Edit: Fix setting enabled labels

* Update sip_profile_edit.php

* Update dialplan_edit.php (#7520)

* Update SQL queries to use true/false for contact primary settings (#7521)

* Update SQL queries to use true/false for contact primary settings

* Update contacts_vcard.php

* Update email.php

* Update totp.php

* Update contact_url_edit.php

* Update contact_email_edit.php

* Update contact_address_edit.php

* Update contact_attachment_edit.php

* Update contact_phone_edit.php

* Add a database views method

* Add database view groups

* Add database users view

* Add database call_recordings view

* Update users.php

* Add  database view call block

* Update schema to use the database views method

* Update conference.conf.lua boolean

* Update directory.lua boolean

* Update callcenter.conf.lua agent_status boolean

* Update sofia.conf.lua boolean

* Update number translations lua boolean

* Update directory.lua boolean

* Update group_call.lua fix the cache

* Update reverse-auth-lookup.lua boolean

* Update directory.lua boolean

* Use concat instead of ||

* Update index.lua

---------

Co-authored-by: fusionate <nate@fusionpbx.com>
Co-authored-by: Alex <alex@fusionpbx.com>
Co-authored-by: frytimo <tim@fusionpbx.com>
This commit is contained in:
FusionPBX
2025-09-20 18:42:05 -06:00
committed by GitHub
parent 96874c19b8
commit 7f9064fadb
223 changed files with 3215 additions and 2963 deletions

View File

@@ -327,7 +327,7 @@ class authentication {
$sql = "select * from v_user_settings ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and user_uuid = :user_uuid ";
$sql .= "and user_setting_enabled = 'true' ";
$sql .= "and user_setting_enabled = true ";
$parameters['domain_uuid'] = $result["domain_uuid"];
$parameters['user_uuid'] = $result["user_uuid"];
$user_settings = $database->select($sql, $parameters, 'all');

View File

@@ -212,20 +212,9 @@ class plugin_database {
$sql .= " u.salt, ";
$sql .= " u.api_key, ";
$sql .= " u.domain_uuid ";
if ($contacts_exists) {
$sql .= ",";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family, ";
$sql .= "a.contact_attachment_uuid ";
}
$sql .= "from ";
$sql .= " v_domains as d, ";
$sql .= " v_users as u ";
if ($contacts_exists) {
$sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null ";
$sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null ";
}
$sql .= "where ";
$sql .= " u.domain_uuid = d.domain_uuid ";
$sql .= " and (";
@@ -251,7 +240,7 @@ class plugin_database {
$sql .= "and u.domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $this->domain_uuid;
}
$sql .= "and (user_enabled = 'true' or user_enabled is null) ";
$sql .= "and (user_enabled = true or user_enabled is null) ";
$row = $settings->database()->select($sql, $parameters, 'row');
if (!empty($row) && is_array($row) && @sizeof($row) != 0) {
@@ -296,11 +285,29 @@ class plugin_database {
$this->username = $row['username'];
$this->user_email = $row['user_email'];
$this->contact_uuid = $row['contact_uuid'];
//get the user contact details
if ($contacts_exists) {
$this->contact_organization = $row['contact_organization'];
$this->contact_name_given = $row['contact_name_given'];
$this->contact_name_family = $row['contact_name_family'];
$this->contact_image = $row['contact_attachment_uuid'];
$sql = "select ";
$sql .= " c.contact_organization, ";
$sql .= " c.contact_name_given, ";
$sql .= " c.contact_name_family, ";
$sql .= " a.contact_attachment_uuid, ";
$sql .= "from v_contacts as c ";
$sql .= "where contact_uuid = :contact_uuid ";
$sql .= "left join v_contact_attachments as a ";
$sql .= " on c.contact_uuid = a.contact_uuid ";
$sql .= "and a.attachment_primary = true ";
$sql .= "and a.attachment_filename is not null ";
$sql .= "and a.attachment_content is not null ";
$sql .= "and c.domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $this->domain_uuid;
$parameters['contact_uuid'] = $this->contact_uuid;
$contact = $settings->database()->select($sql, $parameters, 'row');
$this->contact_organization = $contact['contact_organization'];
$this->contact_name_given = $contact['contact_name_given'];
$this->contact_name_family = $contact['contact_name_family'];
$this->contact_image = $contact['contact_attachment_uuid'];
}
//debug info

View File

@@ -222,7 +222,7 @@ class plugin_email {
$sql .= "and template_category = :template_category ";
$sql .= "and template_subcategory = :template_subcategory ";
$sql .= "and template_type = :template_type ";
$sql .= "and template_enabled = 'true' ";
$sql .= "and template_enabled = true ";
$parameters['domain_uuid'] = $_SESSION["domain_uuid"];
$parameters['template_language'] = $language_code;
$parameters['template_category'] = 'authentication';
@@ -423,7 +423,7 @@ class plugin_email {
$sql .= " v_users as u ";
if ($contacts_exists) {
$sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null ";
$sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null ";
$sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = true and a.attachment_filename is not null and a.attachment_content is not null ";
}
$sql .= "where ";
$sql .= " u.user_uuid = :user_uuid ";

View File

@@ -169,7 +169,7 @@ class plugin_ldap {
$array['users'][0]['salt'] = $salt;
$array['users'][0]['add_date'] = now();
$array['users'][0]['add_user'] = strtolower($this->username);
$array['users'][0]['user_enabled'] = 'true';
$array['users'][0]['user_enabled'] = true;
//build user group insert array
$array['user_groups'][0]['user_group_uuid'] = uuid();

View File

@@ -349,7 +349,7 @@ class plugin_totp {
$sql .= " v_users as u ";
if ($contacts_exists) {
$sql .= "left join v_contacts as c on u.contact_uuid = c.contact_uuid and u.contact_uuid is not null ";
$sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = 1 and a.attachment_filename is not null and a.attachment_content is not null ";
$sql .= "left join v_contact_attachments as a on u.contact_uuid = a.contact_uuid and u.contact_uuid is not null and a.attachment_primary = true and a.attachment_filename is not null and a.attachment_content is not null ";
}
$sql .= "where ";
$sql .= " u.user_uuid = :user_uuid ";

View File

@@ -403,7 +403,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for an address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "address_street";
@@ -536,7 +536,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the extension.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "phone_description";
@@ -811,7 +811,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "contact_setting_description";
@@ -940,7 +940,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the email address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_address";
@@ -1013,7 +1013,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Custom label for the url.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "url_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Designate a primary address.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "url_address";
@@ -1152,7 +1152,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_primary";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Primary attachments are used as the Contact photo and sent with Messages.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "attachment_filename";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -144,7 +144,7 @@
//if primary, unmark other primary addresses
if ($email_primary) {
$sql = "update v_contact_addresses set address_primary = 0 ";
$sql = "update v_contact_addresses set address_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -181,7 +181,7 @@
$array['contact_addresses'][0]['address_country'] = $address_country;
$array['contact_addresses'][0]['address_latitude'] = $address_latitude;
$array['contact_addresses'][0]['address_longitude'] = $address_longitude;
$array['contact_addresses'][0]['address_primary'] = $address_primary ? 1 : 0;
$array['contact_addresses'][0]['address_primary'] = $address_primary;
$array['contact_addresses'][0]['address_description'] = $address_description;
$database = new database;
@@ -435,10 +435,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='address_primary' id='address_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($address_primary) && $address_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='address_primary' name='address_primary'>\n";
echo " <option value='true' ".($address_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($address_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-address_primary']."\n";
echo "</td>\n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -79,7 +79,7 @@
//unflag others as primary
$allowed_primary_attachment = false;
if ($attachment_primary && ($attachment_extension == 'jpg' || $attachment_extension == 'jpeg' || $attachment_extension == 'gif' || $attachment_extension == 'png')) {
$sql = "update v_contact_attachments set attachment_primary = 0 ";
$sql = "update v_contact_attachments set attachment_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -261,10 +261,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='attachment_primary' id='attachment_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($attachment_primary) && $attachment_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='attachment_primary' name='attachment_primary'>\n";
echo " <option value='true' ".($attachment_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($attachment_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "</td>\n";
echo "</tr>\n";

View File

@@ -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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
*/
@@ -512,7 +512,7 @@
$array['contacts'][0]['contact_settings'][$y]['contact_setting_name'] = $row["contact_setting_name"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_value'] = $row["contact_setting_value"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_order'] = $row["contact_setting_order"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"] ?? 'false';
$array['contacts'][0]['contact_settings'][$y]['contact_setting_enabled'] = $row["contact_setting_enabled"];
$array['contacts'][0]['contact_settings'][$y]['contact_setting_description'] = $row["contact_setting_description"];
$y++;
}
@@ -897,7 +897,7 @@
$contact_settings[$x]['contact_setting_name'] = '';
$contact_settings[$x]['contact_setting_value'] = '';
$contact_settings[$x]['contact_setting_order'] = '';
$contact_settings[$x]['contact_setting_enabled'] = 'true';
$contact_settings[$x]['contact_setting_enabled'] = true;
$contact_settings[$x]['contact_setting_description'] = '';
}
@@ -1712,7 +1712,7 @@ if (permission_exists('contact_phone_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['phone_primary'] == "1") {
if ($row['phone_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -1833,22 +1833,17 @@ if (permission_exists('contact_phone_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_phones[$x][phone_primary]' style='width: auto;'>\n";
echo " <option value=''></option>\n";
if ($row['phone_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='phone_primary' name='contact_phones[$x][phone_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['phone_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['phone_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
if ($row['phone_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
//echo $text['description-phone_primary']."\n";
echo " </div>\n";
@@ -1905,7 +1900,7 @@ if (permission_exists('contact_address_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['address_primary'] == "1") {
if ($row['address_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2096,21 +2091,17 @@ if (permission_exists('contact_address_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_addresses[$x][address_primary]' style='width: auto;'>\n";
echo " <option value=''>".escape($text['label-address_primary'] ?? '')."</option>\n";
if ($row['address_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='address_primary' name='contact_addresses[$x][address_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['address_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['address_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
if ($row['address_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo " </div>\n";
echo " <div class='label'>\n";
@@ -2155,7 +2146,7 @@ if (permission_exists('contact_email_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['email_primary'] == "1") {
if ($row['email_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2182,21 +2173,17 @@ if (permission_exists('contact_email_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_emails[$x][email_primary]' style='width: auto;'>\n";
echo " <option value=''>".escape($text['label-contact_emails'] ?? '')."</option>\n";
if ($row['email_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='email_primary' name='contact_emails[$x][email_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['email_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['email_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
if ($row['email_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
//echo " <br />\n";
//echo $text['description-email_primary']."\n";
echo " </div>\n";
@@ -2248,7 +2235,7 @@ if (permission_exists('contact_url_view')) {
echo " </div>\n";
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['url_primary'] == "1") {
if ($row['url_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2303,34 +2290,29 @@ if (permission_exists('contact_url_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_urls[$x][url_primary]' style='width: auto;'>\n";
echo " <option value=''></option>\n";
if ($row['url_primary'] == "1") {
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='1'>".$text['label-true']."</option>\n";
}
if ($row['url_primary'] == "0") {
echo " <option value='0' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='0'>".$text['label-false']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='url_primary' name='contact_urls[$x][url_primary]' style='width: auto;'>\n";
echo " <option value='true' ".($row['url_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['url_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </div>\n";
echo " <div class='label'>\n";
echo " ".$text['label-url_description']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <input class='formfld' type='text' name='contact_urls[$x][url_description]' placeholder='' maxlength='255' value=\"".escape($row["url_description"])."\">\n";
echo " </div>\n";
if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
if (is_uuid($row['contact_url_uuid'])) {
echo " <input type='checkbox' name='contact_urls[".$x."][checked]' value='true' class='chk_delete checkbox_details' onclick=\"checkbox_on_change(this);\">\n";
}
}
// if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
// if (is_uuid($row['contact_url_uuid'])) {
// echo " <input type='checkbox' name='contact_urls[".$x."][checked]' value='true' class='chk_delete checkbox_details' onclick=\"checkbox_on_change(this);\">\n";
// }
// }
//echo " <br />\n";
//echo " ".$text['description-contact_organization']."\n";
echo " <div class='label empty_row' style='grid-row: 6 / span 99;'>\n";
@@ -2511,17 +2493,16 @@ if (permission_exists('contact_setting_view')) {
echo " ".$text['label-enabled']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='contact_settings[$x][contact_setting_enabled]' value='true' ".(empty($row['contact_setting_enabled']) || $row['contact_setting_enabled'] == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' name='contact_settings[$x][contact_setting_enabled]'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($row['contact_setting_enabled']) && $row['contact_setting_enabled'] == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='contact_setting_enabled' name='contact_settings[$x][contact_setting_enabled]' style='width: auto;'>\n";
echo " <option value='true' ".($row['contact_setting_enabled'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($row['contact_setting_enabled'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </div>\n";
echo " <div class='label'>\n";
@@ -2561,7 +2542,7 @@ if (permission_exists('contact_attachment_view')) {
}
echo " </div>\n";
echo " <div style='clear: both;'>\n";
if ($row['attachment_primary'] == "1") {
if ($row['attachment_primary'] === true) {
echo " <i class='fa-solid fa-star fa-sm' style='color: ".$body_text_color."; float: right; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
}
echo " </div>\n";
@@ -2614,10 +2595,17 @@ if (permission_exists('contact_attachment_view')) {
echo " ".$text['label-primary']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";
echo " <select class='formfld' name='contact_attachments[$x][attachment_primary]' id='attachment_primary' style='width: auto;'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($row['attachment_primary']) ? "selected" : null).">".$text['option-true']."</option>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='attachment_primary' name='contact_attachments[$x][attachment_primary]' style='width: auto;'>\n";
echo " <option value='false' ".($row['attachment_primary'] === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($row['attachment_primary'] === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo " </div>\n";
echo " <div class='label'>\n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -125,7 +125,7 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
//if primary, unmark other primary emails
if ($email_primary) {
$sql = "update v_contact_emails set email_primary = 0 ";
$sql = "update v_contact_emails set email_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -291,10 +291,17 @@ if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='email_primary' id='email_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(!empty($email_primary) && $email_primary ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='email_primary' name='email_primary'>\n";
echo " <option value='false' ".($email_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($email_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-email_primary']."\n";
echo "</td>\n";

View File

@@ -80,7 +80,7 @@ if ($_POST['a'] == 'import') {
$sql .= "and contact_setting_category = 'google' ";
$sql .= "and contact_setting_subcategory = 'id' ";
$sql .= "and contact_setting_value = :contact_setting_value ";
$sql .= "and contact_setting_enabled = 'true' ";
$sql .= "and contact_setting_enabled = true ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['contact_setting_value'] = $contact_id;
$database = new database;

View File

@@ -57,7 +57,7 @@
$sql = "select *, ";
$sql .= "( ";
$sql .= " select a.contact_attachment_uuid from v_contact_attachments as a ";
$sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 ";
$sql .= " where a.contact_uuid = c.contact_uuid and a.attachment_primary = true ";
$sql .= ") as contact_attachment_uuid ";
$sql .= "from v_contacts as c ";
$sql .= "where true ";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -145,7 +145,7 @@
//if primary, unmark other primary numbers
if ($phone_primary) {
$sql = "update v_contact_phones set phone_primary = 0 ";
$sql = "update v_contact_phones set phone_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -400,10 +400,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='phone_primary' id='phone_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($phone_primary) ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='phone_primary' name='phone_primary'>\n";
echo " <option value='false' ".($phone_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($phone_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-phone_primary']."\n";
echo "</td>\n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -321,7 +321,7 @@
echo "<td class='vtable' align='left'>\n";
echo " <input class=\"formfld\" type=\"text\" name=\"contact_search\" placeholder=\"search\" style=\"width: 80px;\" onkeyup=\"get_contacts('contact_select', 'contact_uuid', this.value);\" maxlength=\"255\" value=\"\">\n";
echo " <select class='formfld' style=\"width: 150px;\" id=\"contact_select\" name=\"relation_contact_uuid\" >\n";
echo " <option value='".escape($relation_contact_uuid ?? '')."'>".escape($contact_name ?? '')."</option>\n";
echo " <option value='".escape($relation_contact_uuid ?? '')."'>".escape($relation_contact_uuid ?? '')."</option>\n";
echo " </select>\n";
echo "</td>\n";
echo "</tr>\n";
@@ -332,10 +332,17 @@
echo " ".$text['label-contact_relation_reciprocal']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='relation_reciprocal' id='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1'>".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='relation_reciprocal' name='relation_reciprocal' onchange=\"$('#reciprocal_label').slideToggle(400);\">\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-contact_relation_reciprocal']."\n";
echo "</td>\n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -75,7 +75,7 @@
$contact_setting_name = strtolower($_POST["contact_setting_name"]);
$contact_setting_value = $_POST["contact_setting_value"];
$contact_setting_order = $_POST["contact_setting_order"] ?? null;
$contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? 'false';
$contact_setting_enabled = strtolower($_POST["contact_setting_enabled"]) ?? false;
$contact_setting_description = $_POST["contact_setting_description"];
}
@@ -312,17 +312,16 @@
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='contact_setting_enabled' value='true' ".(empty($contact_setting_enabled) || $contact_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' name='contact_setting_enabled'>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($contact_setting_enabled) && $contact_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='contact_setting_enabled' name='contact_setting_enabled'>\n";
echo " <option value='false' ".($contact_setting_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($contact_setting_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-enabled']."\n";

View File

@@ -137,4 +137,3 @@
}
?>

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -128,7 +128,7 @@
//if primary, unmark other primary urls
if ($url_primary) {
$sql = "update v_contact_urls set url_primary = 0 ";
$sql = "update v_contact_urls set url_primary = false ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$parameters['domain_uuid'] = $domain_uuid;
@@ -294,10 +294,17 @@
echo " ".$text['label-primary']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='url_primary' id='url_primary'>\n";
echo " <option value='0'>".$text['option-false']."</option>\n";
echo " <option value='1' ".(($url_primary) ? "selected" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
echo " <select class='formfld' id='url_primary' name='url_primary'>\n";
echo " <option value='false' ".($url_primary === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " <option value='true' ".($url_primary === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-url_primary']."\n";
echo "</td>\n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -245,7 +245,7 @@
//get the list
$sql = "select *, ";
$sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = 1 limit 1) as contact_attachment_uuid ";
$sql .= "(select a.contact_attachment_uuid from v_contact_attachments as a where a.contact_uuid = c.contact_uuid and a.attachment_primary = true limit 1) as contact_attachment_uuid ";
$sql .= "from v_contacts as c ";
$sql .= "where true ";
if ($show != "all" || !permission_exists('contact_all')) {
@@ -472,5 +472,3 @@
require_once "resources/footer.php";
?>

View File

@@ -94,7 +94,7 @@ if (!empty($_GET)) {
$sql = "select url_address from v_contact_urls ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and contact_uuid = :contact_uuid ";
$sql .= "and url_primary = 1 ";
$sql .= "and url_primary = true ";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['contact_uuid'] = $contact_uuid;
$database = new database;

View File

@@ -220,17 +220,16 @@
echo " ".$text['label-dashboard_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='dashboard_enabled' name='dashboard_enabled' value='true' ".($dashboard_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='dashboard_enabled' name='dashboard_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($dashboard_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='dashboard_enabled' name='dashboard_enabled'>\n";
echo " <option value='true' ".($dashboard_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dashboard_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-dashboard_enabled']."\n";

View File

@@ -55,7 +55,7 @@
$widget_content_text_align = '';
$widget_content_details = '';
$widget_groups = [];
$widget_label_enabled = 'true';
$widget_label_enabled = '';
$widget_label_text_color = '';
$widget_label_text_color_hover = '';
$widget_label_background_color = '';
@@ -67,7 +67,7 @@
$widget_details_state = '';
$widget_parent_uuid = '';
$widget_order = '';
$widget_enabled = 'true';
$widget_enabled = '';
$widget_description = '';
//action add or update
@@ -96,7 +96,7 @@
$widget_content_details = $_POST["widget_content_details"] ?? '';
$widget_groups = $_POST["dashboard_widget_groups"] ?? '';
$widget_chart_type = $_POST["widget_chart_type"] ?? '';
$widget_label_enabled = $_POST["widget_label_enabled"] ?? 'false';
$widget_label_enabled = $_POST["widget_label_enabled"];
$widget_label_text_color = $_POST["widget_label_text_color"] ?? '';
$widget_label_text_color_hover = $_POST["widget_label_text_color_hover"] ?? '';
$widget_label_background_color = $_POST["widget_label_background_color"] ?? '';
@@ -114,7 +114,7 @@
$widget_details_state = $_POST["widget_details_state"] ?? '';
$widget_parent_uuid = $_POST["dashboard_widget_parent_uuid"] ?? '';
$widget_order = $_POST["widget_order"] ?? '';
$widget_enabled = $_POST["widget_enabled"] ?? 'false';
$widget_enabled = $_POST["widget_enabled"];
$widget_description = $_POST["widget_description"] ?? '';
//define the regex patterns
@@ -357,7 +357,7 @@
$sql .= " widget_content_text_align, ";
$sql .= " widget_content_details, ";
$sql .= " widget_chart_type, ";
$sql .= " cast(widget_label_enabled as text), ";
$sql .= " widget_label_enabled, ";
$sql .= " widget_label_text_color, ";
$sql .= " widget_label_text_color_hover, ";
$sql .= " widget_label_background_color, ";
@@ -626,7 +626,7 @@
$items_to_remove[] = 'widget_width';
$items_to_remove[] = 'widget_height';
}
if ($widget_label_enabled == "false") {
if ($widget_label_enabled === false) {
$items_to_remove[] = 'widget_label_text_color';
$items_to_remove[] = 'widget_label_text_color_hover';
$items_to_remove[] = 'widget_label_background_color';
@@ -763,6 +763,7 @@ document.addEventListener('DOMContentLoaded', function() {
document.getElementById('widget_url').addEventListener('change', adjust_form_url);
document.getElementById('widget_target').addEventListener('change', adjust_form_url);
document.getElementById('widget_label_enabled').addEventListener('change', toggle_label_settings);
document.querySelector('.switch:has(#widget_label_enabled)').addEventListener('click', toggle_label_settings);
});
</script>
@@ -1062,17 +1063,16 @@ document.addEventListener('DOMContentLoaded', function() {
echo "\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='widget_label_enabled' name='widget_label_enabled' value='true' ".(empty($widget_label_enabled) || $widget_label_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='widget_label_enabled' name='widget_label_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".(empty($widget_label_enabled) || $widget_label_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='widget_label_enabled' name='widget_label_enabled'>\n";
echo " <option value='true' ".($widget_label_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($widget_label_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-widget_label_enabled']."\n";
@@ -1386,17 +1386,16 @@ document.addEventListener('DOMContentLoaded', function() {
echo " ".$text['label-widget_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='widget_enabled' name='widget_enabled' value='true' ".($widget_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='widget_enabled' name='widget_enabled'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($widget_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='widget_enabled' name='widget_enabled'>\n";
echo " <option value='true' ".($widget_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($widget_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-widget_enabled']."\n";

View File

@@ -53,7 +53,7 @@
unset($_SESSION['login']['message']['text']);
$sql = "update v_default_settings ";
$sql .= "set default_setting_enabled = 'false' ";
$sql .= "set default_setting_enabled = false ";
$sql .= "where ";
$sql .= "default_setting_category = 'login' ";
$sql .= "and default_setting_subcategory = 'message' ";
@@ -75,7 +75,7 @@
//get the dashboard uuid
$sql = "select dashboard_uuid ";
$sql .= "from v_dashboards ";
$sql .= "where dashboard_enabled = 'true' ";
$sql .= "where dashboard_enabled = true ";
$sql .= "and (";
$sql .= " domain_uuid = :domain_uuid ";
$sql .= " or domain_uuid is null ";
@@ -127,7 +127,7 @@
$sql .= "cast(widget_enabled as text), ";
$sql .= "widget_description ";
$sql .= "from v_dashboard_widgets as d ";
$sql .= "where widget_enabled = 'true' ";
$sql .= "where widget_enabled = true ";
$sql .= "and dashboard_widget_uuid in ( ";
$sql .= " select dashboard_widget_uuid from v_dashboard_widget_groups where group_uuid in ( ";
$sql .= " ".$group_uuids_in." ";
@@ -322,7 +322,7 @@ foreach ($widgets as $row) {
echo " color: ".$row['widget_icon_color'].";\n";
echo "}\n";
}
if ($row['widget_label_enabled'] == 'false' && $row['widget_path'] != 'dashboard/parent') {
if ($row['widget_label_enabled'] === false && $row['widget_path'] != 'dashboard/parent') {
echo "#".$widget_id." .hud_title:first-of-type {\n";
echo " display: none;\n";
echo "}\n";

View File

@@ -270,33 +270,32 @@ $text['option-button_icons_never']['zh-cn'] = "绝不";
$text['option-button_icons_never']['ja-jp'] = "一度もない";
$text['option-button_icons_never']['ko-kr'] = "절대";
$text['option-select']['en-us'] = "Select";
$text['option-select']['en-gb'] = "Select";
$text['option-select']['ar-eg'] = "يختار";
$text['option-select']['de-at'] = "Auswählen";
$text['option-select']['de-ch'] = "Auswählen";
$text['option-select']['de-de'] = "Auswählen";
$text['option-select']['el-gr'] = "Επιλέξτε";
$text['option-select']['es-cl'] = "Seleccionar";
$text['option-select']['es-mx'] = "Seleccionar";
$text['option-select']['fr-ca'] = "Sélectionner";
$text['option-select']['fr-fr'] = "Sélectionner";
$text['option-select']['he-il'] = "בחר";
$text['option-select']['it-it'] = "Selezionare";
$text['option-select']['ka-ge'] = "არჩევა";
$text['option-select']['nl-nl'] = "selectie";
$text['option-select']['pl-pl'] = "Wybierz";
$text['option-select']['pt-br'] = "Selecionar";
$text['option-select']['pt-pt'] = "Selecionar";
$text['option-select']['ro-ro'] = "Selectați";
$text['option-select']['ru-ru'] = "Выбирать";
$text['option-select']['sv-se'] = "Välj";
$text['option-select']['uk-ua'] = "Виберіть";
$text['option-select']['tr-tr'] = "Seç";
$text['option-select']['tr-tr'] = "Seçme";
$text['option-select']['zh-cn'] = "选择";
$text['option-select']['ja-jp'] = "選択する";
$text['option-select']['ko-kr'] = "선택하다";
$text['option-select_box']['en-us'] = "Select Box";
$text['option-select_box']['en-gb'] = "Select Box";
$text['option-select_box']['ar-eg'] = "حدد المربع";
$text['option-select_box']['de-at'] = "Auswahlfeld";
$text['option-select_box']['de-ch'] = "Auswahlfeld";
$text['option-select_box']['de-de'] = "Auswahlfeld";
$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου";
$text['option-select_box']['es-cl'] = "Cuadro de selección";
$text['option-select_box']['es-mx'] = "Cuadro de selección";
$text['option-select_box']['fr-ca'] = "Boîte de sélection";
$text['option-select_box']['fr-fr'] = "Boîte de sélection";
$text['option-select_box']['he-il'] = "בחר תיבה";
$text['option-select_box']['it-it'] = "Seleziona casella";
$text['option-select_box']['ka-ge'] = "რჩიეთ ველი";
$text['option-select_box']['nl-nl'] = "Selecteer vak";
$text['option-select_box']['pl-pl'] = "Wybierz pole";
$text['option-select_box']['pt-br'] = "Caixa de seleção";
$text['option-select_box']['pt-pt'] = "Caixa de seleção";
$text['option-select_box']['ro-ro'] = "Selectați caseta";
$text['option-select_box']['ru-ru'] = "Выбрать поле";
$text['option-select_box']['sv-se'] = "Välj ruta";
$text['option-select_box']['uk-ua'] = "Виберіть поле";
$text['option-select_box']['tr-tr'] = "Seçim Kutusu";
$text['option-select_box']['zh-cn'] = "选择框";
$text['option-select_box']['ja-jp'] = "選択ボックス";
$text['option-select_box']['ko-kr'] = "선택 상자";
$text['option-switch_round']['en-us'] = "Round Switch";
$text['option-switch_round']['en-gb'] = "Round Switch";

View File

@@ -75,7 +75,7 @@
$default_setting_name = strtolower($_POST["default_setting_name"] ?? '');
$default_setting_value = $_POST["default_setting_value"] ?? '';
$default_setting_order = $_POST["default_setting_order"] ?? '';
$default_setting_enabled = $_POST["default_setting_enabled"] ?? 'false';
$default_setting_enabled = $_POST["default_setting_enabled"];
$default_setting_description = $_POST["default_setting_description"] ?? '';
}
@@ -250,7 +250,7 @@
//pre-populate the form
if (count($_GET) > 0 && empty($_POST["persistformvar"])) {
$default_setting_uuid = $_GET["id"] ?? '';
$sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, cast(default_setting_enabled as text), default_setting_description ";
$sql = "select default_setting_uuid, default_setting_category, default_setting_subcategory, default_setting_name, default_setting_value, default_setting_order, default_setting_enabled, default_setting_description ";
$sql .= "from v_default_settings ";
$sql .= "where default_setting_uuid = :default_setting_uuid ";
$parameters['default_setting_uuid'] = $default_setting_uuid;
@@ -267,9 +267,6 @@
unset($sql, $parameters);
}
//set the defaults
if (empty($default_setting_enabled)) { $default_setting_enabled = 'true'; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -689,7 +686,7 @@
}
elseif ($category == "theme" && $subcategory == "input_toggle_style" && $name == "text" ) {
echo " <select class='formfld' id='default_setting_value' name='default_setting_value'>\n";
echo " <option value='select'>".$text['option-select']."</option>\n";
echo " <option value='select'>".$text['option-select_box']."</option>\n";
echo " <option value='switch_round' ".(($default_setting_value == "switch_round") ? "selected='selected'" : null).">".$text['option-switch_round']."</option>\n";
echo " <option value='switch_square' ".(($default_setting_value == "switch_square") ? "selected='selected'" : null).">".$text['option-switch_square']."</option>\n";
echo " </select>\n";
@@ -770,6 +767,7 @@
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<div id='tr_order' ".(($default_setting_name != 'array') ? "style='display: none;'" : null).">\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
@@ -799,23 +797,23 @@
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='default_setting_enabled' name='default_setting_enabled' value='true' ".($default_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='default_setting_enabled' name='default_setting_enabled'>\n";
echo " <option value='true' ".($default_setting_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($default_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='default_setting_enabled' name='default_setting_enabled'>\n";
echo " <option value='true' ".($default_setting_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($default_setting_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-enabled']."\n";

View File

@@ -548,7 +548,12 @@
echo " ".$text['option-'.$row['default_setting_value']]."\n";
}
else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') {
echo " ".$text['option-'.$row['default_setting_value']]."\n";
if ($row['default_setting_value'] == 'select') {
echo " ".$text['option-select_box']."\n";
}
else {
echo " ".$text['option-'.$row['default_setting_value']]."\n";
}
}
else if (substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['default_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['default_setting_value'], -0.18)).'; padding: -1px;'));

View File

@@ -216,32 +216,32 @@ $text['message-delete_failed']['zh-cn'] = "未检查设置";
$text['message-delete_failed']['ja-jp'] = "設定はチェックされていません";
$text['message-delete_failed']['ko-kr'] = "선택한 설정 없음";
$text['option-select']['en-us'] = "Select";
$text['option-select']['en-gb'] = "Select";
$text['option-select']['ar-eg'] = "يختار";
$text['option-select']['de-at'] = "Auswählen";
$text['option-select']['de-ch'] = "Auswählen";
$text['option-select']['de-de'] = "Auswählen";
$text['option-select']['el-gr'] = "Επιλέξτε";
$text['option-select']['es-cl'] = "Seleccionar";
$text['option-select']['es-mx'] = "Seleccionar";
$text['option-select']['fr-ca'] = "Sélectionner";
$text['option-select']['fr-fr'] = "Sélectionner";
$text['option-select']['he-il'] = "בחר";
$text['option-select']['it-it'] = "Selezionare";
$text['option-select']['ka-ge'] = "აირჩიეთ";
$text['option-select']['nl-nl'] = "Selecteer";
$text['option-select']['pl-pl'] = "Wybierz";
$text['option-select']['pt-br'] = "Selecionar";
$text['option-select']['pt-pt'] = "Selecionar";
$text['option-select']['ro-ro'] = "Selectați";
$text['option-select']['ru-ru'] = "Выбрать";
$text['option-select']['sv-se'] = "Välj";
$text['option-select']['uk-ua'] = "Виберіть";
$text['option-select']['tr-tr'] = "Seçme";
$text['option-select']['zh-cn'] = "选择";
$text['option-select']['ja-jp'] = "選択する";
$text['option-select']['ko-kr'] = "선택하다";
$text['option-select_box']['en-us'] = "Select Box";
$text['option-select_box']['en-gb'] = "Select Box";
$text['option-select_box']['ar-eg'] = "حدد المربع";
$text['option-select_box']['de-at'] = "Auswahlfeld";
$text['option-select_box']['de-ch'] = "Auswahlfeld";
$text['option-select_box']['de-de'] = "Auswahlfeld";
$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου";
$text['option-select_box']['es-cl'] = "Cuadro de selección";
$text['option-select_box']['es-mx'] = "Cuadro de selección";
$text['option-select_box']['fr-ca'] = "Boîte de sélection";
$text['option-select_box']['fr-fr'] = "Boîte de sélection";
$text['option-select_box']['he-il'] = "בחר תיבה";
$text['option-select_box']['it-it'] = "Seleziona casella";
$text['option-select_box']['ka-ge'] = "აირჩიეთ ველი";
$text['option-select_box']['nl-nl'] = "Selecteer vak";
$text['option-select_box']['pl-pl'] = "Wybierz pole";
$text['option-select_box']['pt-br'] = "Caixa de seleção";
$text['option-select_box']['pt-pt'] = "Caixa de seleção";
$text['option-select_box']['ro-ro'] = "Selectați caseta";
$text['option-select_box']['ru-ru'] = "Выбрать поле";
$text['option-select_box']['sv-se'] = "Välj ruta";
$text['option-select_box']['uk-ua'] = "Виберіть поле";
$text['option-select_box']['tr-tr'] = "Seçim Kutusu";
$text['option-select_box']['zh-cn'] = "选择";
$text['option-select_box']['ja-jp'] = "選択ボックス";
$text['option-select_box']['ko-kr'] = "선택 상자";
$text['option-switch_round']['en-us'] = "Round Switch";
$text['option-switch_round']['en-gb'] = "Round Switch";

View File

@@ -84,7 +84,7 @@
$domain_setting_name = strtolower($_POST["domain_setting_name"]);
$domain_setting_value = $_POST["domain_setting_value"];
$domain_setting_order = $_POST["domain_setting_order"];
$domain_setting_enabled = strtolower($_POST["domain_setting_enabled"] ?? 'false');
$domain_setting_enabled = $_POST["domain_setting_enabled"];
$domain_setting_description = $_POST["domain_setting_description"];
}
@@ -116,7 +116,6 @@
if (empty($domain_setting_name)) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (empty($domain_setting_value)) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
if (empty($domain_setting_order)) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
if (empty($domain_setting_enabled)) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (empty($domain_setting_description)) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -330,7 +329,15 @@
//pre-populate the form
if (empty($_POST["persistformvar"]) && !empty($_GET["id"]) && is_uuid($_GET["id"])) {
$domain_setting_uuid = $_GET["id"];
$sql = "select domain_setting_uuid, domain_setting_category, domain_setting_subcategory, domain_setting_name, domain_setting_value, domain_setting_order, cast(domain_setting_enabled as text), domain_setting_description ";
$sql = "select ";
$sql .= "domain_setting_uuid, ";
$sql .= "domain_setting_category, ";
$sql .= "domain_setting_subcategory, ";
$sql .= "domain_setting_name, ";
$sql .= "domain_setting_value, ";
$sql .= "domain_setting_order, ";
$sql .= "domain_setting_enabled, ";
$sql .= "domain_setting_description ";
$sql .= "from v_domain_settings ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and domain_setting_uuid = :domain_setting_uuid ";
@@ -355,7 +362,6 @@
$domain_setting_name = $domain_setting_name ?? '';
$domain_setting_value = $domain_setting_value ?? '';
$domain_setting_order = $domain_setting_order ?? '';
$domain_setting_enabled = $domain_setting_enabled ?? 'true';
$domain_setting_description = $domain_setting_description ?? '';
//create token
@@ -718,7 +724,7 @@
}
elseif ($category == "theme" && $subcategory == "input_toggle_style" && $name == "text" ) {
echo " <select class='formfld' id='domain_setting_value' name='domain_setting_value'>\n";
echo " <option value='select'>".$text['option-select']."</option>\n";
echo " <option value='select'>".$text['option-select_box']."</option>\n";
echo " <option value='switch_round' ".(($row['domain_setting_value'] == "switch_round") ? "selected='selected'" : null).">".$text['option-switch_round']."</option>\n";
echo " <option value='switch_square' ".(($row['domain_setting_value'] == "switch_square") ? "selected='selected'" : null).">".$text['option-switch_square']."</option>\n";
echo " </select>\n";
@@ -830,17 +836,16 @@
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='domain_setting_enabled' name='domain_setting_enabled' value='true' ".($domain_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='domain_setting_enabled' name='domain_setting_enabled'>\n";
echo " <option value='true' ".($domain_setting_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($domain_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='domain_setting_enabled' name='domain_setting_enabled'>\n";
echo " <option value='true' ".($domain_setting_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($domain_setting_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-setting_enabled']."\n";

View File

@@ -339,7 +339,12 @@
echo " ".$text['option-'.$row['domain_setting_value']]."\n";
}
else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') {
echo " ".$text['option-'.$row['domain_setting_value']]."\n";
if ($row['domain_setting_value'] == 'select') {
echo " ".$text['option-select_box']."\n";
}
else {
echo " ".$text['option-'.$row['domain_setting_value']]."\n";
}
}
else if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['domain_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['domain_setting_value'], -0.18)).'; padding: -1px;'));

View File

@@ -28,7 +28,7 @@
if ($domains_processed == 1) {
//set domain enable to true
$sql = "update v_domains set domain_enabled = 'true' ";
$sql = "update v_domains set domain_enabled = true ";
$sql .= "where domain_enabled is null ";
$database->execute($sql, null);
unset($sql);

View File

@@ -38,9 +38,6 @@
exit;
}
//connect to the database
$database = new database;
//add multi-lingual support
$language = new text;
$text = $language->get();
@@ -50,7 +47,7 @@
$domain_description = '';
//action add or update
if (!permission_exists('domain_add') || (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/") && !permission_exists('domain_all'))) {
if (!permission_exists('domain_add') || (file_exists(dirname(__DIR__, 2)."/app/domains/") && !permission_exists('domain_all'))) {
//admin editing own domain/settings
$domain_uuid = $_SESSION['domain_uuid'];
$action = "update";
@@ -68,7 +65,7 @@
//get http post variables and set them to php variables
if (!empty($_POST)) {
$domain_name = strtolower($_POST["domain_name"]);
$domain_enabled = $_POST["domain_enabled"] ?? 'false';
$domain_enabled = $_POST["domain_enabled"];
$domain_description = $_POST["domain_description"];
}
@@ -133,8 +130,7 @@
if ($num_rows == 0) {
//add the domain name
$domain_enabled = 'true';
//add the domain uuid
$domain_uuid = uuid();
//build the domain array
@@ -152,7 +148,7 @@
$database->save($array);
//add dialplans to the domain
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) {
//import the dialplans
$dialplan = new dialplan;
$dialplan->import($domain_array['domains']);
@@ -209,7 +205,7 @@
$database->save($array);
//add dialplans to the domain
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) {
//import the dialplans
$dialplan = new dialplan;
$dialplan->import($array['domains'] ?? null);
@@ -227,7 +223,7 @@
if ($original_domain_name != $domain_name) {
//update dialplans
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_config.php")) {
$sql = "update v_dialplans set ";
$sql .= "dialplan_context = replace(dialplan_context, :domain_name_old, :domain_name_new), ";
$sql .= "dialplan_xml = replace(dialplan_xml, :domain_name_old, :domain_name_new) ";
@@ -249,7 +245,7 @@
}
//update destinations
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/destinations/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/destinations/app_config.php")) {
$sql = "update v_destinations set ";
$sql .= "destination_data = replace(destination_data, :destination_data_old, :destination_data_new), ";
$sql .= "destination_conditions = replace(destination_conditions::text, :destination_data_old, :destination_data_new)::json, ";
@@ -263,7 +259,7 @@
}
//update extensions (accountcode, user_context, dial_domain)
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/extensions/app_config.php")) {
$sql = "update v_extensions set ";
$sql .= "user_context = replace(user_context, :domain_name_old, :domain_name_new), ";
$sql .= "accountcode = replace(accountcode, :domain_name_old, :domain_name_new), ";
@@ -277,7 +273,7 @@
}
//update ivr_menus (ivr_menu_context, ivr_menu_greet_long, ivr_menu_greet_short) and ivr_menu_options (ivr_menu_option_param)
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menus/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/ivr_menus/app_config.php")) {
$sql = "update v_ivr_menus set ";
$sql .= "ivr_menu_context = replace(ivr_menu_context, :domain_name_old, :domain_name_new), ";
$sql .= "ivr_menu_greet_long = replace(ivr_menu_greet_long, :domain_name_old, :domain_name_new), ";
@@ -300,7 +296,7 @@
}
//update ring_groups (ring_group_context, ring_group_forward_destination, ring_group_timeout_data)
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/ring_groups/app_config.php")) {
$sql = "update v_ring_groups set ";
$sql .= "ring_group_context = replace(ring_group_context, :domain_name_old, :domain_name_new), ";
$sql .= "ring_group_forward_destination = replace(ring_group_forward_destination, :domain_name_old, :domain_name_new), ";
@@ -314,7 +310,7 @@
}
//update cdr records (domain_name, context)
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/xml_cdr/app_config.php")){
if (file_exists(dirname(__DIR__, 2)."/app/xml_cdr/app_config.php")){
$sql = "update v_xml_cdr set ";
$sql .= "domain_name = :domain_name_new ";
$sql .= "where domain_name = :domain_name_old ";
@@ -337,7 +333,7 @@
}
//update conference session recording paths
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/conference_centers/app_config.php")) {
$sql = "update v_conference_sessions set ";
$sql .= "recording = replace(recording, :domain_name_old, :domain_name_new) ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -349,7 +345,7 @@
}
//update conference center greetings
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/conference_centers/app_config.php")) {
$sql = "update v_conference_centers set ";
$sql .= "conference_center_greeting = replace(conference_center_greeting, :domain_name_old, :domain_name_new) ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -361,7 +357,7 @@
}
//update call center queue record templates
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) {
$sql = "update v_call_center_queues set ";
$sql .= "queue_record_template = replace(queue_record_template, :domain_name_old, :domain_name_new) ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -373,7 +369,7 @@
}
//update call center agent contacts
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) {
$sql = "update v_call_center_agents set ";
$sql .= "agent_contact = replace(agent_contact, :domain_name_old, :domain_name_new) ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -385,7 +381,7 @@
}
//update call flows data, alternate-data and contexts
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_flows/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/call_flows/app_config.php")) {
$sql = "update v_call_flows set ";
$sql .= "call_flow_data = replace(call_flow_data, :domain_name_old, :domain_name_new), ";
$sql .= "call_flow_alternate_data = replace(call_flow_alternate_data, :domain_name_old, :domain_name_new), ";
@@ -399,7 +395,7 @@
}
//update device lines server_address, server_address_primary, server_address_secondary, outbound_proxy_primary, outbound_proxy_secondary
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/devices/app_config.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/devices/app_config.php")) {
$sql = "update v_device_lines set ";
$sql .= "server_address = replace(server_address, :domain_name_old, :domain_name_new), ";
$sql .= "server_address_primary = replace(server_address_primary, :domain_name_old, :domain_name_new), ";
@@ -528,7 +524,7 @@
$sql = "select ";
$sql .= "domain_uuid, ";
$sql .= "domain_name, ";
$sql .= "cast(domain_enabled as text), ";
$sql .= "domain_enabled, ";
$sql .= "domain_description ";
$sql .= "from v_domains ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -542,9 +538,6 @@
unset($sql, $parameters, $row);
}
//set the defaults
if (empty($domain_enabled)) { $domain_enabled = 'true'; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -669,17 +662,16 @@
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='domain_enabled' name='domain_enabled' value='true' ".($domain_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='domain_enabled' name='domain_enabled'>\n";
echo " <option value='true' ".($domain_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($domain_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='domain_enabled' name='domain_enabled'>\n";
echo " <option value='true' ".($domain_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($domain_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-domain_enabled']."\n";

View File

@@ -66,7 +66,7 @@
$sql = "select * ";
$sql .= "from v_domains ";
$sql .= "where true ";
$sql .= "and domain_enabled = 'true' \n";
$sql .= "and domain_enabled = true \n";
if (isset($search)) {
$sql .= " and ( ";
$sql .= " lower(domain_name) like :search ";

View File

@@ -26,7 +26,7 @@
//get the domain count for enabled domains
$sql = "select count(*) as count from v_domains ";
$sql .= "where domain_enabled = 'true'; ";
$sql .= "where domain_enabled = true; ";
$row = $database->select($sql, null, 'row');
$domain_count = $row['count'];
unset($sql, $row);

View File

@@ -84,7 +84,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Set the type as html or text.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'boolean';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Set the status of the template.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'template_description';

View File

@@ -45,7 +45,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -61,7 +61,7 @@
$array['email_templates'][$x]['template_body'] .= "Lä nge \${message_duration}\n";
$array['email_templates'][$x]['template_body'] .= "Nachricht \${message}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -81,7 +81,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -97,7 +97,7 @@
$array['email_templates'][$x]['template_body'] .= "Lä nge \${message_duration}\n";
$array['email_templates'][$x]['template_body'] .= "Nachricht \${message}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -112,7 +112,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -132,7 +132,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -148,7 +148,7 @@
$array['email_templates'][$x]['template_body'] .= "Length \${message_duration}\n";
$array['email_templates'][$x]['template_body'] .= "Message \${message}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -171,7 +171,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -190,7 +190,7 @@
$array['email_templates'][$x]['template_body'] .= "Transcription\n";
$array['email_templates'][$x]['template_body'] .= "\${message_text}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -210,7 +210,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -226,7 +226,7 @@
$array['email_templates'][$x]['template_body'] .= "Length \${message_duration}\n";
$array['email_templates'][$x]['template_body'] .= "Message \${message}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -249,7 +249,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -268,7 +268,7 @@
$array['email_templates'][$x]['template_body'] .= "Transcription\n";
$array['email_templates'][$x]['template_body'] .= "\${message_text}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -283,7 +283,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -294,7 +294,7 @@
$array['email_templates'][$x]['template_subject'] = 'Missed Call from ${caller_id_name} <${caller_id_number}>';
$array['email_templates'][$x]['template_body'] = "Missed Call from \${caller_id_name} &lt;\${caller_id_number}&gt; to \${sip_to_user} ext \${dialed_user}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -309,7 +309,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -320,7 +320,7 @@
$array['email_templates'][$x]['template_subject'] = 'Missed Call from ${caller_id_name} <${caller_id_number}>';
$array['email_templates'][$x]['template_body'] = "Missed Call from \${caller_id_name} &lt;\${caller_id_number}&gt; to \${sip_to_user} ext \${dialed_user}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -340,7 +340,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -356,7 +356,7 @@
$array['email_templates'][$x]['template_body'] .= "Longueur \${message_duration}\n";
$array['email_templates'][$x]['template_body'] .= "Message \${message}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -371,7 +371,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -382,7 +382,7 @@
$array['email_templates'][$x]['template_subject'] = 'Appel manqué de ${caller_id_name} <${caller_id_number}>';
$array['email_templates'][$x]['template_body'] = "Appel manqué de \${caller_id_name} &lt;\${caller_id_number}&gt; À \${sip_to_user} ext \${dialed_user}\n";
$array['email_templates'][$x]['template_type'] = 'text';
$array['email_templates'][$x]['template_enabled'] = 'false';
$array['email_templates'][$x]['template_enabled'] = false;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -397,7 +397,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -412,7 +412,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -427,7 +427,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -442,7 +442,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -457,7 +457,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -472,7 +472,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -487,7 +487,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -502,7 +502,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -522,7 +522,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -542,7 +542,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = '';
$x++;
@@ -560,7 +560,7 @@
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = 'Message sent by the Email Test feature found at the top of the Email Queue app.';
//build array of email template uuids

View File

@@ -54,7 +54,7 @@
$template_subject = '';
$template_body = '';
$template_type = '';
$template_enabled = '';
$template_enabled = false;
$template_description = '';
//get http post variables and set them to php variables
@@ -66,7 +66,7 @@
$template_subject = $_POST["template_subject"];
$template_body = $_POST["template_body"];
$template_type = $_POST["template_type"];
$template_enabled = $_POST["template_enabled"] ?? 'false';
$template_enabled = $_POST["template_enabled"] ?? false;
$template_description = $_POST["template_description"];
}
@@ -95,7 +95,6 @@
if (empty($template_body)) { $msg .= $text['message-required']." ".$text['label-template_body']."<br>\n"; }
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (empty($template_type)) { $msg .= $text['message-required']." ".$text['label-template_type']."<br>\n"; }
if (empty($template_enabled)) { $msg .= $text['message-required']." ".$text['label-template_enabled']."<br>\n"; }
//if (empty($template_description)) { $msg .= $text['message-required']." ".$text['label-template_description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -128,7 +127,6 @@
$array['email_templates'][0]['template_description'] = $template_description;
//save to the data
$database = new database;
$database->app_name = 'email_templates';
$database->app_uuid = '8173e738-2523-46d5-8943-13883befd2fd';
if (!empty($email_template_uuid)) {
@@ -153,12 +151,22 @@
//pre-populate the form
if (count($_GET)>0 && empty($_POST["persistformvar"])) {
$email_template_uuid = $_GET["id"];
$sql = "select * from v_email_templates ";
$sql = "select ";
$sql .= "email_template_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "template_language, ";
$sql .= "template_category, ";
$sql .= "template_subcategory, ";
$sql .= "template_subject, ";
$sql .= "template_body, ";
$sql .= "template_type, ";
$sql .= "template_enabled, ";
$sql .= "template_description ";
$sql .= "from v_email_templates ";
$sql .= "where email_template_uuid = :email_template_uuid ";
//$sql .= "and domain_uuid = :domain_uuid ";
$parameters['email_template_uuid'] = $email_template_uuid;
//$parameters['domain_uuid'] = $domain_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (!empty($row)) {
$domain_uuid = $row["domain_uuid"];
@@ -174,9 +182,6 @@
unset($sql, $parameters, $row);
}
//set the defaults
if (empty($template_enabled)) { $template_enabled = 'true'; }
//load editor preferences/defaults
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
@@ -425,17 +430,16 @@
echo " ".$text['label-template_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='template_enabled' name='template_enabled' value='true' ".($template_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='template_enabled' name='template_enabled'>\n";
echo " <option value='true' ".($template_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($template_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='template_enabled' name='template_enabled'>\n";
echo " <option value='true' ".($template_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($template_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-template_enabled']."\n";

View File

@@ -100,14 +100,15 @@
$sql_search .= " or lower(template_subject) like :search ";
$sql_search .= " or lower(template_body) like :search ";
$sql_search .= " or lower(template_type) like :search ";
$sql_search .= " or lower(template_enabled) like :search ";
$sql_search .= " or lower(template_description) like :search ";
$sql_search .= ") ";
$parameters['search'] = '%'.$search.'%';
}
//prepare to page the results
$sql = "select count(*) from v_email_templates where true ";
$sql = "select count(*) ";
$sql .= "from v_email_templates ";
$sql .= "where true ";
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('email_template_all')) {
if (!empty($sql_search)) {
$sql .= "and ".$sql_search;
@@ -121,7 +122,6 @@
$parameters['domain_uuid'] = $domain_uuid;
}
$sql .= $sql_category ?? '';
$database = new database;
$num_rows = $database->select($sql, $parameters ?? '', 'column');
//prepare to page the results
@@ -136,7 +136,32 @@
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql = "select ";
$sql .= "email_template_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "template_language, ";
$sql .= "template_category, ";
$sql .= "template_subcategory, ";
$sql .= "template_subject, ";
$sql .= "template_body, ";
$sql .= "template_type, ";
$sql .= "cast(template_enabled as text), ";
$sql .= "template_description ";
$sql .= "from v_email_templates ";
$sql .= "where true ";
if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('email_template_all')) {
if (!empty($sql_search)) {
$sql .= "and ".$sql_search;
}
}
else {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
if (!empty($sql_search)) {
$sql .= "and ".$sql_search;
}
$parameters['domain_uuid'] = $domain_uuid;
}
$sql .= $sql_category ?? '';
if ($order_by) {
$sql .= order_by($order_by, $order);
}
@@ -144,14 +169,12 @@
$sql .= "order by domain_uuid, template_language asc, template_category asc, template_subcategory asc, template_type asc, template_description asc ";
}
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$result = $database->select($sql, $parameters ?? '', 'all');
unset($sql, $parameters);
//get email template categories
$sql = "select distinct template_category from v_email_templates ";
$sql .= "order by template_category asc ";
$database = new database;
$rows = $database->select($sql, $parameters ?? '', 'all');
if (!empty($rows)) {
foreach ($rows as $row) {
@@ -327,4 +350,3 @@
require_once "resources/footer.php";
?>

View File

@@ -113,7 +113,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "group_protected";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "group_level";

View File

@@ -66,7 +66,7 @@
$group_name_previous = $_POST["group_name_previous"];
$domain_uuid = $_POST["domain_uuid"];
$group_level = $_POST["group_level"] ?? '10';
$group_protected = $_POST["group_protected"] ?? 'false';
$group_protected = $_POST["group_protected"] ?? false;
$group_description = $_POST["group_description"] ?? '';
}
@@ -110,7 +110,6 @@
if (empty($group_name)) { $msg .= $text['message-required']." ".$text['label-group_name']."<br>\n"; }
//if (empty($domain_uuid)) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (empty($group_level)) { $msg .= $text['message-required']." ".$text['label-group_level']."<br>\n"; }
//if (empty($group_protected)) { $msg .= $text['message-required']." ".$text['label-group_protected']."<br>\n"; }
//if (empty($group_description)) { $msg .= $text['message-required']." ".$text['label-group_description']."<br>\n"; }
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
@@ -300,17 +299,16 @@
echo " ".$text['label-group_protected']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' name='group_protected' value='true' ".(!empty($group_protected) && $group_protected == "true" ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' name='group_protected'>\n";
echo " <option value='false'>".$text['label-false']."</option>\n";
echo " <option value='true' ".(!empty($group_protected) && $group_protected == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='group_protected' name='group_protected'>\n";
echo " <option value='true' ".($group_protected === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($group_protected === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
//echo $text['description-group_protected']."\n";
@@ -340,4 +338,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -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) 2018-2024
Portions created by the Initial Developer are Copyright (C) 2018-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -119,7 +119,32 @@
$offset = $rows_per_page * $page;
//get the list
$sql = str_replace('count(*)', '*', $sql);
$sql = "select ";
$sql .= "group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "domain_name, ";
$sql .= "group_name, ";
$sql .= "group_permissions, ";
$sql .= "group_members, ";
$sql .= "cast(group_protected as text), ";
$sql .= "group_level, ";
$sql .= "group_description ";
$sql .= "from view_groups ";
$sql .= "where true \n";
if ($show == 'all' && permission_exists('group_all')) {
$sql .= "and (domain_uuid is not null or domain_uuid is null) ";
}
else {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $domain_uuid;
}
if (!empty($search)) {
$sql .= "and ( \n";
$sql .= " lower(group_name) like :search \n";
$sql .= " or lower(group_description) like :search \n";
$sql .= ") \n";
$parameters['search'] = '%'.$search.'%';
}
$sql .= order_by($order_by, $order, 'group_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$groups = $database->select($sql, $parameters ?? '', 'all');

View File

@@ -63,7 +63,7 @@
$sql .= "where group_name in ( ";
$sql .= " select group_name ";
$sql .= " from v_groups ";
$sql .= " where group_protected <> 'true' ";
$sql .= " where group_protected <> true ";
$sql .= " and group_name in (".$group_names.") ";
$sql .= ")";
$sql .= "and (permission_protected <> 'true' or permission_protected is null)";
@@ -76,7 +76,7 @@
$sql .= "where group_name in ( ";
$sql .= " select group_name ";
$sql .= " from v_groups ";
$sql .= " where group_protected <> 'true' ";
$sql .= " where group_protected <> true ";
$sql .= " and group_name in (".$group_names.") ";
$sql .= ");";
$database = new database;
@@ -145,12 +145,12 @@
foreach ($permission['groups'] as $group_name) {
//check group protection
$group_uuid = null;
$group_protected = null;
$group_protected = false;
if (is_array($groups)) {
foreach ($groups as $group) {
if ($group['group_name'] == $group_name) {
$group_uuid = $group['group_uuid'];
$group_protected = $group['group_protected'] == 'true' ? true : false;
$group_protected = $group['group_protected'];
break;
}
}

View File

@@ -0,0 +1,11 @@
<?php
$view['name'] = "view_groups";
$view['version'] = "20250919.1";
$view['description'] = "Show the groups with the domain_name, permission count and member count.";
$view['sql'] = " select domain_uuid, group_uuid, group_name, ";
$view['sql'] .= " (select domain_name from v_domains where domain_uuid = g.domain_uuid) as domain_name, ";
$view['sql'] .= " (select count(*) from v_group_permissions where group_uuid = g.group_uuid) as group_permissions, ";
$view['sql'] .= " (select count(*) from v_user_groups where group_uuid = g.group_uuid) as group_members, ";
$view['sql'] .= " group_level, group_protected, group_description ";
$view['sql'] .= " from v_groups as g ";

View File

@@ -202,7 +202,7 @@
$domain_exists = true;
}
//if the domain name does not exist then add the domain name
//if the domain name does not exist, then add the domain name
if (!$domain_exists) {
//add the domain permission
$p = permissions::new();
@@ -226,7 +226,7 @@
$p->delete("domain_add", "temp");
}
//set the session domain id and name
//set the session domain ID and name
$_SESSION['domain_uuid'] = $domain_uuid;
$_SESSION['domain_name'] = $domain_name;

View File

@@ -104,9 +104,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "user_setting_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false'];
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;

View File

@@ -568,32 +568,32 @@ $text['login-message_attention']['zh-cn'] = "注意力!";
$text['login-message_attention']['ja-jp'] = "注意!";
$text['login-message_attention']['ko-kr'] = "주목!";
$text['option-select']['en-us'] = "Select";
$text['option-select']['en-gb'] = "Select";
$text['option-select']['ar-eg'] = "مختارة";
$text['option-select']['de-at'] = "Auswählen";
$text['option-select']['de-ch'] = "Auswählen";
$text['option-select']['de-de'] = "Auswählen";
$text['option-select']['el-gr'] = "Επιλέξτε";
$text['option-select']['es-cl'] = "Seleccionar";
$text['option-select']['es-mx'] = "Seleccionar";
$text['option-select']['fr-ca'] = "Sélectionner";
$text['option-select']['fr-fr'] = "Sélectionner";
$text['option-select']['he-il'] = "בחר";
$text['option-select']['it-it'] = "Selezionare";
$text['option-select']['ka-ge'] = "არჩევა";
$text['option-select']['nl-nl'] = "selectie";
$text['option-select']['pl-pl'] = "Wybierz";
$text['option-select']['pt-br'] = "Selecionar";
$text['option-select']['pt-pt'] = "Selecionar";
$text['option-select']['ro-ro'] = "Selectați";
$text['option-select']['ru-ru'] = "Выбрать";
$text['option-select']['sv-se'] = "Välj";
$text['option-select']['uk-ua'] = "Зареєструватися";
$text['option-select']['tr-tr'] = "Seç";
$text['option-select']['zh-cn'] = "选择";
$text['option-select']['ja-jp'] = "選択する";
$text['option-select']['ko-kr'] = "선택하다";
$text['option-select_box']['en-us'] = "Select Box";
$text['option-select_box']['en-gb'] = "Select Box";
$text['option-select_box']['ar-eg'] = "حدد المربع";
$text['option-select_box']['de-at'] = "Auswahlfeld";
$text['option-select_box']['de-ch'] = "Auswahlfeld";
$text['option-select_box']['de-de'] = "Auswahlfeld";
$text['option-select_box']['el-gr'] = "Επιλογή πλαισίου";
$text['option-select_box']['es-cl'] = "Cuadro de selección";
$text['option-select_box']['es-mx'] = "Cuadro de selección";
$text['option-select_box']['fr-ca'] = "Boîte de sélection";
$text['option-select_box']['fr-fr'] = "Boîte de sélection";
$text['option-select_box']['he-il'] = "בחר תיבה";
$text['option-select_box']['it-it'] = "Seleziona casella";
$text['option-select_box']['ka-ge'] = "რჩიეთ ველი";
$text['option-select_box']['nl-nl'] = "Selecteer vak";
$text['option-select_box']['pl-pl'] = "Wybierz pole";
$text['option-select_box']['pt-br'] = "Caixa de seleção";
$text['option-select_box']['pt-pt'] = "Caixa de seleção";
$text['option-select_box']['ro-ro'] = "Selectați caseta";
$text['option-select_box']['ru-ru'] = "Выбрать поле";
$text['option-select_box']['sv-se'] = "Välj ruta";
$text['option-select_box']['uk-ua'] = "Виберіть поле";
$text['option-select_box']['tr-tr'] = "Seçim Kutusu";
$text['option-select_box']['zh-cn'] = "选择";
$text['option-select_box']['ja-jp'] = "選択ボックス";
$text['option-select_box']['ko-kr'] = "선택 상자";
$text['option-switch_round']['en-us'] = "Round Switch";
$text['option-switch_round']['en-gb'] = "Round Switch";

View File

@@ -84,7 +84,7 @@
$user_setting_name = strtolower($_POST["user_setting_name"] ?? '');
$user_setting_value = $_POST["user_setting_value"] ?? '';
$user_setting_order = $_POST["user_setting_order"] ?? '';
$user_setting_enabled = strtolower($_POST["user_setting_enabled"] ?? 'false');
$user_setting_enabled = $_POST["user_setting_enabled"];
$user_setting_description = $_POST["user_setting_description"] ?? '';
}
@@ -316,7 +316,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
//pre-populate the form
if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) {
$user_setting_uuid = $_GET["id"];
$sql = "select user_setting_category, user_setting_subcategory, user_setting_name, user_setting_value, user_setting_order, cast(user_setting_enabled as text), user_setting_description ";
$sql = "select user_setting_category, user_setting_subcategory, user_setting_name, user_setting_value, user_setting_order, user_setting_enabled, user_setting_description ";
$sql .= "from v_user_settings ";
$sql .= "where user_setting_uuid = :user_setting_uuid ";
$sql .= "and user_uuid = :user_uuid ";
@@ -593,8 +593,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
}
else if ($user_setting_category == "theme" && $user_setting_subcategory == "domain_visible" && $user_setting_name == "text" ) {
echo " <select class='formfld' id='user_setting_value' name='user_setting_value'>\n";
echo " <option value='false' ".(($user_setting_value == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " <option value='true' ".(($user_setting_value == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".(($user_setting_value == 'false') ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " <option value='true' ".(($user_setting_value == 'true') ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " </select>\n";
}
else if ($user_setting_category == "theme" && $user_setting_subcategory == "menu_brand_type" && $user_setting_name == "text" ) {
@@ -660,7 +660,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
}
elseif ($user_setting_category == "theme" && $user_setting_subcategory == "input_toggle_style" && $user_setting_name == "text" ) {
echo " <select class='formfld' id='user_setting_value' name='user_setting_value'>\n";
echo " <option value='select'>".$text['option-select']."</option>\n";
echo " <option value='select'>".$text['option-select_box']."</option>\n";
echo " <option value='switch_round' ".(($user_setting_value == "switch_round") ? "selected='selected'" : null).">".$text['option-switch_round']."</option>\n";
echo " <option value='switch_square' ".(($user_setting_value == "switch_square") ? "selected='selected'" : null).">".$text['option-switch_square']."</option>\n";
echo " </select>\n";
@@ -695,7 +695,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
echo " <option value='true' ".((strtolower($user_setting_value) == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='true' ".((strtolower($user_setting_value) == 'true') ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
}
echo " </select>\n";
}
@@ -752,20 +752,18 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='user_setting_enabled' name='user_setting_enabled' value='true' ".($user_setting_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='user_setting_enabled' name='user_setting_enabled'>\n";
echo " <option value='true' ".($user_setting_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($user_setting_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='user_setting_enabled' name='user_setting_enabled'>\n";
echo " <option value='true' ".($user_setting_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($user_setting_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
//echo $text['description-setting_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";

View File

@@ -336,7 +336,12 @@
echo " ".$text['option-'.$row['user_setting_value']]."\n";
}
else if ($category == 'theme' && $subcategory == 'input_toggle_style' && $name == 'text') {
echo " ".$text['option-'.$row['user_setting_value']]."\n";
if ($row['user_setting_value'] == 'select') {
echo " ".$text['option-select_box']."\n";
}
else {
echo " ".$text['option-'.$row['user_setting_value']]."\n";
}
}
else if ($category == "theme" && substr_count($subcategory, "_color") > 0 && ($name == "text" || $name == 'array')) {
echo " ".(img_spacer('15px', '15px', 'background: '.escape($row['user_setting_value']).'; margin-right: 4px; vertical-align: middle; border: 1px solid '.(color_adjust($row['user_setting_value'], -0.18)).'; padding: -1px;'));

View File

@@ -273,7 +273,7 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "user_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "boolean";
$apps[$x]['db'][$y]['fields'][$z]['toggle'] = ['true','false'];
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;

View File

@@ -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-2023
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -110,7 +110,7 @@ if ($domains_processed == 1) {
$sql .= " from v_users as u, v_contact_emails as e ";
$sql .= " where u.contact_uuid is not null ";
$sql .= " and u.contact_uuid = e.contact_uuid ";
$sql .= " and e.email_primary = 1 ";
$sql .= " and e.email_primary = true ";
$sql .= ") ";
$sql .= "update v_users ";
$sql .= "set user_email = users.email_address ";
@@ -195,7 +195,7 @@ if ($domains_processed == 1) {
$array['email_templates'][$x]['template_body'] .= "</body>\n";
$array['email_templates'][$x]['template_body'] .= "</html>\n";
$array['email_templates'][$x]['template_type'] = 'html';
$array['email_templates'][$x]['template_enabled'] = 'true';
$array['email_templates'][$x]['template_enabled'] = true;
$array['email_templates'][$x]['template_description'] = 'Default password reset email template.';
$x++;

View File

@@ -0,0 +1,40 @@
<?php
$view['name'] = "view_users";
$view['version'] = "20250919";
$view['description'] = "Show the users with the domain name, and contact details";
$view['sql'] = " select u.domain_uuid, u.user_uuid, d.domain_name, u.username, u.user_status, u.user_enabled, u.add_date, \n";
$view['sql'] .= " c.contact_uuid, c.contact_organization, c.contact_name_given ||' '|| c.contact_name_family as contact_name, c.contact_name_given, c.contact_name_family, c.contact_note, \n";
$view['sql'] .= " ( \n";
$view['sql'] .= " select \n";
$view['sql'] .= " string_agg(g.group_name, ', ') \n";
$view['sql'] .= " from \n";
$view['sql'] .= " v_user_groups as ug, \n";
$view['sql'] .= " v_groups as g \n";
$view['sql'] .= " where \n";
$view['sql'] .= " ug.group_uuid = g.group_uuid \n";
$view['sql'] .= " and u.user_uuid = ug.user_uuid \n";
$view['sql'] .= " ) AS group_names, \n";
$view['sql'] .= " ( \n";
$view['sql'] .= " select \n";
$view['sql'] .= " string_agg(g.group_uuid::text, ', ') \n";
$view['sql'] .= " from \n";
$view['sql'] .= " v_user_groups as ug, \n";
$view['sql'] .= " v_groups as g \n";
$view['sql'] .= " where \n";
$view['sql'] .= " ug.group_uuid = g.group_uuid \n";
$view['sql'] .= " and u.user_uuid = ug.user_uuid \n";
$view['sql'] .= " ) AS group_uuids, \n";
$view['sql'] .= " ( \n";
$view['sql'] .= " SELECT group_level \n";
$view['sql'] .= " FROM v_user_groups ug, v_groups g \n";
$view['sql'] .= " WHERE (ug.group_uuid = g.group_uuid) \n";
$view['sql'] .= " AND (u.user_uuid = ug.user_uuid) \n";
$view['sql'] .= " ORDER BY group_level DESC \n";
$view['sql'] .= " LIMIT 1 \n";
$view['sql'] .= " ) AS group_level \n";
$view['sql'] .= " from v_contacts as c \n";
$view['sql'] .= " right join v_users u on u.contact_uuid = c.contact_uuid \n";
$view['sql'] .= " inner join v_domains as d on d.domain_uuid = u.domain_uuid \n";
$view['sql'] .= " where 1 = 1 \n";
$view['sql'] .= " order by u.username asc \n";

View File

@@ -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-2024
Portions created by the Initial Developer are Copyright (C) 2008-2025
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -138,7 +138,7 @@
}
$group_uuid_name = $_POST["group_uuid_name"];
$user_type = $_POST["user_type"];
$user_enabled = $_POST["user_enabled"] ?? 'false';
$user_enabled = $_POST["user_enabled"];
if (permission_exists('api_key')) {
$api_key = $_POST["api_key"];
}
@@ -619,7 +619,7 @@
//populate the form with values from db
if ($action == 'edit') {
$sql = "select domain_uuid, user_uuid, username, user_email, api_key, user_totp_secret, ";
$sql .= "user_type, user_enabled, contact_uuid, cast(user_enabled as text), user_status ";
$sql .= "user_type, contact_uuid, user_enabled, user_status ";
$sql .= "from v_users ";
$sql .= "where user_uuid = :user_uuid ";
if (!permission_exists('user_all')) {
@@ -652,7 +652,7 @@
//get user settings
$sql = "select * from v_user_settings ";
$sql .= "where user_uuid = :user_uuid ";
$sql .= "and user_setting_enabled = 'true' ";
$sql .= "and user_setting_enabled = true ";
$parameters['user_uuid'] = $user_uuid;
$result = $database->select($sql, $parameters, 'all');
if (is_array($result)) {
@@ -674,7 +674,6 @@
}
//set the defaults
if (empty($user_enabled)) { $user_enabled = "true"; }
if (empty($user_totp_secret)) { $user_totp_secret = ""; }
//create token
@@ -1210,17 +1209,16 @@
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='user_enabled' name='user_enabled' value='true' ".($user_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
if ($input_toggle_style_switch) {
echo " <span class='switch'>\n";
}
else {
echo " <select class='formfld' id='user_enabled' name='user_enabled'>\n";
echo " <option value='true' ".($user_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($user_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo " <select class='formfld' id='user_enabled' name='user_enabled'>\n";
echo " <option value='true' ".($user_enabled === true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($user_enabled === false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
if ($input_toggle_style_switch) {
echo " <span class='slider'></span>\n";
echo " </span>\n";
}
echo "<br />\n";
echo $text['description-enabled']."\n";