Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r4349 r3295  
    55$parent_file = 'themes.php';
    66
    7 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
     7$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
     8for ($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}
    822
    923$themes = get_themes();
     
    1731
    1832if ( ! isset($themes[$theme]) )
    19     wp_die(__('The requested theme does not exist.'));
     33    die(__('The requested theme does not exist.'));
    2034
    2135$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
     
    3448case 'update':
    3549
    36     check_admin_referer('edit-theme_' . $file . $theme);
    37 
    3850    if ( !current_user_can('edit_themes') )
    39         wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
     51    die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
    4052
    4153    $newcontent = stripslashes($_POST['newcontent']);
     
    4557        fwrite($f, $newcontent);
    4658        fclose($f);
    47         $location = "theme-editor.php?file=$file&theme=$theme&a=te";
     59        header("Location: theme-editor.php?file=$file&theme=$theme&a=te");
    4860    } else {
    49         $location = "theme-editor.php?file=$file&theme=$theme";
     61        header("Location: theme-editor.php?file=$file&theme=$theme");
    5062    }
    5163
    52     $location = wp_kses_no_null($location);
    53     $strip = array('%0d', '%0a');
    54     $location = str_replace($strip, '', $location);
    55     header("Location: $location");
    5664    exit();
    5765
     
    5967
    6068default:
    61 
     69   
     70    require_once('admin-header.php');
    6271    if ( !current_user_can('edit_themes') )
    63         wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
    64 
    65     require_once('admin-header.php');
     72    die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
    6673
    6774    update_recently_edited($file);
    68 
     75   
    6976    if (!is_file($real_file))
    7077        $error = 1;
    71 
     78   
    7279    if (!$error && filesize($real_file) > 0) {
    7380        $f = fopen($real_file, 'r');
     
    94101?>
    95102 </select>
    96  <input type="submit" name="Submit" value="<?php _e('Select &raquo;') ?>" class="button" />
     103 <input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
    97104 </form>
    98105 </div>
     
    123130    ?>
    124131  <form name="template" id="template" action="theme-editor.php" method="post">
    125   <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
    126132         <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
    127133     <input type="hidden" name="action" value="update" />
     
    132138     <p class="submit">
    133139<?php
    134     echo "<input type='submit' name='submit' value='    " . __('Update File &raquo;') . "' tabindex='2' />";
     140    echo "<input type='submit' name='submit' value='    " . __('Update File') . " &raquo;' tabindex='2' />";
    135141?>
    136142</p>
Note: See TracChangeset for help on using the changeset viewer.