Plugin Directory

Changeset 3420834


Ignore:
Timestamp:
12/16/2025 09:55:03 AM (4 months ago)
Author:
ergonet
Message:

fix missing authentication

Location:
ergonet-varnish-cache
Files:
1 added
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • ergonet-varnish-cache/tags/1.0.13/readme.txt

    r3273064 r3420834  
    33Tags: cache
    44Requires at least: 4.9
    5 Tested up to: 6.7
    6 Stable tag: 1.0.11
     5Tested up to: 6.9
     6Stable tag: 1.0.13
    77Requires PHP: 7.1
    88License: GPLv2 or later
  • ergonet-varnish-cache/tags/1.0.13/varnishCache.php

    r3273064 r3420834  
    66Plugin Name: Ergonet Cache
    77Description: Plugin per la gestione delle cache Nginx e Varnish su hosting Ergonet.
    8 Version: 1.0.11
     8Version: 1.0.13
    99Author: Ergonet srl
    1010Author URI: https://www.ergonet.it
     
    6262    }
    6363
    64     function cache_purge_action_js() { ?>
     64    function cache_purge_action_js() {
     65        $nonce = wp_create_nonce( 'ergonet_cache_nonce' );
     66        ?>
    6567        <script type="text/javascript" >
    6668            jQuery("li#wp-admin-bar-cache-purge-homepage .ab-item").on( "click", function() {
    6769                var data = {
    6870                    'action': 'varnish_cache_purge_homepage',
     71                    _ajax_nonce: '<?php echo $nonce; ?>'
    6972                };
    7073
     
    7679            jQuery("li#wp-admin-bar-cache-purge-all .ab-item").on( "click", function() {
    7780                var data = {
    78                     'action': 'varnish_cache_purge_all',
     81                    action: 'varnish_cache_purge_all',
     82                    _ajax_nonce: '<?php echo $nonce; ?>'
    7983                };
    8084
     
    97101
    98102    function adminBarMenu($wp_admin_bar) {
     103        if ( ! current_user_can('manage_options') ) {
     104            return;
     105        }
    99106        global $pagenow;
    100107        $wp_admin_bar->add_node(array("id"=>"parent_node_1", "title"=>"<span class=\"ab-icon dashicons dashicons-performance\"></span>Ergonet Cache", "href"=>false));
     
    109116    function purgeCache($post_id)
    110117    {
     118        if ( ! current_user_can('edit_post', $post_id) ) {
     119            return;
     120        }
     121
     122        if ( wp_is_post_revision( $post_id ) ) {
     123            return;
     124        }
     125
    111126        if(!$this->notToDo) {
    112127            $this->purgePost($post_id);
  • ergonet-varnish-cache/trunk/readme.txt

    r3273051 r3420834  
    33Tags: cache
    44Requires at least: 4.9
    5 Tested up to: 6.7
    6 Stable tag: 1.0.11
     5Tested up to: 6.9
     6Stable tag: 1.0.13
    77Requires PHP: 7.1
    88License: GPLv2 or later
  • ergonet-varnish-cache/trunk/varnishCache.php

    r3273044 r3420834  
    66Plugin Name: Ergonet Cache
    77Description: Plugin per la gestione delle cache Nginx e Varnish su hosting Ergonet.
    8 Version: 1.0.11
     8Version: 1.0.13
    99Author: Ergonet srl
    1010Author URI: https://www.ergonet.it
     
    6262    }
    6363
    64     function cache_purge_action_js() { ?>
     64    function cache_purge_action_js() {
     65        $nonce = wp_create_nonce( 'ergonet_cache_nonce' );
     66        ?>
    6567        <script type="text/javascript" >
    6668            jQuery("li#wp-admin-bar-cache-purge-homepage .ab-item").on( "click", function() {
    6769                var data = {
    6870                    'action': 'varnish_cache_purge_homepage',
     71                    _ajax_nonce: '<?php echo $nonce; ?>'
    6972                };
    7073
     
    7679            jQuery("li#wp-admin-bar-cache-purge-all .ab-item").on( "click", function() {
    7780                var data = {
    78                     'action': 'varnish_cache_purge_all',
     81                    action: 'varnish_cache_purge_all',
     82                    _ajax_nonce: '<?php echo $nonce; ?>'
    7983                };
    8084
     
    97101
    98102    function adminBarMenu($wp_admin_bar) {
     103        if ( ! current_user_can('manage_options') ) {
     104            return;
     105        }
    99106        global $pagenow;
    100107        $wp_admin_bar->add_node(array("id"=>"parent_node_1", "title"=>"<span class=\"ab-icon dashicons dashicons-performance\"></span>Ergonet Cache", "href"=>false));
     
    109116    function purgeCache($post_id)
    110117    {
     118        if ( ! current_user_can('edit_post', $post_id) ) {
     119            return;
     120        }
     121
     122        if ( wp_is_post_revision( $post_id ) ) {
     123            return;
     124        }
     125
    111126        if(!$this->notToDo) {
    112127            $this->purgePost($post_id);
Note: See TracChangeset for help on using the changeset viewer.