diff --git a/includes/class-freemius.php b/includes/class-freemius.php index 95ae8e9ae..17ff6d3d2 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -3550,6 +3550,8 @@ static function _add_debug_section() { * @since 1.1.7.3 */ static function _toggle_debug_mode() { + check_admin_referer( 'fs_toggle_debug_mode' ); + if ( ! is_super_admin() ) { return; } @@ -3571,10 +3573,19 @@ static function _toggle_debug_mode() { * @since 1.2.1.6 */ static function _get_debug_log() { + check_admin_referer( 'fs_get_debug_log' ); + + if ( ! is_super_admin() ) { + return; + } + + $limit = min( ! empty( $_POST['limit'] ) ? absint( $_POST['limit'] ) : 200, 200 ); + $offset = min( ! empty( $_POST['offset'] ) ? absint( $_POST['offset'] ) : 200, 200 ); + $logs = FS_Logger::load_db_logs( fs_request_get( 'filters', false, 'post' ), - ! empty( $_POST['limit'] ) && is_numeric( $_POST['limit'] ) ? $_POST['limit'] : 200, - ! empty( $_POST['offset'] ) && is_numeric( $_POST['offset'] ) ? $_POST['offset'] : 0 + $limit, + $offset ); self::shoot_ajax_success( $logs ); @@ -4447,6 +4458,12 @@ function _add_connectivity_issue_message( $api_result, $is_first_failure = true * @since 1.0.9 */ function _email_about_firewall_issue() { + check_admin_referer( 'fs_resolve_firewall_issues' ); + + if ( ! current_user_can( is_multisite() ? 'manage_options' : 'activate_plugins' ) ) { + return; + } + $this->_admin_notices->remove_sticky( 'failed_connect_api' ); $pong = $this->ping(); @@ -4521,6 +4538,12 @@ function _email_about_firewall_issue() { * @since 1.1.7.4 */ function _retry_connectivity_test() { + check_admin_referer( 'fs_retry_connectivity_test' ); + + if ( ! current_user_can( is_multisite() ? 'manage_options' : 'activate_plugins' ) ) { + return; + } + $this->_admin_notices->remove_sticky( 'failed_connect_api_first' ); $pong = $this->ping(); diff --git a/includes/managers/class-fs-admin-notice-manager.php b/includes/managers/class-fs-admin-notice-manager.php index 1e911e055..3bae9a848 100644 --- a/includes/managers/class-fs-admin-notice-manager.php +++ b/includes/managers/class-fs-admin-notice-manager.php @@ -175,7 +175,12 @@ protected function __construct( * */ function dismiss_notice_ajax_callback() { - $this->_sticky_storage->remove( $_POST['message_id'] ); + check_admin_referer( 'fs_dismiss_notice_action' ); + + if ( ! is_numeric( $_POST['message_id'] ) ) { + $this->_sticky_storage->remove( $_POST['message_id'] ); + } + wp_die(); } @@ -469,4 +474,4 @@ private function get_notices_type() { } #endregion - } \ No newline at end of file + } diff --git a/includes/sdk/Exceptions/ArgumentNotExistException.php b/includes/sdk/Exceptions/ArgumentNotExistException.php index 846dc5990..09fc86b0d 100755 --- a/includes/sdk/Exceptions/ArgumentNotExistException.php +++ b/includes/sdk/Exceptions/ArgumentNotExistException.php @@ -1,4 +1,8 @@ getMessage(); } } - } \ No newline at end of file + } diff --git a/includes/sdk/Exceptions/InvalidArgumentException.php b/includes/sdk/Exceptions/InvalidArgumentException.php index eb15570b6..538983211 100755 --- a/includes/sdk/Exceptions/InvalidArgumentException.php +++ b/includes/sdk/Exceptions/InvalidArgumentException.php @@ -1,8 +1,12 @@ - \ No newline at end of file + diff --git a/templates/ajax-loader.php b/templates/ajax-loader.php index bc116f877..97ff60be2 100644 --- a/templates/ajax-loader.php +++ b/templates/ajax-loader.php @@ -1 +1,6 @@ - \ No newline at end of file + + diff --git a/templates/debug.php b/templates/debug.php index 44b1efc1f..029c009f5 100644 --- a/templates/debug.php +++ b/templates/debug.php @@ -37,6 +37,8 @@ $.post( ajaxurl, { action: 'fs_toggle_debug_mode', + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + _wpnonce : , is_on : ($(this).hasClass( 'fs-on' ) ? 1 : 0) }, function ( response ) { if ( 1 == response ) { @@ -111,7 +113,8 @@ if (optionName) { $.post(ajaxurl, { action : 'fs_get_db_option', - _wpnonce : '', + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + _wpnonce : , option_name: optionName }, function (response) { if (response.data.value) @@ -131,7 +134,8 @@ if (optionValue) { $.post(ajaxurl, { action : 'fs_set_db_option', - _wpnonce : '', + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + _wpnonce : , option_name : optionName, option_value: optionValue }, function () { @@ -724,6 +728,8 @@ class="dashicons dashicons-download"> , filters: filters, offset : offset, limit : limit diff --git a/templates/firewall-issues-js.php b/templates/firewall-issues-js.php index 2abfbc0e7..6a3f2a573 100755 --- a/templates/firewall-issues-js.php +++ b/templates/firewall-issues-js.php @@ -22,10 +22,12 @@ notice = $( this ).parents( '.fs-notice' ), ajaxActionSuffix = notice.attr( 'data-manager-id' ).replace( ':', '-' ); - var data = { - action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix, - error_type: error_type - }; + var data = { + action : 'fs_resolve_firewall_issues_' + ajaxActionSuffix, + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + _wpnonce : , + error_type: error_type + }; if ( 'squid' === error_type ) { data.hosting_company = prompt( 'What is the name or URL of your hosting company?' ); @@ -39,7 +41,9 @@ } if ( 'retry_ping' === error_type ) { - data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix; + data.action = 'fs_retry_connectivity_test_' + ajaxActionSuffix; + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + data._wpnonce = ; } $( this ).css({'cursor': 'wait'}); @@ -56,4 +60,4 @@ }); }); }); - \ No newline at end of file + diff --git a/templates/partials/network-activation.php b/templates/partials/network-activation.php index 06cbff2f5..12f152f9a 100644 --- a/templates/partials/network-activation.php +++ b/templates/partials/network-activation.php @@ -1,4 +1,9 @@ - \ No newline at end of file + diff --git a/templates/sticky-admin-notice-js.php b/templates/sticky-admin-notice-js.php index 028a9661c..d6d7ebe80 100755 --- a/templates/sticky-admin-notice-js.php +++ b/templates/sticky-admin-notice-js.php @@ -23,7 +23,9 @@ notice.fadeOut( 'fast', function() { var data = { - action : 'fs_dismiss_notice_action_' + ajaxActionSuffix, + action : 'fs_dismiss_notice_action_' + ajaxActionSuffix, + // As such we don't need to use `wp_json_encode` method but using it to follow wp.org guideline. + _wpnonce : , message_id: id }; @@ -36,4 +38,4 @@ }); }); }); - \ No newline at end of file +