Plugin Directory

Changeset 2947741


Ignore:
Timestamp:
08/04/2023 01:15:47 PM (3 years ago)
Author:
addatwork
Message:

Added CSRF for reset option

Location:
poeditor/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • poeditor/trunk/poeditor.php

    r2946675 r2947741  
    44    Plugin URI: https://poeditor.com/
    55    Description: This plugin will let you manage your POEditor translations directly from Wordpress via the POEditor API.
    6     Version: 0.9.7
     6    Version: 0.9.8
    77    Author: POEditor
    88    Author URI: https://poeditor.com/
     
    619619         * This method deletes all data that has been written by the plugin from the database
    620620         */
    621         function clean() {
    622             delete_option('poeditor_apikey');
    623             delete_option('poeditor_assingments');
    624             delete_option('poeditor_projects');
    625             delete_option('poeditor_languages');
    626             delete_option('poeditor_files');
    627 
    628             $this->_setFlashMessage(__('The plugin has been reset successfully', 'poeditor'), 'updated');
    629             wp_redirect(POEDITOR_PATH);
    630         }
     621        function clean() {
     622            if (!wp_verify_nonce( $_POST['_wpnonce'], 'reset_nonce' )) {
     623                return $this->CSRFErrorPage();
     624            }
     625
     626            delete_option('poeditor_apikey');
     627            delete_option('poeditor_assingments');
     628            delete_option('poeditor_projects');
     629            delete_option('poeditor_languages');
     630            delete_option('poeditor_files');
     631
     632            $this->_setFlashMessage(__('The plugin has been reset successfully', 'poeditor'), 'updated');
     633            wp_redirect(POEDITOR_PATH);
     634        }
    631635
    632636        //method for hooks
  • poeditor/trunk/readme.txt

    r2946675 r2947741  
    55Requires at least: 3.5
    66Tested up to: 6.2
    7 Stable tag: 0.9.7
     7Stable tag: 0.9.8
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • poeditor/trunk/views/changeApiKey.php

    r2945858 r2947741  
    99
    1010        <form action="<?php echo POEDITOR_PATH;?>&amp;do=setApiKey" method="post">
    11             <?= wp_nonce_field('setApiKey_nonce'); ?>
     11            <?php wp_nonce_field('setApiKey_nonce'); ?>
    1212
    1313            <p>
  • poeditor/trunk/views/index.php

    r2946675 r2947741  
    77    <div id="poeditorTopLinks">
    88        <a class="button-secondary" href="<?php echo POEDITOR_PATH;?>&amp;do=changeApiKey"><?php esc_html_e( 'Change API Key', 'poeditor' ); ?></a>
     9
    910        <a class="button-secondary poeditorReset" href="#reset" title="<?php esc_attr_e( 'Disconnect plugin from linked POEditor account', 'poeditor' ); ?>"><?php esc_html_e( 'Reset plugin', 'poeditor' ); ?></a>
    1011    </div>
     
    121122                            <a href="#addLanguage" class="addLanguageButton button-secondary" rel="<?php echo esc_attr($project['id']);?>">+ <?php echo $project_new_language ;?></a>
    122123                            <form action="<?php echo POEDITOR_PATH;?>&amp;do=addLanguage" class="addLanguage" id="<?php echo esc_attr('addLanguage_' . $project['id']);?>" method="post">
    123                                 <?= wp_nonce_field('addLang_nonce'); ?>
     124                                <?php wp_nonce_field('addLang_nonce'); ?>
    124125
    125126                                <select name="language">
     
    163164                    <a href="#addProject" class="addProjectButton button-secondary">+ <?php esc_html_e('Create project', 'poeditor'); ?></a>
    164165                    <form action="<?php echo POEDITOR_PATH;?>&amp;do=addProject" class="addProject" method="post">
    165                         <?= wp_nonce_field('createProj_nonce'); ?>
     166                        <?php wp_nonce_field('createProj_nonce'); ?>
    166167
    167168                        <input type="text" name="project" id="projectNameInput">
     
    200201
    201202        <form action="<?php echo POEDITOR_PATH;?>&amp;do=addProject" class="addProject" method="post">
    202             <?= wp_nonce_field('createProj_nonce'); ?>
     203            <?php wp_nonce_field('createProj_nonce'); ?>
    203204
    204205            <input type="text" name="project" id="projectNameInput">
     
    448449    </p>
    449450
    450     <div id="resetConfirm">
    451         <h4>
    452             <?php esc_html_e('Are you sure you want to reset the plugin?', 'poeditor'); ?>
    453         </h4>
    454         <p>
    455             <?php $text_content = printf(__('This will delete all your local file assignments and it will detach your Wordpress installation from you account on %s', 'poeditor'),'POEditor.com'); ?>
    456             <?php echo esc_html($text_content) ?>
    457         </p>
    458         <a href="#cancel" class="button button-primary" id="poeditorCancelReset"><?php esc_html_e('Cancel', 'poeditor'); ?></a>
    459         <a href="<?php echo POEDITOR_PATH;?>&amp;do=clean" class="button button-primary" id="poeditorProceedWithReset"><?php esc_html_e('Reset', 'poeditor'); ?></a>
    460     </div>
     451    <form action="<?php echo POEDITOR_PATH;?>&amp;do=clean" method="post">
     452        <?php wp_nonce_field('reset_nonce'); ?>
     453
     454        <div id="resetConfirm">
     455            <h4>
     456                <?php esc_html_e('Are you sure you want to reset the plugin?', 'poeditor'); ?>
     457            </h4>
     458            <p>
     459                <?php $text_content = printf(__('This will delete all your local file assignments and it will detach your Wordpress installation from you account on %s', 'poeditor'),'POEditor.com'); ?>
     460                <?php echo esc_html($text_content) ?>
     461            </p>
     462            <a href="#cancel" class="button button-primary" id="poeditorCancelReset"><?php esc_html_e('Cancel', 'poeditor'); ?></a>
     463
     464            <button type="submit" class="button button-primary" id="poeditorProceedWithReset"><?php esc_html_e('Reset', 'poeditor'); ?></button>
     465        </div>
     466    </form>
    461467</div>
    462468<script src="<?php echo plugins_url( '_resources/js/jquery.base64.min.js' , __FILE__ );?>"></script>
  • poeditor/trunk/views/index_nokey.php

    r2945858 r2947741  
    1818
    1919        <form action="<?php echo POEDITOR_PATH;?>&amp;do=setApiKey" method="post">
    20             <?= wp_nonce_field('setApiKey_nonce'); ?>
     20            <?php wp_nonce_field('setApiKey_nonce'); ?>
    2121
    2222            <p>
Note: See TracChangeset for help on using the changeset viewer.