Use the settings class get method

This commit is contained in:
FusionPBX
2025-08-26 13:02:14 -06:00
committed by GitHub
parent 8ac3b8e8d0
commit ccb4b2a5bf
30 changed files with 69 additions and 67 deletions

View File

@@ -92,7 +92,7 @@
//$contact_users = $_POST["contact_users"];
//$contact_groups = $_POST["contact_groups"];
$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_user_uuid = $settings->get('contact', 'permissions', false) ? ($_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 (filter_var($_SESSION['contact']['permissions']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if ($settings->get('contact', 'permissions', false)) {
if (permission_exists('contact_user_view') || permission_exists('contact_group_view')) {
echo " <div class='form_set card'>\n";
echo " <div class='heading'>\n";

View File

@@ -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') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('contact_phone_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@@ -130,7 +130,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-md-dn'>".escape($row['phone_description'])."&nbsp;</td>\n";
if (permission_exists('contact_phone_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('contact_phone_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$settings->get('theme', 'button_icon_edit'),'link'=>$list_row_url]);
echo " </td>\n";

View File

@@ -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') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('contact_url_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@@ -98,7 +98,7 @@
echo " <td>".escape($row['url_label'])." ".($row['url_primary'] ? "&nbsp;<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'])."&nbsp;</td>\n";
if (permission_exists('contact_url_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('contact_url_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$settings->get('theme', 'button_icon_edit'),'link'=>$list_row_url]);
echo " </td>\n";

View File

@@ -194,7 +194,7 @@
echo th_order_by('dashboard_order', $text['label-dashboard_order'], $order_by, $order);
echo th_order_by('dashboard_enabled', $text['label-dashboard_enabled'], $order_by, $order, null, "class='center'");
echo " <th class='hide-sm-dn'>".$text['label-dashboard_description']."</th>\n";
if (permission_exists('dashboard_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('dashboard_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
@@ -238,7 +238,7 @@
}
echo " </td>\n";
echo " <td class='description overflow hide-sm-dn'>".escape($row['dashboard_description'])."</td>\n";
if (permission_exists('dashboard_edit') && filter_var($_SESSION['theme']['list_row_edit_button']['boolean'] ?? false, FILTER_VALIDATE_BOOL)) {
if (permission_exists('dashboard_edit') && $settings->get('theme', 'list_row_edit_button', false)) {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$settings->get('theme', 'button_icon_edit'),'link'=>$list_row_url]);
echo " </td>\n";

View File

@@ -104,11 +104,11 @@
//retrieve password requirements
if (permission_exists('user_password')) {
$required['length'] = $_SESSION['users']['password_length']['numeric'];
$required['number'] = filter_var($_SESSION['users']['password_number']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
$required['lowercase'] = filter_var($_SESSION['users']['password_lowercase']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
$required['uppercase'] = filter_var($_SESSION['users']['password_uppercase']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
$required['special'] = filter_var($_SESSION['users']['password_special']['boolean'] ?? false, FILTER_VALIDATE_BOOL);
$required['length'] = $settings->get('users', 'password_length', 12);
$required['number'] = $settings->get('users', 'password_number', false);
$required['lowercase'] = $settings->get('users', 'password_lowercase', false);
$required['uppercase'] = $settings->get('users', 'password_uppercase', false);
$required['special'] = $settings->get('users', 'password_special', false);
}
//prepare the data