Make WordPress Core


Ignore:
Timestamp:
10/04/2006 12:18:28 PM (19 years ago)
Author:
markjaquith
Message:

Prevent non-option form elements from sneaking in to the options table. fixes #2595

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options.php

    r4330 r4332  
    8989    check_admin_referer('update-options');
    9090
    91     if (!$_POST['page_options']) {
    92         foreach ($_POST as $key => $value) {
    93             $options[] = $key;
     91    if ( !$_POST['page_options'] ) {
     92        foreach ( (array) $_POST as $key => $value) {
     93            if ( !in_array($key, array('_wpnonce', '_wp_http_referer')) )
     94                $options[] = $key;
    9495        }
    9596    } else {
     
    123124<?php
    124125$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
     126foreach ( (array) $options as $option )
     127    $options_to_update[] = $option->option_name;
     128$options_to_update = implode(',', $options_to_update);
     129?>
    125130
    126 foreach ($options as $option) :
     131<input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" />
     132
     133<?php
     134foreach ( (array) $options as $option) :
    127135    $value = wp_specialchars($option->option_value, 'single');
    128136    echo "
Note: See TracChangeset for help on using the changeset viewer.