Skip to content

Commit

Permalink
Set default for enabled (#6556)
Browse files Browse the repository at this point in the history
* Set default for enabled

* Update conference_profile_edit.php

* Update call_block_edit.php

* Update conference_control_edit.php

* Update conference_control_detail_edit.php

* Update conference_profile_edit.php

* Update conference_profile_param_edit.php

* Update conference_edit.php

* Update destination_edit.php

* Update device_edit.php

* Update device_profile_edit.php

* Update device_vendor_edit.php

* Update email_template_edit.php

* Update extension_edit.php

* Update module_edit.php

* Update phrase_edit.php

* Update ring_group_edit.php

* Update sip_profile_edit.php

* Update stream_edit.php

* Update time_condition_edit.php

* Update var_edit.php

* Update voicemail_edit.php

* Update call_block_edit.php

* Update default_setting_edit.php

* Update domain_setting_edit.php

* Update domain_edit.php

* Update user_edit.php

* Update bridge_edit.php

* Update sip_profile_edit.php

* Update sofia_global_setting_edit.php

* Update call_flow_edit.php

* Update email_template_edit.php

* Update call_flow_edit.php

* Update bridge_edit.php

* Update email_template_edit.php

* Update sip_profile_edit.php

* Update sofia_global_setting_edit.php

* Update bridge_edit.php

* Update call_flow_edit.php

* Update conference_control_edit.php

* Update sip_profile_edit.php

* Update stream_edit.php

* Update default_setting_edit.php

* Update email_template_edit.php

* Update extension_setting_edit.php

* Update default_setting_edit.php

* Update dashboard_edit.php

* Update dashboard_edit.php

* Update default_setting_edit.php
  • Loading branch information
alexdcrane committed Feb 17, 2023
1 parent ef866e1 commit 7326cb8
Show file tree
Hide file tree
Showing 29 changed files with 124 additions and 42 deletions.
7 changes: 5 additions & 2 deletions app/bridges/bridge_edit.php
Expand Up @@ -50,11 +50,11 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {
$bridge_uuid = $_POST["bridge_uuid"];
$bridge_name = $_POST["bridge_name"];
$bridge_destination = $_POST["bridge_destination"];
$bridge_enabled = $_POST["bridge_enabled"];
$bridge_enabled = $_POST["bridge_enabled"] ?: 'false';
$bridge_description = $_POST["bridge_description"];
}

Expand Down Expand Up @@ -162,6 +162,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($bridge_enabled) == 0) { $bridge_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
3 changes: 3 additions & 0 deletions app/call_block/call_block_edit.php
Expand Up @@ -264,6 +264,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($call_block_enabled) == 0) { $call_block_enabled = 'true'; }

//get the extensions
if (permission_exists('call_block_all') || permission_exists('call_block_extension')) {
$sql = "select extension_uuid, extension, number_alias, user_context, description from v_extensions ";
Expand Down
7 changes: 5 additions & 2 deletions app/call_flows/call_flow_edit.php
Expand Up @@ -59,7 +59,7 @@
$destination = new destinations;

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {

//set the variables from the http values
$call_flow_uuid = $_POST["call_flow_uuid"];
Expand All @@ -76,7 +76,7 @@
$call_flow_alternate_sound = $_POST["call_flow_alternate_sound"];
$call_flow_alternate_destination = $_POST["call_flow_alternate_destination"];
$call_flow_context = $_POST["call_flow_context"];
$call_flow_enabled = $_POST["call_flow_enabled"];
$call_flow_enabled = $_POST["call_flow_enabled"] ?: 'false';
$call_flow_description = $_POST["call_flow_description"];

//seperate the action and the param
Expand Down Expand Up @@ -356,6 +356,9 @@
$call_flow_context = $_SESSION['domain_name'];
}

//set the defaults
if (strlen($call_flow_enabled) == 0) { $call_flow_enabled = 'true'; }

//get the recordings
$sql = "select recording_name, recording_filename from v_recordings ";
$sql .= "where domain_uuid = :domain_uuid ";
Expand Down
3 changes: 3 additions & 0 deletions app/conference_controls/conference_control_detail_edit.php
Expand Up @@ -130,6 +130,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($control_enabled) == 0) { $control_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
7 changes: 5 additions & 2 deletions app/conference_controls/conference_control_edit.php
Expand Up @@ -31,9 +31,9 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {
$control_name = $_POST["control_name"];
$control_enabled = $_POST["control_enabled"];
$control_enabled = $_POST["control_enabled"] ?: 'false';
$control_description = $_POST["control_description"];
}

Expand Down Expand Up @@ -123,6 +123,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($control_enabled) == 0) { $control_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
21 changes: 16 additions & 5 deletions app/conference_profiles/conference_profile_edit.php
Expand Up @@ -33,7 +33,7 @@
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$profile_name = $_POST["profile_name"];
$profile_enabled = $_POST["profile_enabled"];
$profile_enabled = $_POST["profile_enabled"] ?: 'false';
$profile_description = $_POST["profile_description"];
}
//check to see if the http post exists
Expand Down Expand Up @@ -120,6 +120,9 @@
unset($sql, $parameters);
}

