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
+3 -3
View File
@@ -341,7 +341,7 @@
*/
//send feature event notify to the phone
if (!empty($_SESSION['device']['feature_sync']['boolean']) && $_SESSION['device']['feature_sync']['boolean'] == "true") {
if (filter_var($_SESSION['device']['feature_sync']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
$ring_count = ceil($call_timeout / 6);
$feature_event_notify = new feature_event_notify;
$feature_event_notify->domain_name = $_SESSION['domain_name'];
@@ -358,7 +358,7 @@
else {
$feature_event_notify->forward_all_destination = $forward_all_destination;
}
if ($forward_busy_destination == "") {
$feature_event_notify->forward_busy_destination = "0";
}
@@ -504,7 +504,7 @@
}
//prepare the autocomplete
if(!empty($_SESSION['follow_me']['follow_me_autocomplete']['boolean']) && $_SESSION['follow_me']['follow_me_autocomplete']['boolean'] == 'true') {
if(filter_var($_SESSION['follow_me']['follow_me_autocomplete']['boolean'] ?? false, FILTER_VALIDATE_BOOLEAN)) {
echo "<link rel=\"stylesheet\" href=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.css\" />\n";
echo "<script src=\"".PROJECT_PATH."/resources/jquery/jquery-ui.min.js\"></script>\n";
echo "<script type=\"text/javascript\">\n";