Changeset 2866065
- Timestamp:
- 02/16/2023 12:46:23 AM (3 years ago)
- Location:
- protected-posts-logout-button
- Files:
-
- 2 edited
- 4 copied
-
tags/1.4.6 (copied) (copied from protected-posts-logout-button/trunk)
-
tags/1.4.6/pplb_logout_button.php (copied) (copied from protected-posts-logout-button/trunk/pplb_logout_button.php) (4 diffs)
-
tags/1.4.6/readme.txt (copied) (copied from protected-posts-logout-button/trunk/readme.txt) (2 diffs)
-
tags/1.4.6/templates/pplb-options.php (copied) (copied from protected-posts-logout-button/trunk/templates/pplb-options.php)
-
trunk/pplb_logout_button.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
protected-posts-logout-button/tags/1.4.6/pplb_logout_button.php
r2866055 r2866065 2 2 /* 3 3 Plugin Name: Protected Posts Logout Button 4 Plugin URI: http:// omfgitsnater.com/protected-posts-logout-button/4 Plugin URI: http://mindutopia.com 5 5 Description: A plugin built to add a logout button automatically to protected posts. 6 Version: 1.4. 56 Version: 1.4.6 7 7 Author: Nate Reist 8 Author URI: http:// omfgitsnater.com8 Author URI: http://mindutopia.com 9 9 */ 10 10 … … 155 155 */ 156 156 function pplb_options_save(){ 157 if ( isset( $_POST['pplb_action'] ) ) {157 if ( isset( $_POST['pplb_action'] ) && current_user_can( 'manage_options' ) ) { 158 158 // pplb_nonce 159 159 if ( array_key_exists( 'pplb_nonce', $_POST ) && ! wp_verify_nonce( $_POST['pplb_nonce'], 'pplb_update' ) ) { … … 162 162 //update the option. 163 163 $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'; 165 165 $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; 167 167 $options['pplb_button_class'] = esc_attr($_POST['pplb_button_class']); 168 168 $options['pplb_button_text'] = !empty($_POST['pplb_button_text']) ? esc_attr($_POST['pplb_button_text']) : 'logout'; … … 171 171 update_option('pplb_options', $options); 172 172 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; 174 174 update_option('pplb_pass_expires', $expire ); 175 175 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'; 177 177 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'; 179 179 update_option( 'pplb_button_position', $position ); 180 180 $redirect = add_query_arg( array( 'message' => 1 ) ); -
protected-posts-logout-button/tags/1.4.6/readme.txt
r2866055 r2866065 5 5 Requires at least: 2.8 6 6 Tested up to: 6.1.1 7 Stable tag: 1.4. 57 Stable tag: 1.4.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 51 51 52 52 == Changelog == 53 = 1.4.6 = 54 * Fixed vulnerabilities in option saving function, not allowing unescaped user input and checking user role 55 53 56 = 1.4.5 = 54 57 * Tested with Wordpress 6.1.1 -
protected-posts-logout-button/trunk/pplb_logout_button.php
r2866055 r2866065 2 2 /* 3 3 Plugin Name: Protected Posts Logout Button 4 Plugin URI: http:// omfgitsnater.com/protected-posts-logout-button/4 Plugin URI: http://mindutopia.com 5 5 Description: A plugin built to add a logout button automatically to protected posts. 6 Version: 1.4. 56 Version: 1.4.6 7 7 Author: Nate Reist 8 Author URI: http:// omfgitsnater.com8 Author URI: http://mindutopia.com 9 9 */ 10 10 … … 155 155 */ 156 156 function pplb_options_save(){ 157 if ( isset( $_POST['pplb_action'] ) ) {157 if ( isset( $_POST['pplb_action'] ) && current_user_can( 'manage_options' ) ) { 158 158 // pplb_nonce 159 159 if ( array_key_exists( 'pplb_nonce', $_POST ) && ! wp_verify_nonce( $_POST['pplb_nonce'], 'pplb_update' ) ) { … … 162 162 //update the option. 163 163 $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'; 165 165 $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; 167 167 $options['pplb_button_class'] = esc_attr($_POST['pplb_button_class']); 168 168 $options['pplb_button_text'] = !empty($_POST['pplb_button_text']) ? esc_attr($_POST['pplb_button_text']) : 'logout'; … … 171 171 update_option('pplb_options', $options); 172 172 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; 174 174 update_option('pplb_pass_expires', $expire ); 175 175 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'; 177 177 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'; 179 179 update_option( 'pplb_button_position', $position ); 180 180 $redirect = add_query_arg( array( 'message' => 1 ) ); -
protected-posts-logout-button/trunk/readme.txt
r2866055 r2866065 5 5 Requires at least: 2.8 6 6 Tested up to: 6.1.1 7 Stable tag: 1.4. 57 Stable tag: 1.4.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 51 51 52 52 == Changelog == 53 = 1.4.6 = 54 * Fixed vulnerabilities in option saving function, not allowing unescaped user input and checking user role 55 53 56 = 1.4.5 = 54 57 * Tested with Wordpress 6.1.1
Note: See TracChangeset
for help on using the changeset viewer.