//set the defaults
if (strlen($profile_enabled) == 0) { $profile_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down Expand Up @@ -158,10 +161,18 @@
echo " ".$text['label-profile_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='profile_enabled'>\n";
echo " <option value='true' ".($profile_enabled == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".($profile_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='profile_enabled' name='profile_enabled' value='true' ".($profile_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' name='profile_enabled'>\n";
echo " <option value='true' ".($profile_enabled == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".($profile_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-profile_enabled']."\n";
echo "</td>\n";
Expand Down
3 changes: 3 additions & 0 deletions app/conference_profiles/conference_profile_param_edit.php
Expand Up @@ -128,6 +128,9 @@
unset($sql, $parameters);
}

//set the defaults
if (strlen($profile_param_enabled) == 0) { $profile_param_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
3 changes: 3 additions & 0 deletions app/conferences/conference_edit.php
Expand Up @@ -296,6 +296,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($conference_enabled) == 0) { $conference_enabled = 'true'; }

//get the conference profiles
$sql = "select * ";
$sql .= "from v_conference_profiles ";
Expand Down
1 change: 1 addition & 0 deletions app/destinations/destination_edit.php
Expand Up @@ -1127,6 +1127,7 @@
if (strlen($destination_order) == 0) { $destination_order = '100'; }
if (strlen($destination_type) == 0) { $destination_type = 'inbound'; }
if (strlen($destination_context) == 0) { $destination_context = 'public'; }
if (strlen($destination_enabled) == 0) { $destination_enabled = 'true'; }
if ($destination_type =="outbound") { $destination_context = $_SESSION['domain_name']; }
if ($destination_type =="local") { $destination_context = $_SESSION['domain_name']; }

Expand Down
3 changes: 3 additions & 0 deletions app/devices/device_edit.php
Expand Up @@ -527,6 +527,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($device_enabled) == 0) { $device_enabled = 'true'; }

//use the mac address to get the vendor
if (strlen($device_vendor) == 0) {
//get the device vendor using the mac address
Expand Down
3 changes: 3 additions & 0 deletions app/devices/device_profile_edit.php
Expand Up @@ -242,6 +242,9 @@
unset ($sql, $parameters);
}

//set the defaults
if (strlen($device_profile_enabled) == 0) { $device_profile_enabled = 'true'; }

//get the child data
if (strlen($device_profile_uuid) > 0) {
$sql = "select * from v_device_profile_keys ";
Expand Down
3 changes: 3 additions & 0 deletions app/devices/device_vendor_edit.php
Expand Up @@ -140,6 +140,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($enabled) == 0) { $enabled = true; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
7 changes: 5 additions & 2 deletions app/email_templates/email_template_edit.php
Expand Up @@ -52,15 +52,15 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {
$domain_uuid = $_POST["domain_uuid"];
$template_language = $_POST["template_language"];
$template_category = $_POST["template_category"];
$template_subcategory = $_POST["template_subcategory"];
$template_subject = $_POST["template_subject"];
$template_body = $_POST["template_body"];
$template_type = $_POST["template_type"];
$template_enabled = $_POST["template_enabled"];
$template_enabled = $_POST["template_enabled"] ?: 'false';
$template_description = $_POST["template_description"];
}

Expand Down Expand Up @@ -168,6 +168,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($template_enabled) == 0) { $template_enabled = 'true'; }

//load editor preferences/defaults
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = $_SESSION["editor"]["theme"]["text"] != '' ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
Expand Down
7 changes: 5 additions & 2 deletions app/extension_settings/extension_setting_edit.php
Expand Up @@ -61,12 +61,12 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {
$domain_uuid = $_POST["domain_uuid"];
$extension_setting_type = $_POST["extension_setting_type"];
$extension_setting_name = $_POST["extension_setting_name"];
$extension_setting_value = $_POST["extension_setting_value"];
$extension_setting_enabled = $_POST["extension_setting_enabled"];
$extension_setting_enabled = $_POST["extension_setting_enabled"] ?: 'false';
$extension_setting_description = $_POST["extension_setting_description"];
}

Expand Down Expand Up @@ -213,6 +213,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($extension_setting_enabled) == 0) { $extension_setting_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
3 changes: 2 additions & 1 deletion app/extensions/extension_edit.php
Expand Up @@ -136,7 +136,7 @@
$absolute_codec_string = $_POST["absolute_codec_string"];
$force_ping = $_POST["force_ping"];
$dial_string = $_POST["dial_string"];
$enabled = $_POST["enabled"];
$enabled = $_POST["enabled"] ?: 'false';
$description = $_POST["description"];

//outbound caller id number - only allow numeric and +
Expand Down Expand Up @@ -1005,6 +1005,7 @@
if (strlen($user_record) == 0) { $user_record = $_SESSION['extension']['user_record_default']['text']; }
if (strlen($voicemail_transcription_enabled) == 0) { $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; }
if (strlen($voicemail_enabled) == 0) { $voicemail_enabled = $_SESSION['voicemail']['enabled_default']['boolean']; }
if (strlen($enabled) == 0) { $enabled = 'true'; }

//create token
$object = new token;
Expand Down
4 changes: 4 additions & 0 deletions app/modules/module_edit.php
Expand Up @@ -163,6 +163,10 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($module_enabled) == 0) { $module_enabled = 'true'; }
if (strlen($module_default_enabled) == 0) { $module_default_enabled = 'true'; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down
3 changes: 3 additions & 0 deletions app/phrases/phrase_edit.php
Expand Up @@ -286,6 +286,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($phrase_enabled) == 0) { $phrase_enabled = 'true'; }

//get the phrase details
if (is_uuid($phrase_uuid)) {
$sql = "select * from v_phrase_details ";
Expand Down
3 changes: 2 additions & 1 deletion app/ring_groups/ring_group_edit.php
Expand Up @@ -503,7 +503,7 @@
}
}

//set the default
//set the defaults
$destination_delay_max = $_SESSION['ring_group']['destination_delay_max']['numeric'];
$destination_timeout_max = $_SESSION['ring_group']['destination_timeout_max']['numeric'];
if (strlen($ring_group_ringback) == 0) {
Expand All @@ -512,6 +512,7 @@
if (strlen($ring_group_call_timeout) == 0) {
$ring_group_call_timeout = '30';
}
if (strlen($ring_group_enabled) == 0) { $ring_group_enabled = 'true'; }

//get the ring group destination array
if ($action == "add") {
Expand Down
5 changes: 4 additions & 1 deletion app/sip_profiles/sip_profile_edit.php
Expand Up @@ -55,7 +55,7 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {

//process the http post data by submitted action
if ($_POST['action'] != '' && is_uuid($_POST['sip_profile_uuid'])) {
Expand Down Expand Up @@ -259,6 +259,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($sip_profile_enabled) == 0) { $sip_profile_enabled = 'true'; }

//get the child data
$sql = "select * from v_sip_profile_settings ";
$sql .= "where sip_profile_uuid = :sip_profile_uuid ";
Expand Down
26 changes: 13 additions & 13 deletions app/sofia_global_settings/sofia_global_setting_edit.php
Expand Up @@ -156,6 +156,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($global_setting_enabled) == 0) { $global_setting_enabled = true; }

//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
Expand Down Expand Up @@ -226,21 +229,18 @@
echo " ".$text['label-global_setting_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <select class='formfld' name='global_setting_enabled'>\n";
echo " <option value=''></option>\n";
if ($global_setting_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($global_setting_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='global_setting_enabled' name='global_setting_enabled' value='true' ".($global_setting_enabled == true ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
echo " <select class='formfld' name='global_setting_enabled'>\n";
echo " <option value='true' ".($global_setting_enabled == "true" ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
echo " <option value='false' ".($global_setting_enabled == "false" ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
echo " </select>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-global_setting_enabled']."\n";
echo "</td>\n";
Expand All @@ -267,4 +267,4 @@
//include the footer
require_once "resources/footer.php";

?>
?>
7 changes: 5 additions & 2 deletions app/streams/stream_edit.php
Expand Up @@ -53,12 +53,12 @@
}

//get http post variables and set them to php variables
if (is_array($_POST)) {
if (count($_POST) > 0) {
$domain_uuid = $_POST['domain_uuid'];
$stream_uuid = $_POST["stream_uuid"];
$stream_name = $_POST["stream_name"];
$stream_location = $_POST["stream_location"];
$stream_enabled = $_POST["stream_enabled"];
$stream_enabled = $_POST["stream_enabled"] ?: 'false';
$stream_description = $_POST["stream_description"];
}

Expand Down Expand Up @@ -154,6 +154,9 @@
unset($sql, $parameters, $row);
}

//set the defaults
if (strlen($stream_enabled) == 0) { $stream_enabled = 'true'; }

//need stream_all permission to edit a global stream
if (!permission_exists('stream_all') && $domain_uuid == null) {
header('Location: streams.php');
Expand Down

0 comments on commit 7326cb8

Please sign in to comment.