Plugin Directory

Changeset 2707108


Ignore:
Timestamp:
04/08/2022 03:47:58 PM (4 years ago)
Author:
mmuro
Message:

Update Entries table with CSRF protection

Location:
visual-form-builder/trunk/admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • visual-form-builder/trunk/admin/class-admin-menu.php

    r2617887 r2707108  
    265265        <form id="entries-filter" method="post" action="">
    266266        <?php
    267             $entries_list->search_box( 'search', 'search_id' );
    268             $entries_list->display();
     267            $entries_list->search_box( 'search', 'search_id' );
     268            $entries_list->display();
    269269        ?>
    270270        </form>
  • visual-form-builder/trunk/admin/class-entries-detail.php

    r2624218 r2707108  
    1515    public function entries_detail() {
    1616        global $wpdb;
     17
     18        check_admin_referer( 'vfb_view_entry' );
    1719
    1820        $entry_id = absint( $_GET['entry'] );
     
    6668                                <div id="major-publishing-actions">
    6769                                    <div id="delete-action">
    68                                         <?php echo sprintf( '<a class="submitdelete deletion entry-delete" href="%2$s&action=%3$s&entry=%4$d">%1$s</a>', __( 'Move to Trash', 'visual-form-builder' ), admin_url( 'admin.php?page=vfb-entries' ), 'trash', $entry_id ); ?>
     70                                        <?php echo sprintf( '<a class="submitdelete deletion entry-delete" href="%2$s&action=%3$s&entry=%4$d">%1$s</a>', __( 'Move to Trash', 'visual-form-builder' ), wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_trash_entry' ), 'trash', $entry_id ); ?>
    6971                                    </div>
    7072                                    <div id="publishing-action">
  • visual-form-builder/trunk/admin/class-entries-list.php

    r2624218 r2707108  
    5454        // Build row actions
    5555        if ( !$this->get_entry_status() || 'all' == $this->get_entry_status() )
    56             $actions['view'] = sprintf( '<a href="%s&action=%s&entry=%s" id="%3$s" class="view-entry">View</a>', admin_url( 'admin.php?page=vfb-entries' ), 'view', $item['entry_id'] );
     56            $actions['view'] = sprintf( '<a href="%s&action=%s&entry=%s" id="%3$s" class="view-entry">View</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_view_entry' ), 'view', $item['entry_id'] );
    5757
    5858        if ( !$this->get_entry_status() || 'all' == $this->get_entry_status() )
    59             $actions['trash'] = sprintf( '<a href="%s&action=%s&entry=%s">Trash</a>', admin_url( 'admin.php?page=vfb-entries' ), 'trash', $item['entry_id'] );
     59            $actions['trash'] = sprintf( '<a href="%s&action=%s&entry=%s">Trash</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_trash_entry' ), 'trash', $item['entry_id'] );
    6060        elseif ( $this->get_entry_status() && 'trash' == $this->get_entry_status() ) {
    61             $actions['restore'] = sprintf( '<a href="%s&action=%s&entry=%s">%s</a>', admin_url( 'admin.php?page=vfb-entries' ), 'restore', $item['entry_id'], __( 'Restore', 'visual-form-builder' ) );
    62             $actions['delete'] = sprintf( '<a href="%s&action=%s&entry=%s">%s</a>', admin_url( 'admin.php?page=vfb-entries' ), 'delete', $item['entry_id'], __( 'Delete Permanently', 'visual-form-builder' ) );
     61            $actions['restore'] = sprintf( '<a href="%s&action=%s&entry=%s">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_undo_trash_entry' ), 'restore', $item['entry_id'], __( 'Restore', 'visual-form-builder' ) );
     62            $actions['delete'] = sprintf( '<a href="%s&action=%s&entry=%s">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_delete_entry' ), 'delete', $item['entry_id'], __( 'Delete Permanently', 'visual-form-builder' ) );
    6363        }
    6464
     
    307307        switch( $this->current_action() ) :
    308308            case 'trash' :
     309                check_admin_referer( 'vfb_trash_entry' );
     310
    309311                foreach ( $entry_id as $id ) {
    310312                    $id = absint( $id );
     
    314316
    315317            case 'delete' :
     318                check_admin_referer( 'vfb_delete_entry' );
     319
    316320                foreach ( $entry_id as $id ) {
    317321                    $id = absint( $id );
     
    321325
    322326            case 'restore' :
     327                check_admin_referer( 'vfb_undo_trash_entry' );
     328
    323329                foreach ( $entry_id as $id ) {
    324330                    $id = absint( $id );
     
    328334
    329335            case 'delete' :
     336                check_admin_referer( 'vfb_delete_entry' );
     337
    330338                $entry_id = ( isset( $_GET['entry'] ) && is_array( $_GET['entry'] ) ) ? $_GET['entry'] : array( $_GET['entry'] );
    331339
  • visual-form-builder/trunk/admin/class-forms-edit.php

    r2705942 r2707108  
    1313    public function display() {
    1414        global $wpdb;
     15
     16        check_admin_referer( 'vfb_edit_form' );
    1517
    1618        $current_user = wp_get_current_user();
  • visual-form-builder/trunk/admin/class-forms-list.php

    r2617877 r2707108  
    5252
    5353        // Edit Form
    54         $form_title = sprintf( '<strong><a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a></strong>', admin_url( 'admin.php?page=visual-form-builder' ), 'edit', $item['form_id'], $item['form_title'] );
    55         $actions['edit'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', admin_url( 'admin.php?page=visual-form-builder' ), 'edit', $item['form_id'], __( 'Edit', 'visual-form-builder' ) );
     54        $edit_link = wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder' ), 'vfb_edit_form' );
     55        $form_title = sprintf( '<strong><a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a></strong>', $edit_link, 'edit', $item['form_id'], $item['form_title'] );
     56        $actions['edit'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', $edit_link, 'edit', $item['form_id'], __( 'Edit', 'visual-form-builder' ) );
    5657
    5758        // Duplicate Form
Note: See TracChangeset for help on using the changeset viewer.