]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/theme-editor.php
Wordpress 2.3.3
[autoinstalls/wordpress.git] / wp-admin / theme-editor.php
index 9aa846bfeed83daaed270682d2c2ced28fd4a9de..5541f31220fa214bd980298b98a1dd243486c2dc 100644 (file)
@@ -4,21 +4,7 @@ require_once('admin.php');
 $title = __("Edit Themes");
 $parent_file = 'themes.php';
 
 $title = __("Edit Themes");
 $parent_file = 'themes.php';
 
-$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
-for ($i=0; $i<count($wpvarstoreset); $i += 1) {
-       $wpvar = $wpvarstoreset[$i];
-       if (!isset($$wpvar)) {
-               if (empty($_POST["$wpvar"])) {
-                       if (empty($_GET["$wpvar"])) {
-                               $$wpvar = '';
-                       } else {
-                               $$wpvar = $_GET["$wpvar"];
-                       }
-               } else {
-                       $$wpvar = $_POST["$wpvar"];
-               }
-       }
-}
+wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
 
 $themes = get_themes();
 
 
 $themes = get_themes();
 
@@ -30,7 +16,7 @@ if (empty($theme)) {
 
 
 if ( ! isset($themes[$theme]) )
 
 
 if ( ! isset($themes[$theme]) )
-       die(__('The requested theme does not exist.'));
+       wp_die(__('The requested theme does not exist.'));
 
 $allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
 
 
 $allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
 
@@ -50,7 +36,7 @@ case 'update':
        check_admin_referer('edit-theme_' . $file . $theme);
 
        if ( !current_user_can('edit_themes') )
        check_admin_referer('edit-theme_' . $file . $theme);
 
        if ( !current_user_can('edit_themes') )
-       die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
+               wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
 
        $newcontent = stripslashes($_POST['newcontent']);
        $theme = urlencode($theme);
 
        $newcontent = stripslashes($_POST['newcontent']);
        $theme = urlencode($theme);
@@ -72,16 +58,17 @@ case 'update':
 break;
 
 default:
 break;
 
 default:
-       
-       require_once('admin-header.php');
+
        if ( !current_user_can('edit_themes') )
        if ( !current_user_can('edit_themes') )
-       die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
+               wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
+
+       require_once('admin-header.php');
 
        update_recently_edited($file);
 
        update_recently_edited($file);
-       
+
        if (!is_file($real_file))
                $error = 1;
        if (!is_file($real_file))
                $error = 1;
-       
+
        if (!$error && filesize($real_file) > 0) {
                $f = fopen($real_file, 'r');
                $content = fread($f, filesize($real_file));
        if (!$error && filesize($real_file) > 0) {
                $f = fopen($real_file, 'r');
                $content = fread($f, filesize($real_file));
@@ -93,7 +80,7 @@ default:
  <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
 <?php endif; ?>
  <div class="wrap">
  <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
 <?php endif; ?>
  <div class="wrap">
-  <form name="theme" action="theme-editor.php" method="post"> 
+       <form name="theme" action="theme-editor.php" method="post">
                <?php _e('Select theme to edit:') ?>
                <select name="theme" id="theme">
        <?php
                <?php _e('Select theme to edit:') ?>
                <select name="theme" id="theme">
        <?php
@@ -106,11 +93,11 @@ default:
        }
 ?>
  </select>
        }
 ?>
  </select>
- <input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
+ <input type="submit" name="Submit" value="<?php _e('Select &raquo;') ?>" class="button" />
  </form>
  </div>
 
  </form>
  </div>
 
- <div class="wrap"> 
+ <div class="wrap">
   <?php
        if ( is_writeable($real_file) ) {
                echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file_show) . '</h2>';
   <?php
        if ( is_writeable($real_file) ) {
                echo '<h2>' . sprintf(__('Editing <code>%s</code>'), $file_show) . '</h2>';
@@ -119,47 +106,47 @@ default:
        }
        ?>
        <div id="templateside">
        }
        ?>
        <div id="templateside">
-  <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
+       <h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
 
 <?php
 if ($allowed_files) :
 ?>
 
 <?php
 if ($allowed_files) :
 ?>
-  <ul>
+       <ul>
 <?php foreach($allowed_files as $allowed_file) : ?>
                 <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
 <?php endforeach; ?>
 <?php foreach($allowed_files as $allowed_file) : ?>
                 <li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
 <?php endforeach; ?>
-  </ul>
+       </ul>
 <?php endif; ?>
 <?php endif; ?>
-</div> 
+</div>
        <?php
        if (!$error) {
        <?php
        if (!$error) {
-       ?> 
-  <form name="template" id="template" action="theme-editor.php" method="post">
-  <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
-                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea> 
-     <input type="hidden" name="action" value="update" /> 
-     <input type="hidden" name="file" value="<?php echo $file ?>" /> 
-     <input type="hidden" name="theme" value="<?php echo $theme ?>" />
+       ?>
+       <form name="template" id="template" action="theme-editor.php" method="post">
+       <?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
+                <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
+                <input type="hidden" name="action" value="update" />
+                <input type="hidden" name="file" value="<?php echo $file ?>" />
+                <input type="hidden" name="theme" value="<?php echo $theme ?>" />
                 </div>
 <?php if ( is_writeable($real_file) ) : ?>
                 </div>
 <?php if ( is_writeable($real_file) ) : ?>
-     <p class="submit">
+       <p class="submit">
 <?php
 <?php
-       echo "<input type='submit' name='submit' value='        " . __('Update File') . " &raquo;' tabindex='2' />";
+       echo "<input type='submit' name='submit' value='        " . __('Update File &raquo;') . "' tabindex='2' />";
 ?>
 </p>
 <?php else : ?>
 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
 <?php endif; ?>
 ?>
 </p>
 <?php else : ?>
 <p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
 <?php endif; ?>
-   </form> 
-  <?php
+       </form>
+       <?php
        } else {
                echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
        }
        ?>
 <div class="clear"> &nbsp; </div>
        } else {
                echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
        }
        ?>
 <div class="clear"> &nbsp; </div>
-</div> 
+</div>
 <?php
 break;
 }
 
 <?php
 break;
 }
 
-include("admin-footer.php") ?> 
+include("admin-footer.php") ?>