Plugin Directory

Changeset 3235962


Ignore:
Timestamp:
02/06/2025 11:26:10 AM (13 months ago)
Author:
iteras
Message:

Added bulk actions and paywall column to pages overview + fixed CSRF vulnerability

Location:
iteras/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • iteras/trunk/DEVELOPMENT.txt

    r3235960 r3235962  
    5050
    5151  cd ..
    52   svn commit -m 'New release' trunk
     52  svn commit -m '<some commit message>' trunk
    5353  svn cp trunk tags/<version>
    54   svn commit -m 'New release' tags
     54  svn commit -m 'Release <version>' tags
  • iteras/trunk/README.txt

    r3203746 r3235962  
    22Tags: paywall, subscribe, subscriptions, subscription, subscribers, access-control, paid content, premium, premium content, monetize, magazine, media pass, registration, billing, membership, member, earn money
    33Requires at least: 3.5.1
    4 Tested up to: 6.4.2
    5 Stable tag: 1.7.0
     4Tested up to: 6.7.1
     5Stable tag: 1.8.0
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    115115
    116116== Changelog ==
     117= 1.8.0 =
     118* Paywall bulk actions and paywall column available on pages overview
     119* Fixed potential CSRF problem with plugin settings form in Wordpress administration
     120
    117121= 1.7.0 =
    118122* Paywall signing key is now handled separately
  • iteras/trunk/admin/iteras-admin.php

    r3016412 r3235962  
    4545    add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) );
    4646
    47     // Add column on post list
    48     add_filter( 'manage_post_posts_columns', array( $this, 'add_paywall_post_columns' ) );
    49     add_action( 'manage_post_posts_custom_column', array( $this, 'populate_paywall_post_columns' ), 10, 2 );
     47    // Add column on lists
     48    add_filter( 'manage_post_posts_columns', array( $this, 'add_paywall_columns' ) );
     49    add_action( 'manage_post_posts_custom_column', array( $this, 'populate_paywall_columns' ), 10, 2 );
     50    add_filter( 'manage_page_posts_columns', array( $this, 'add_paywall_columns' ) );
     51    add_action( 'manage_page_posts_custom_column', array( $this, 'populate_paywall_columns' ), 10, 2 );
    5052   
    5153    add_action( 'load-post.php', array( $this, 'paywall_post_meta_boxes_setup' ) );
     
    5557    add_filter( 'bulk_actions-edit-post', array( $this, 'add_bulk_actions' ) );
    5658    add_filter( 'handle_bulk_actions-edit-post', array( $this, 'execute_bulk_actions' ), 10, 3 );
     59    add_filter( 'bulk_actions-edit-page', array( $this, 'add_bulk_actions' ) );
     60    add_filter( 'handle_bulk_actions-edit-page', array( $this, 'execute_bulk_actions' ), 10, 3 );
    5761  }
    5862
     
    9296
    9397
    94   function add_paywall_post_columns( $columns ) {
     98  function add_paywall_columns( $columns ) {
    9599    $columns["iteras-paywalled"] = __("Paywall");
    96100    return $columns;
     
    98102
    99103 
    100   function populate_paywall_post_columns( $column, $post_id ) {
     104  function populate_paywall_columns( $column, $post_id ) {
    101105    if ($column == "iteras-paywalled") {
    102106      $paywalled = !!get_post_meta($post_id, Iteras::POST_META_KEY, true);
     
    180184
    181185  function add_bulk_actions( $bulk_actions ) {
     186    if ( !in_array( current_filter(), array( 'bulk_actions-edit-post', 'bulk_actions-edit-page' ), true ) ) {
     187      return $bulk_actions;
     188    }
     189
    182190    $settings = $this->plugin->settings;
    183191    foreach ( $settings['paywalls'] as $p ) {
     
    266274    $messages = array();
    267275
    268     if ($_SERVER['REQUEST_METHOD'] == "POST") {
     276    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     277      if ( !isset( $_POST['iteras_plugin_settings_nonce'] ) ||
     278           !wp_verify_nonce( $_POST['iteras_plugin_settings_nonce'], 'iteras_plugin_settings' ) ) {
     279        wp_die( __( "Security check failed", $this->plugin_slug ) );
     280      }
     281
    269282      $this->save_settings_form();
    270283    }
    271284
    272     if (array_key_exists("sync", $_POST)) {
     285    if (array_key_exists('sync', $_POST)) {
    273286      $settings = $this->plugin->settings;
    274287      $paywalls = $this->fetch_paywalls($settings['api_key']);
     
    285298        array_push($messages, array(
    286299          "text" => __( "Synchronization of paywalls from ITERAS complete", $this->plugin_slug ),
    287           "type" => "success"
     300          "type" => 'success'
    288301        ));
    289302      }
     
    291304        array_push($messages, array(
    292305          "text" => __( "Couldn't synchronize paywalls from ITERAS", $this->plugin_slug ),
    293           "type" => "error"
     306          "type" => 'error'
    294307        ));
    295308      }
     
    298311    if (ITERAS_DEBUG && array_key_exists("reset", $_POST)) {
    299312      $this->plugin->reset_plugin();
    300       _log("RESET");
    301313    }
    302314
     
    331343  private function save_settings_form() {
    332344    if (!current_user_can('manage_options')) {
    333       wp_die('You do not have sufficient permissions to access this page.');
    334     }
     345      wp_die( __('You do not have sufficient permissions to access this page.', $this->plugin_slug ) );
     346    }
     347
    335348    $prev_settings = $this->plugin->settings;
    336349    $settings = array(
  • iteras/trunk/admin/views/admin.php

    r3016412 r3235962  
    99
    1010  <form method="post" action="">
     11    <?php wp_nonce_field( 'iteras_plugin_settings', 'iteras_plugin_settings_nonce' ); ?>
    1112    <input name="paywall" type="hidden" value="<?=$settings['paywall_id']; ?>">
    1213    <table class="form-table">
  • iteras/trunk/iteras.php

    r3016412 r3235962  
    1313 * Plugin URI:        https://app.iteras.dk
    1414 * Description:       Integration with ITERAS, a cloud-based state-of-the-art system for managing subscriptions/memberships and payments.
    15  * Version:           1.7.0
     15 * Version:           1.8.0
    1616 * Author:            ITERAS
    1717 * Author URI:        https://www.iteras.dk
  • iteras/trunk/public/iteras-public.php

    r3016412 r3235962  
    1616class Iteras {
    1717
    18   const VERSION = '1.7.0';
     18  const VERSION = '1.8.0';
    1919
    2020  const SETTINGS_KEY = "iteras_settings";
Note: See TracChangeset for help on using the changeset viewer.