mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Use boolean setting as true boolean (#7284)
* use boolean setting as true boolean * Update settings class to use the php filter_var function for boolean Using the built-in filter type for boolean seems like a better option as they are faster, already hardened, and more widely tested. I found this better method used originally by Mark J. Crane in 2022 in the content.php page so I included it here. * Update settings class to use the php filter_var function for boolean Using the built-in filter type for boolean seems like a better option as they are faster, already hardened, and more widely tested. I found this better method used originally by Mark J. Crane in 2022 in the content.php page so I included it here.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//set the uuid
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get the contact attachment list
|
||||
$sql = "select *, length(decode(attachment_content,'base64')) as attachment_size from v_contact_attachments ";
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
//$contact_users = $_POST["contact_users"];
|
||||
//$contact_groups = $_POST["contact_groups"];
|
||||
$contact_user_uuid = ($_SESSION['contact']['permissions']['boolean'] == "true") ? ($_POST["contact_user_uuid"] ?? $_SESSION["user_uuid"]) : ($contact_user_uuid = $_POST["contact_user_uuid"] ?? null);
|
||||
$contact_user_uuid = filter_var($_SESSION['contact']['permissions']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN) ? ($_POST["contact_user_uuid"] ?? $_SESSION["user_uuid"]) : ($contact_user_uuid = $_POST["contact_user_uuid"] ?? null);
|
||||
$contact_group_uuid = $_POST["contact_group_uuid"] ?? null;
|
||||
|
||||
$contact_phones = $_POST["contact_phones"];
|
||||
@@ -1529,7 +1529,7 @@ echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
unset($contact_note);
|
||||
|
||||
if ($_SESSION['contact']['permissions']['boolean'] == "true") {
|
||||
if (filter_var($_SESSION['contact']['permissions']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
|
||||
if (permission_exists('contact_user_view') || permission_exists('contact_group_view')) {
|
||||
echo " <div class='form_set card'>\n";
|
||||
echo " <div class='heading'>\n";
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get the contact list
|
||||
$sql = "select * from v_contact_emails ";
|
||||
@@ -71,7 +71,7 @@
|
||||
echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
|
||||
echo "<th>".$text['label-email_address']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -96,7 +96,7 @@
|
||||
echo " <td>".escape($row['email_label'])." ".($row['email_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
echo " <td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a> </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['email_description'])." </td>\n";
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get the extension list
|
||||
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
|
||||
@@ -69,7 +69,7 @@
|
||||
echo "<th>".$text['label-extension']."</th>\n";
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -95,7 +95,7 @@
|
||||
echo " </td>\n";
|
||||
echo " <td class='center'>".$text['label-'.escape($row['enabled'])]." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".$row['description']." </td>\n";
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
echo "<th>".$text['label-phone_type']."</th>\n";
|
||||
echo "<th>".$text['label-phone_tools']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-phone_description']."</th>\n";
|
||||
if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_phone_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -130,7 +130,7 @@
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['phone_description'])." </td>\n";
|
||||
if (permission_exists('contact_phone_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_phone_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get the related contacts
|
||||
$sql = "select ";
|
||||
@@ -85,7 +85,7 @@
|
||||
echo "<th>".$text['label-contact_relation_label']."</th>\n";
|
||||
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
|
||||
echo "<th>".$text['label-contact_relation_name']."</th>\n";
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -110,7 +110,7 @@
|
||||
echo " <td>".escape($row['relation_label'])." </td>\n";
|
||||
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a> </td>\n";
|
||||
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).((!empty($row['contact_name_given']) && !empty($row['contact_name_family'])) ? ' ' : null).escape($row['contact_name_family'])."</a> </td>\n";
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_contact_settings ";
|
||||
@@ -78,7 +78,7 @@
|
||||
echo "<th>".$text['label-contact_setting_value']."</th>";
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>";
|
||||
echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -119,7 +119,7 @@
|
||||
echo " </td>\n";
|
||||
echo " <td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".$row['contact_setting_description']." </td>\n";
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//set the uuid
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
@@ -79,7 +79,7 @@
|
||||
echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
|
||||
echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
|
||||
echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -115,7 +115,7 @@
|
||||
echo " <td>".$time_start." </td>\n";
|
||||
echo " <td>".$time." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['time_description'])." </td>\n";
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button == 'true') {
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
echo "<th class='pct-15'>".$text['label-url_label']."</th>\n";
|
||||
echo "<th>".$text['label-url_address']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-url_description']."</th>\n";
|
||||
if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_url_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -98,7 +98,7 @@
|
||||
echo " <td>".escape($row['url_label'])." ".($row['url_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
echo " <td class='no-link overflow no-wrap'><a href='".escape($row['url_address'])."' target='_blank'>".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."</a></td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['url_description'])." </td>\n";
|
||||
if (permission_exists('contact_url_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_url_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
$show = $_GET["show"] ?? '';
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
$list_row_edit_button = filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
|
||||
|
||||
//get posted data
|
||||
if (!empty($_POST['contacts'])) {
|
||||
@@ -387,7 +387,7 @@
|
||||
echo th_order_by('contact_title', $text['label-contact_title'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
echo th_order_by('contact_role', $text['label-contact_role'], $order_by, $order, null, "class='hide-sm-dn'");
|
||||
echo "<th class='shrink hide-sm-dn'> </th>\n";
|
||||
if ($list_row_edit_button == 'true') {
|
||||
if ($list_row_edit_button) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
@@ -439,7 +439,7 @@
|
||||
echo " ";
|
||||
}
|
||||
echo " </td>\n";
|
||||
if ($list_row_edit_button == 'true') {
|
||||
if ($list_row_edit_button) {
|
||||
echo " <td class='action-button'>";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]);
|
||||
echo " </td>\n";
|
||||
|
||||
Reference in New Issue
Block a user