]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/theme-editor.php
Wordpress 2.6.2
[autoinstalls/wordpress.git] / wp-admin / theme-editor.php
index f17a48c118549928abddf16dc5896820053a6f17..fa16d7db760bb22acd86198a4b3a6f961300e5c8 100644 (file)
@@ -6,10 +6,7 @@ $parent_file = 'themes.php';
 
 wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
 
-add_action( 'admin_head', 'theme_editor_css' );
-function theme_editor_css(){
-       wp_admin_css( 'css/theme-editor' );
-}
+wp_admin_css( 'theme-editor' );
 
 $themes = get_themes();
 
@@ -46,10 +43,15 @@ case 'update':
        $newcontent = stripslashes($_POST['newcontent']);
        $theme = urlencode($theme);
        if (is_writeable($real_file)) {
+               //is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
                $f = fopen($real_file, 'w+');
-               fwrite($f, $newcontent);
-               fclose($f);
-               $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+               if ($f !== FALSE) {
+                       fwrite($f, $newcontent);
+                       fclose($f);
+                       $location = "theme-editor.php?file=$file&theme=$theme&a=te";
+               } else {
+                       $location = "theme-editor.php?file=$file&theme=$theme";
+               }
        } else {
                $location = "theme-editor.php?file=$file&theme=$theme";
        }
@@ -92,7 +94,7 @@ $desc_header = ( $description != $file_show ) ? "$description</strong> (%s)" : "
 <div class="bordertitle">
        <h2><?php _e('Theme Editor'); ?></h2>
        <form id="themeselector" name="theme" action="theme-editor.php" method="post">
-               <strong><?php _e('Select theme to edit:'); ?> </strong>
+               <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
                <select name="theme" id="theme">
 <?php
        foreach ($themes as $a_theme) {