Ticket #11969: theme-editor.2.diff
| File theme-editor.2.diff, 2.9 KB (added by scribu, 3 years ago) |
|---|
-
wp-admin/theme-editor.php
31 31 wp_die(__('The requested theme does not exist.')); 32 32 33 33 $allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']); 34 34 $requestedfile = $file; 35 35 if (empty($file)) { 36 36 $file = $allowed_files[0]; 37 37 } else { … … 55 55 56 56 $newcontent = stripslashes($_POST['newcontent']); 57 57 $theme = urlencode($theme); 58 59 $location = add_query_arg(array('file' => $requestedfile, 'theme' => $theme, 'scrollto' => $scrollto, 'dir' => $dir ), admin_url('theme-editor.php')); 60 58 61 if (is_writeable($file)) { 59 62 //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable 60 63 $f = fopen($file, 'w+'); 61 64 if ($f !== FALSE) { 62 65 fwrite($f, $newcontent); 63 66 fclose($f); 64 $location = "theme-editor.php?file=$file&theme=$theme&a=te&scrollto=$scrollto"; 65 } else { 66 $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto"; 67 $location = add_query_arg('a', 'te', $location); 67 68 } 68 } else {69 $location = "theme-editor.php?file=$file&theme=$theme&scrollto=$scrollto";70 69 } 71 70 72 71 $location = wp_kses_no_null($location); … … 169 168 ksort( $template_mapping ); 170 169 while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) : 171 170 ?> 172 <li><a href=" theme-editor.php?file=<?php echo "$template_file"; ?>&theme=<?php echo urlencode($theme) ?>&dir=theme"><?php echo $filedesc ?></a></li>171 <li><a href="<?php echo add_query_arg( array('file' => $template_file, 'theme' => urlencode($theme), 'dir' => 'theme'), admin_url('theme-editor.php') ); ?>"><?php echo $filedesc ?></a></li> 173 172 <?php endwhile; ?> 174 173 </ul> 175 174 <h3><?php /* translators: Theme stylesheets in theme editor */ echo _x('Styles', 'Theme stylesheets in theme editor'); ?></h3> … … 197 196 <?php wp_nonce_field('edit-theme_' . $file . $theme) ?> 198 197 <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1" class="codepress <?php echo $codepress_lang ?>"><?php echo $content ?></textarea> 199 198 <input type="hidden" name="action" value="update" /> 200 <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> 199 <input type="hidden" name="file" value="<?php echo esc_attr($requestedfile) ?>" /> 200 <input type="hidden" name="dir" value="<?php echo esc_attr($dir) ?>" /> 201 201 <input type="hidden" name="theme" value="<?php echo esc_attr($theme) ?>" /> 202 202 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 203 203 </div> 204 <?php if ( isset($functions ) && count($functions) ) { ?>204 <?php if ( !empty($functions) ) { ?> 205 205 <div id="documentation"> 206 206 <label for="docs-list"><?php _e('Documentation:') ?></label> 207 207 <?php echo $docs_select; ?>
