Plugin Directory

Changeset 3425687


Ignore:
Timestamp:
12/22/2025 10:37:45 PM (3 months ago)
Author:
bookingor
Message:

added current_user_can

Location:
bookingor/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • bookingor/trunk/admin/include/category/category-control.php

    r3425670 r3425687  
    4848            }
    4949            $id = stripslashes(filter_var($_REQUEST["id"], FILTER_SANITIZE_NUMBER_INT)); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.
     50
     51
     52            if (!current_user_can('manage_options')) {
     53                $response = [
     54                    'status' => htmlspecialchars('error'),
     55                    'message' => htmlspecialchars('You do not have permission.')
     56                ];
     57                echo wp_json_encode($response);
     58                die();
     59            }
    5060
    5161            $get_category_in_booking = $wpdb->get_results(
     
    131141                    ];
    132142                }
     143            }
     144            if (!current_user_can('manage_options')) {
     145                $response = [
     146                    'status' => htmlspecialchars('error'),
     147                    'message' => htmlspecialchars('You do not have permission.')
     148                ];
     149                echo wp_json_encode($response);
     150                die();
    133151            }
    134152            $category_name   = sanitize_text_field(wp_unslash($_POST['tcn_category_name'] ?? ""));
  • bookingor/trunk/admin/include/customer/customer-control.php

    r3425670 r3425687  
    6565                }
    6666            }
     67            if (!current_user_can('manage_options')) {
     68                $response = [
     69                    'status' => htmlspecialchars('error'),
     70                    'message' => htmlspecialchars('You do not have permission.')
     71                ];
     72                echo wp_json_encode($response);
     73                die();
     74            }
    6775        $get_customer_in_booking = $wpdb->get_results(
    6876            $wpdb->prepare(
  • bookingor/trunk/admin/include/location/location-control.php

    r3425670 r3425687  
    6969                }
    7070            }
     71            if (!current_user_can('manage_options')) {
     72                $response = [
     73                    'status' => htmlspecialchars('error'),
     74                    'message' => htmlspecialchars('You do not have permission.')
     75                ];
     76                echo wp_json_encode($response);
     77                die();
     78            }
    7179            $location_title = sanitize_text_field(wp_unslash($_POST['bookingor_location_title'] ?? ''));
    7280            $location_icon = sanitize_text_field(wp_unslash($_POST['location_icon_id'] ?? ''));
     
    154162                }
    155163            }
     164            if (!current_user_can('manage_options')) {
     165                $response = [
     166                    'status' => htmlspecialchars('error'),
     167                    'message' => htmlspecialchars('You do not have permission.')
     168                ];
     169                echo wp_json_encode($response);
     170                die();
     171            }
    156172            $location_title = sanitize_text_field(wp_unslash($_POST['bookingor_location_title'] ?? ""));
    157173            $location_id   = sanitize_text_field(wp_unslash($_POST['location_id'] ?? ""));
  • bookingor/trunk/admin/include/notification/notification-control.php

    r3425670 r3425687  
    5757                }
    5858            }
     59            if (!current_user_can('manage_options')) {
     60                $response = [
     61                    'status' => htmlspecialchars('error'),
     62                    'message' => htmlspecialchars('You do not have permission.')
     63                ];
     64                echo wp_json_encode($response);
     65                die();
     66            }
    5967            $email_get_id = sanitize_text_field(wp_unslash($_POST['email_id'] ?? ""));
    6068            $email_subject = sanitize_text_field(wp_unslash($_POST['subject'] ?? ""));
  • bookingor/trunk/admin/include/services/service-control.php

    r3425670 r3425687  
    147147                }
    148148            }
     149            if (!current_user_can('manage_options')) {
     150                $response = [
     151                    'status' => htmlspecialchars('error'),
     152                    'message' => htmlspecialchars('You do not have permission.')
     153                ];
     154                echo wp_json_encode($response);
     155                die();
     156            }
    149157            // phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
    150158            $service_name   = sanitize_text_field(wp_unslash($_POST['service_name'] ?? ""));
     
    312320                }
    313321            }
     322            if (!current_user_can('manage_options')) {
     323                $response = [
     324                    'status' => htmlspecialchars('error'),
     325                    'message' => htmlspecialchars('You do not have permission.')
     326                ];
     327                echo wp_json_encode($response);
     328                die();
     329            }
    314330            //tab basic
    315331            $service_name   = sanitize_text_field(wp_unslash($_POST['service_name'] ?? ""));
     
    459475                }
    460476        }
     477        if (!current_user_can('manage_options')) {
     478                $response = [
     479                    'status' => htmlspecialchars('error'),
     480                    'message' => htmlspecialchars('You do not have permission.')
     481                ];
     482                echo wp_json_encode($response);
     483                die();
     484            }
    461485
    462486        $wpdb->delete($delete_service, array(
  • bookingor/trunk/admin/include/staff/staff-control.php

    r3425670 r3425687  
    128128                }
    129129            }
     130            if (!current_user_can('manage_options')) {
     131                $response = [
     132                    'status' => htmlspecialchars('error'),
     133                    'message' => htmlspecialchars('You do not have permission.')
     134                ];
     135                echo wp_json_encode($response);
     136                die();
     137            }
    130138            $staff_first_name = sanitize_text_field(isset($_POST['staff_first_name']) ? $_POST['staff_first_name'] : '');
    131139            $staff_last_name = sanitize_text_field(isset($_POST['staff_last_name']) ? $_POST['staff_last_name'] : '');
     
    268276                }
    269277            }
     278            if (!current_user_can('manage_options')) {
     279                $response = [
     280                    'status' => htmlspecialchars('error'),
     281                    'message' => htmlspecialchars('You do not have permission.')
     282                ];
     283                echo wp_json_encode($response);
     284                die();
     285            }
    270286            $staff_first_name =  sanitize_text_field($_POST['staff_first_name'] ?? "");
    271287            $staff_last_name = sanitize_text_field($_POST['staff_last_name'] ?? "");
  • bookingor/trunk/admin/include/templates/templates-control.php

    r3425670 r3425687  
    2222                    ];
    2323                }
     24            }
     25            if (!current_user_can('manage_options')) {
     26                $response = [
     27                    'status' => htmlspecialchars('error'),
     28                    'message' => htmlspecialchars('You do not have permission.')
     29                ];
     30                echo wp_json_encode($response);
     31                die();
    2432            }
    2533            if (isset($_REQUEST['editingId']) && sanitize_text_field($_REQUEST['editingId']) === '1') {
     
    184192    {
    185193        if (isset($_REQUEST['action'])) {
    186                         if (isset($_POST['nonce'])) {
     194            if (isset($_POST['nonce'])) {
    187195                if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {
    188196                    $response = [
     
    191199                    ];
    192200                }
     201            }
     202            if (!current_user_can('manage_options')) {
     203                $response = [
     204                    'status' => htmlspecialchars('error'),
     205                    'message' => htmlspecialchars('You do not have permission.')
     206                ];
     207                echo wp_json_encode($response);
     208                die();
    193209            }
    194210            //stripe
  • bookingor/trunk/includes/class-bookingor-activator.php

    r3204898 r3425687  
    3535    ob_start();
    3636
    37 
     37    // Add custom capabilities
     38    $role = get_role('administrator');
     39    if ($role) {
     40      $role->add_cap('bp_delete_category');
     41      $role->add_cap('bp_add_category');
     42      $role->add_cap('bp_update_category');
     43      $role->add_cap('bp_get_category');
     44    }
    3845
    3946    //category
Note: See TracChangeset for help on using the changeset viewer.