Plugin Directory

Changeset 3064569


Ignore:
Timestamp:
04/04/2024 10:44:39 AM (23 months ago)
Author:
Unyson
Message:

Version 2.7.30

Location:
unyson
Files:
3 edited
7 copied

Legend:

Unmodified
Added
Removed
  • unyson/tags/2.7.30/framework/core/components/extensions/manager/class--fw-extensions-manager.php

    r2749668 r3064569  
    278278    public function _action_ajax_check_direct_fs_access()
    279279    {
    280         if (!$this->can_install()) {
     280        if ( ! $this->can_install() || empty( $_POST['extAction'] ) ) {
    281281            // if can't install, no need to know if has access or not
     282            wp_send_json_error();
     283        }
     284
     285        $nonce = $this->get_nonce( $_POST['extAction'] );
     286
     287        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
    282288            wp_send_json_error();
    283289        }
     
    300306        }
    301307
     308        $nonce = $this->get_nonce( 'install' );
     309
     310        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
     311            wp_send_json_error();
     312        }
     313
    302314        if ( ! FW_WP_Filesystem::has_direct_access( fw_get_framework_directory( '/extensions' ) ) ) {
    303315            wp_send_json_error();
     
    322334        if (!$this->can_install()) {
    323335            // if can't install, no need to know if has access or not
     336            wp_send_json_error();
     337        }
     338
     339        $nonce = $this->get_nonce( 'delete' );
     340
     341        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
    324342            wp_send_json_error();
    325343        }
  • unyson/tags/2.7.30/framework/core/components/extensions/manager/static/extensions-page.js

    r1891028 r3064569  
    2727            var $form = $(this);
    2828
    29             var confirmMessage = $form.attr('data-confirm-message');
     29            var confirmMessage = $form.attr('data-confirm-message'),
     30                action         = $form.attr('data-extension-action'),
     31                action         = action === 'uninstall' ? 'delete' : action,
     32                nonceName      = '_nonce_fw_extensions_' + action;
    3033
    3134            inst.isBusy = true;
     
    3639                type: 'POST',
    3740                data: {
    38                     action: 'fw_extensions_check_direct_fs_access'
     41                    action: 'fw_extensions_check_direct_fs_access',
     42                    [nonceName]: $form.find('#' + nonceName).val(),
     43                    extAction: action
    3944                },
    4045                dataType: 'json'
     
    5257                        type: 'POST',
    5358                        data: {
    54                             action: 'fw_extensions_'+ $form.attr('data-extension-action'),
    55                             extension: $form.attr('data-extension-name')
     59                            action: 'fw_extensions_' + (action === 'delete' ? 'uninstall' : action),
     60                            extension: $form.attr('data-extension-name'),
     61                            [nonceName]: $form.find('#' + nonceName).val()
    5662                        },
    5763                        dataType: 'json'
  • unyson/trunk/framework/core/components/extensions/manager/class--fw-extensions-manager.php

    r2749668 r3064569  
    278278    public function _action_ajax_check_direct_fs_access()
    279279    {
    280         if (!$this->can_install()) {
     280        if ( ! $this->can_install() || empty( $_POST['extAction'] ) ) {
    281281            // if can't install, no need to know if has access or not
     282            wp_send_json_error();
     283        }
     284
     285        $nonce = $this->get_nonce( $_POST['extAction'] );
     286
     287        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
    282288            wp_send_json_error();
    283289        }
     
    300306        }
    301307
     308        $nonce = $this->get_nonce( 'install' );
     309
     310        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
     311            wp_send_json_error();
     312        }
     313
    302314        if ( ! FW_WP_Filesystem::has_direct_access( fw_get_framework_directory( '/extensions' ) ) ) {
    303315            wp_send_json_error();
     
    322334        if (!$this->can_install()) {
    323335            // if can't install, no need to know if has access or not
     336            wp_send_json_error();
     337        }
     338
     339        $nonce = $this->get_nonce( 'delete' );
     340
     341        if ( ! isset( $_POST[ $nonce['name'] ] ) || ! wp_verify_nonce( $_POST[ $nonce['name'] ], $nonce['action'] ) ) {
    324342            wp_send_json_error();
    325343        }
  • unyson/trunk/framework/core/components/extensions/manager/static/extensions-page.js

    r1891028 r3064569  
    2727            var $form = $(this);
    2828
    29             var confirmMessage = $form.attr('data-confirm-message');
     29            var confirmMessage = $form.attr('data-confirm-message'),
     30                action         = $form.attr('data-extension-action'),
     31                action         = action === 'uninstall' ? 'delete' : action,
     32                nonceName      = '_nonce_fw_extensions_' + action;
    3033
    3134            inst.isBusy = true;
     
    3639                type: 'POST',
    3740                data: {
    38                     action: 'fw_extensions_check_direct_fs_access'
     41                    action: 'fw_extensions_check_direct_fs_access',
     42                    [nonceName]: $form.find('#' + nonceName).val(),
     43                    extAction: action
    3944                },
    4045                dataType: 'json'
     
    5257                        type: 'POST',
    5358                        data: {
    54                             action: 'fw_extensions_'+ $form.attr('data-extension-action'),
    55                             extension: $form.attr('data-extension-name')
     59                            action: 'fw_extensions_' + (action === 'delete' ? 'uninstall' : action),
     60                            extension: $form.attr('data-extension-name'),
     61                            [nonceName]: $form.find('#' + nonceName).val()
    5662                        },
    5763                        dataType: 'json'
Note: See TracChangeset for help on using the changeset viewer.