| @@ -89,24 +89,30 @@ | ||
| 89 | 89 | * |
| 90 | 90 | * @since 1.0 |
| 91 | 91 | */ |
| 92 | 92 | public function purge_object_cache() { |
| 93 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'powered_cache_purge_object_cache' ) ) { | |
| 93 | + if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'powered_cache_purge_object_cache' ) ) { // phpcs:ignore | |
| 94 | 94 | wp_nonce_ays( '' ); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ( is_multisite() && ! current_user_can( 'manage_network' ) ) { |
| 98 | 98 | $redirect_url = add_query_arg( 'pc_action', 'flush_object_cache_err_permission', wp_get_referer() ); |
| 99 | - wp_safe_redirect( $redirect_url ); | |
| 99 | + wp_safe_redirect( esc_url_raw( $redirect_url ) ); | |
| 100 | 100 | exit; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 104 | + $redirect_url = add_query_arg( 'pc_action', 'flush_object_cache_err_permission', wp_get_referer() ); | |
| 105 | + wp_safe_redirect( esc_url_raw( $redirect_url ) ); | |
| 106 | + exit; | |
| 107 | + } | |
| 108 | + | |
| 103 | 109 | if ( function_exists( 'wp_cache_flush' ) ) { |
| 104 | 110 | wp_cache_flush(); |
| 105 | 111 | } |
| 106 | 112 | |
| 107 | 113 | $redirect_url = add_query_arg( 'pc_action', 'flush_object_cache', wp_get_referer() ); |
| 108 | - wp_safe_redirect( $redirect_url ); | |
| 114 | + wp_safe_redirect( esc_url_raw( $redirect_url ) ); | |
| 109 | 115 | exit; |
| 110 | 116 | } |
| 111 | 117 | |
| 112 | 118 | |