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:
frytimo
2025-03-04 11:25:47 -07:00
committed by GitHub
parent 1b19e40be4
commit d529021b3f
99 changed files with 265 additions and 295 deletions
+2 -2
View File
@@ -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";