Plugin Directory

Changeset 2866065


Ignore:
Timestamp:
02/16/2023 12:46:23 AM (3 years ago)
Author:
natereist
Message:

Tagging version 1.4.6

Location:
protected-posts-logout-button
Files:
2 edited
4 copied

Legend:

Unmodified
Added
Removed
  • protected-posts-logout-button/tags/1.4.6/pplb_logout_button.php

    r2866055 r2866065  
    22/*
    33    Plugin Name: Protected Posts Logout Button
    4     Plugin URI: http://omfgitsnater.com/protected-posts-logout-button/
     4    Plugin URI: http://mindutopia.com
    55    Description: A plugin built to add a logout button automatically to protected posts.
    6     Version: 1.4.5
     6    Version: 1.4.6
    77    Author: Nate Reist
    8     Author URI: http://omfgitsnater.com
     8    Author URI: http://mindutopia.com
    99*/
    1010
     
    155155        */
    156156        function pplb_options_save(){
    157             if ( isset( $_POST['pplb_action'] ) ) {
     157            if ( isset( $_POST['pplb_action'] ) && current_user_can( 'manage_options' ) ) {
    158158//              pplb_nonce
    159159                if ( array_key_exists( 'pplb_nonce', $_POST ) && ! wp_verify_nonce( $_POST['pplb_nonce'], 'pplb_update' ) ) {
     
    162162                    //update the option.
    163163                    $options = array();
    164                     $options['pplb_alert'] = ( array_key_exists('pplb_alert', $_POST) ) ? $_POST['pplb_alert']: 'no';
     164                    $options['pplb_alert'] = ( array_key_exists('pplb_alert', $_POST ) && $_POST['pplb_alert'] === 'yes' ) ? 'yes': 'no';
    165165                    $options['pplb_message'] = esc_js( $_POST['pplb_message'] );
    166                     $options['pplb_debug'] = ( array_key_exists('pplb_debug', $_POST) ) ? $_POST['pplb_debug']: 0;
     166                    $options['pplb_debug'] = ( array_key_exists('pplb_debug', $_POST ) ) ? 1 : 0;
    167167                    $options['pplb_button_class'] = esc_attr($_POST['pplb_button_class']);
    168168                    $options['pplb_button_text'] = !empty($_POST['pplb_button_text']) ? esc_attr($_POST['pplb_button_text']) : 'logout';
     
    171171                    update_option('pplb_options', $options);
    172172                   
    173                     $expire = ( isset( $_POST['pplb_pass_expires'] ) && !empty( $_POST['pplb_pass_expires'] ) ) ? $_POST['pplb_pass_expires']: false;
     173                    $expire = ( array_key_exists( 'pplb_pass_expires', $_POST ) && absint( $_POST['pplb_pass_expires'] ) ) ? absint( $_POST['pplb_pass_expires'] ): false;
    174174                    update_option('pplb_pass_expires', $expire );
    175175                   
    176                     $filter = isset($_POST['pplb_button_filter']) ? $_POST['pplb_button_filter']: 'yes';
     176                    $filter = ( array_key_exists( 'pplb_button_filter', $_POST ) && $_POST['pplb_button_filter'] === 'no' ) ? 'no' : 'yes';
    177177                    update_option( 'pplb_button_filter', $filter );
    178                     $position = isset($_POST['pplb_button_position']) ? $_POST['pplb_button_position']: 'before';
     178                    $position = array_key_exists( 'pplb_button_position', $_POST ) && $_POST['pplb_button_position'] === 'after' ? 'after' : 'before';
    179179                    update_option( 'pplb_button_position', $position );
    180180                    $redirect = add_query_arg( array( 'message' => 1 ) );
  • protected-posts-logout-button/tags/1.4.6/readme.txt

    r2866055 r2866065  
    55Requires at least: 2.8
    66Tested up to: 6.1.1
    7 Stable tag: 1.4.5
     7Stable tag: 1.4.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5151
    5252== Changelog ==
     53= 1.4.6 =
     54* Fixed vulnerabilities in option saving function, not allowing unescaped user input and checking user role
     55
    5356= 1.4.5 =
    5457* Tested with Wordpress 6.1.1
  • protected-posts-logout-button/trunk/pplb_logout_button.php

    r2866055 r2866065  
    22/*
    33    Plugin Name: Protected Posts Logout Button
    4     Plugin URI: http://omfgitsnater.com/protected-posts-logout-button/
     4    Plugin URI: http://mindutopia.com
    55    Description: A plugin built to add a logout button automatically to protected posts.
    6     Version: 1.4.5
     6    Version: 1.4.6
    77    Author: Nate Reist
    8     Author URI: http://omfgitsnater.com
     8    Author URI: http://mindutopia.com
    99*/
    1010
     
    155155        */
    156156        function pplb_options_save(){
    157             if ( isset( $_POST['pplb_action'] ) ) {
     157            if ( isset( $_POST['pplb_action'] ) && current_user_can( 'manage_options' ) ) {
    158158//              pplb_nonce
    159159                if ( array_key_exists( 'pplb_nonce', $_POST ) && ! wp_verify_nonce( $_POST['pplb_nonce'], 'pplb_update' ) ) {
     
    162162                    //update the option.
    163163                    $options = array();
    164                     $options['pplb_alert'] = ( array_key_exists('pplb_alert', $_POST) ) ? $_POST['pplb_alert']: 'no';
     164                    $options['pplb_alert'] = ( array_key_exists('pplb_alert', $_POST ) && $_POST['pplb_alert'] === 'yes' ) ? 'yes': 'no';
    165165                    $options['pplb_message'] = esc_js( $_POST['pplb_message'] );
    166                     $options['pplb_debug'] = ( array_key_exists('pplb_debug', $_POST) ) ? $_POST['pplb_debug']: 0;
     166                    $options['pplb_debug'] = ( array_key_exists('pplb_debug', $_POST ) ) ? 1 : 0;
    167167                    $options['pplb_button_class'] = esc_attr($_POST['pplb_button_class']);
    168168                    $options['pplb_button_text'] = !empty($_POST['pplb_button_text']) ? esc_attr($_POST['pplb_button_text']) : 'logout';
     
    171171                    update_option('pplb_options', $options);
    172172                   
    173                     $expire = ( isset( $_POST['pplb_pass_expires'] ) && !empty( $_POST['pplb_pass_expires'] ) ) ? $_POST['pplb_pass_expires']: false;
     173                    $expire = ( array_key_exists( 'pplb_pass_expires', $_POST ) && absint( $_POST['pplb_pass_expires'] ) ) ? absint( $_POST['pplb_pass_expires'] ): false;
    174174                    update_option('pplb_pass_expires', $expire );
    175175                   
    176                     $filter = isset($_POST['pplb_button_filter']) ? $_POST['pplb_button_filter']: 'yes';
     176                    $filter = ( array_key_exists( 'pplb_button_filter', $_POST ) && $_POST['pplb_button_filter'] === 'no' ) ? 'no' : 'yes';
    177177                    update_option( 'pplb_button_filter', $filter );
    178                     $position = isset($_POST['pplb_button_position']) ? $_POST['pplb_button_position']: 'before';
     178                    $position = array_key_exists( 'pplb_button_position', $_POST ) && $_POST['pplb_button_position'] === 'after' ? 'after' : 'before';
    179179                    update_option( 'pplb_button_position', $position );
    180180                    $redirect = add_query_arg( array( 'message' => 1 ) );
  • protected-posts-logout-button/trunk/readme.txt

    r2866055 r2866065  
    55Requires at least: 2.8
    66Tested up to: 6.1.1
    7 Stable tag: 1.4.5
     7Stable tag: 1.4.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5151
    5252== Changelog ==
     53= 1.4.6 =
     54* Fixed vulnerabilities in option saving function, not allowing unescaped user input and checking user role
     55
    5356= 1.4.5 =
    5457* Tested with Wordpress 6.1.1
Note: See TracChangeset for help on using the changeset viewer.