Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/theme-editor.php

    r3295 r4349  
    55$parent_file = 'themes.php';
    66
    7 $wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
    8 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    9     $wpvar = $wpvarstoreset[$i];
    10     if (!isset($$wpvar)) {
    11         if (empty($_POST["$wpvar"])) {
    12             if (empty($_GET["$wpvar"])) {
    13                 $$wpvar = '';
    14             } else {
    15                 $$wpvar = $_GET["$wpvar"];
    16             }
    17         } else {
    18             $$wpvar = $_POST["$wpvar"];
    19         }
    20     }
    21 }
     7wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
    228
    239$themes = get_themes();
     
    3117
    3218if ( ! isset($themes[$theme]) )
    33     die(__('The requested theme does not exist.'));
     19    wp_die(__('The requested theme does not exist.'));
    3420
    3521$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
     
    4834case 'update':
    4935
     36    check_admin_referer('edit-theme_' . $file . $theme);
     37
    5038    if ( !current_user_can('edit_themes') )
    51     die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
     39        wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
    5240
    5341    $newcontent = stripslashes($_POST['newcontent']);
     
    5745        fwrite($f, $newcontent);
    5846        fclose($f);
    59         header("Location: theme-editor.php?file=$file&theme=$theme&a=te");
     47        $location = "theme-editor.php?file=$file&theme=$theme&a=te";
    6048    } else {
    61         header("Location: theme-editor.php?file=$file&theme=$theme");
     49        $location = "theme-editor.php?file=$file&theme=$theme";
    6250    }
    6351
     52    $location = wp_kses_no_null($location);
     53    $strip = array('%0d', '%0a');
     54    $location = str_replace($strip, '', $location);
     55    header("Location: $location");
    6456    exit();
    6557
     
    6759
    6860default:
    69    
     61
     62    if ( !current_user_can('edit_themes') )
     63        wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
     64
    7065    require_once('admin-header.php');
    71     if ( !current_user_can('edit_themes') )
    72     die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
    7366
    7467    update_recently_edited($file);
    75    
     68
    7669    if (!is_file($real_file))
    7770        $error = 1;
    78    
     71
    7972    if (!$error && filesize($real_file) > 0) {
    8073        $f = fopen($real_file, 'r');
     
    10194?>
    10295 </select>
    103  <input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
     96 <input type="submit" name="Submit" value="<?php _e('Select &raquo;') ?>" class="button" />
    10497 </form>
    10598 </div>
     
    130123    ?>
    131124  <form name="template" id="template" action="theme-editor.php" method="post">
     125  <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
    132126         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
    133127     <input type="hidden" name="action" value="update" />
     
    138132     <p class="submit">
    139133<?php
    140     echo "<input type='submit' name='submit' value='    " . __('Update File') . " &raquo;' tabindex='2' />";
     134    echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
    141135?>
    142136</p>
Note: See TracChangeset for help on using the changeset viewer.