Plugin Directory

Changeset 2223036


Ignore:
Timestamp:
01/06/2020 06:43:33 PM (6 years ago)
Author:
indextwo
Message:

Security & guideline updates as per WP email

Location:
stylebidet
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • stylebidet/tags/0.6.0/assets/vnm-admin.css

    r2222053 r2223036  
    66*/
    77
    8 @import url('https://fonts.googleapis.com/css?family=Ubuntu:400,400i,500,500i');
    9 
    108/*
    119    ADMIN AREA
     
    1311
    1412.vnmadmin-wrapper {
    15     font-family:                            "Ubuntu", sans-serif;
    1613    color:                                  #2A3350;
    1714}
  • stylebidet/tags/0.6.0/stylebidet.php

    r2222053 r2223036  
    1111Copyright (C) 2010-2020 Lawrie Malen // Very New Media
    1212Created: 02-02-2010
    13 Updated: 03-01-2020
     13Updated: 06-01-2020
    1414
    1515*/
     
    160160function vnmStyleBidet_settingsPage() {
    161161   
     162    //  Let's get the options set in the db by default
     163   
     164    $optionsArray = vnmStyleBidet_getOptions();
     165   
     166    //  Let's check if any data has been posted
     167   
     168    $shouldUpdate = false;
    162169    $updated = false;
    163    
    164     //  Let's get the options set in the db by default
    165    
    166     $optionsArray = vnmStyleBidet_getOptions();
     170    $updateFailed = false;
     171   
     172    if (isset($_REQUEST['updateVNMStyleBidetSettings'])) {
     173       
     174        //  Does the current user have permission to complete this action?
     175       
     176        if (empty($_POST) || !check_admin_referer('vnm_stylebidet_nonce_action', 'stylebidet_admin_nonce') || !apply_filters('stylebidet_user_allowed', current_user_can('manage_options'))) {
     177            $updateFailed = true;
     178        }
     179       
     180        //  Does the nonce check pass?
     181       
     182        if (isset($_POST['nonce']) && sanitize_html_class($_POST['action']) === 'stylebidet_update_settings' && wp_verify_nonce(sanitize_html_class($_POST['nonce']), 'stylebidet_update_settings')) {
     183            $shouldUpdate = true;
     184        } else {
     185            $updateFailed = true;
     186        }
     187    }
    167188   
    168189    foreach ($optionsArray as $option=>$value) {
     
    170191        //  Save, if required
    171192       
    172         if (isset($_REQUEST['updateVNMStyleBidetSettings'])) {
     193        if ($shouldUpdate) {
    173194            if (array_key_exists($option, $_POST)) {
    174                 if ($_POST[$option]) {
    175                    
    176                     update_option('vnmStyleBidet_' . $option, 1);   // We can assume it's 'on'
     195                if (isset($_POST[$option]) && sanitize_html_class($_POST[$option]) === 'on') {
     196                   
     197                    update_option('vnmStyleBidet_' . $option, 1);   // It's checked, so we switch the option on
    177198                   
    178199                } else {
    179200                   
    180                     update_option('vnmStyleBidet_' . $option, 0);   // We can assume it's unchecked
     201                    update_option('vnmStyleBidet_' . $option, 0);   // It's unchecked, so switch the option off
    181202                   
    182203                }
     
    258279        <?php endif; ?>
    259280       
     281        <?php if ($updateFailed) : ?>
     282            <section class="wrapper updated">
     283                <div class="padded-section">
     284                    <span class="dashicons dashicons-warning notice-icon secondarycolor"></span>
     285                    <?php _e('Uh oh, it looks like you can\'t do that.', 'styebidet'); ?>
     286                </div>
     287            </section>
     288        <?php endif; ?>
     289       
    260290        <?php
    261291            ///
     
    277307            <div class="padded-section">
    278308                <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=vnmStyleBidetSettings" class="form" method="post">
    279                        
     309                   
     310                    <input type="hidden" name="action" value="stylebidet_update_settings" />
     311                    <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('stylebidet_update_settings'); ?>" />
     312                    <?php wp_nonce_field('vnm_stylebidet_nonce_action','stylebidet_admin_nonce' ); ?>
     313                   
    280314                    <table class="form-table">
    281315                       
     
    434468            <div class="vnm-rating-request box">
    435469                <?php
    436                     /*printf(
     470                    printf(
    437471                        __('Is StyleBidet making your life a little easier? %sWhy not leave us a %s review?%s %s', 'stylebidet'),
    438                         '<a href="thing" target="_blank">',
     472                        '<a href="https://wordpress.org/plugins/stylebidet/" target="_blank">',
    439473                        '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>',
    440474                        '</a>',
    441475                        '<span class="dashicons dashicons-smiley"></span>'
    442                     );*/
     476                    );
    443477                ?>
    444478            </div>
     
    479513        //  Include htmLawed (this is pretty much only used for <font> & inline style tags
    480514       
    481         include_once('includes/htmlLawed.php');
     515        if (!function_exists('htmLawed')) {
     516            include_once('includes/htmlLawed.php');
     517        }
    482518       
    483519        //  Adding a 'nonsense' value so that at lest there's something in the array
  • stylebidet/trunk/assets/vnm-admin.css

    r2222053 r2223036  
    66*/
    77
    8 @import url('https://fonts.googleapis.com/css?family=Ubuntu:400,400i,500,500i');
    9 
    108/*
    119    ADMIN AREA
     
    1311
    1412.vnmadmin-wrapper {
    15     font-family:                            "Ubuntu", sans-serif;
    1613    color:                                  #2A3350;
    1714}
  • stylebidet/trunk/stylebidet.php

    r2222053 r2223036  
    1111Copyright (C) 2010-2020 Lawrie Malen // Very New Media
    1212Created: 02-02-2010
    13 Updated: 03-01-2020
     13Updated: 06-01-2020
    1414
    1515*/
     
    160160function vnmStyleBidet_settingsPage() {
    161161   
     162    //  Let's get the options set in the db by default
     163   
     164    $optionsArray = vnmStyleBidet_getOptions();
     165   
     166    //  Let's check if any data has been posted
     167   
     168    $shouldUpdate = false;
    162169    $updated = false;
    163    
    164     //  Let's get the options set in the db by default
    165    
    166     $optionsArray = vnmStyleBidet_getOptions();
     170    $updateFailed = false;
     171   
     172    if (isset($_REQUEST['updateVNMStyleBidetSettings'])) {
     173       
     174        //  Does the current user have permission to complete this action?
     175       
     176        if (empty($_POST) || !check_admin_referer('vnm_stylebidet_nonce_action', 'stylebidet_admin_nonce') || !apply_filters('stylebidet_user_allowed', current_user_can('manage_options'))) {
     177            $updateFailed = true;
     178        }
     179       
     180        //  Does the nonce check pass?
     181       
     182        if (isset($_POST['nonce']) && sanitize_html_class($_POST['action']) === 'stylebidet_update_settings' && wp_verify_nonce(sanitize_html_class($_POST['nonce']), 'stylebidet_update_settings')) {
     183            $shouldUpdate = true;
     184        } else {
     185            $updateFailed = true;
     186        }
     187    }
    167188   
    168189    foreach ($optionsArray as $option=>$value) {
     
    170191        //  Save, if required
    171192       
    172         if (isset($_REQUEST['updateVNMStyleBidetSettings'])) {
     193        if ($shouldUpdate) {
    173194            if (array_key_exists($option, $_POST)) {
    174                 if ($_POST[$option]) {
    175                    
    176                     update_option('vnmStyleBidet_' . $option, 1);   // We can assume it's 'on'
     195                if (isset($_POST[$option]) && sanitize_html_class($_POST[$option]) === 'on') {
     196                   
     197                    update_option('vnmStyleBidet_' . $option, 1);   // It's checked, so we switch the option on
    177198                   
    178199                } else {
    179200                   
    180                     update_option('vnmStyleBidet_' . $option, 0);   // We can assume it's unchecked
     201                    update_option('vnmStyleBidet_' . $option, 0);   // It's unchecked, so switch the option off
    181202                   
    182203                }
     
    258279        <?php endif; ?>
    259280       
     281        <?php if ($updateFailed) : ?>
     282            <section class="wrapper updated">
     283                <div class="padded-section">
     284                    <span class="dashicons dashicons-warning notice-icon secondarycolor"></span>
     285                    <?php _e('Uh oh, it looks like you can\'t do that.', 'styebidet'); ?>
     286                </div>
     287            </section>
     288        <?php endif; ?>
     289       
    260290        <?php
    261291            ///
     
    277307            <div class="padded-section">
    278308                <form action="<?php echo $_SERVER['PHP_SELF']; ?>?page=vnmStyleBidetSettings" class="form" method="post">
    279                        
     309                   
     310                    <input type="hidden" name="action" value="stylebidet_update_settings" />
     311                    <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('stylebidet_update_settings'); ?>" />
     312                    <?php wp_nonce_field('vnm_stylebidet_nonce_action','stylebidet_admin_nonce' ); ?>
     313                   
    280314                    <table class="form-table">
    281315                       
     
    434468            <div class="vnm-rating-request box">
    435469                <?php
    436                     /*printf(
     470                    printf(
    437471                        __('Is StyleBidet making your life a little easier? %sWhy not leave us a %s review?%s %s', 'stylebidet'),
    438                         '<a href="thing" target="_blank">',
     472                        '<a href="https://wordpress.org/plugins/stylebidet/" target="_blank">',
    439473                        '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>',
    440474                        '</a>',
    441475                        '<span class="dashicons dashicons-smiley"></span>'
    442                     );*/
     476                    );
    443477                ?>
    444478            </div>
     
    479513        //  Include htmLawed (this is pretty much only used for <font> & inline style tags
    480514       
    481         include_once('includes/htmlLawed.php');
     515        if (!function_exists('htmLawed')) {
     516            include_once('includes/htmlLawed.php');
     517        }
    482518       
    483519        //  Adding a 'nonsense' value so that at lest there's something in the array
Note: See TracChangeset for help on using the changeset viewer.