Changeset 41
- Timestamp:
- 05/23/2003 12:12:22 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/b2template.php
r40 r41 38 38 switch($action) { 39 39 40 case "update":40 case 'update': 41 41 42 $standalone =1;43 require _once("./b2header.php");42 $standalone = 1; 43 require("b2header.php"); 44 44 45 45 if ($user_level < 3) { 46 die( "You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");46 die('<p>You have no right to edit the template for this blog.<br />Ask for a promotion to your <a href="mailto:$admin_email">blog admin</a>. :)</p>'); 47 47 } 48 48 49 49 $newcontent = stripslashes($HTTP_POST_VARS["newcontent"]); 50 50 $file = $HTTP_POST_VARS["file"]; 51 $f = fopen($file, "w+");52 fwrite($f, $newcontent);51 $f = fopen($file, 'w+'); 52 fwrite($f, $newcontent); 53 53 fclose($f); 54 54 55 $file = str_replace('../', '', $file); 55 56 header("Location: b2template.php?file=$file&a=te"); 56 57 exit(); … … 60 61 default: 61 62 62 include("./b2header.php");63 require('b2header.php'); 63 64 64 65 if ($user_level <= 3) { 65 die( "You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");66 die('<p>You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href="mailto:$admin_email">blog admin</a>. :)</p>'); 66 67 } 67 68 68 if ( $file=="") {69 if ( $blogfilename != "") {69 if ('' == $file) { 70 if ('' != $blogfilename) { 70 71 $file = $blogfilename; 71 72 } else { 72 $file = "b2.php";73 $file = 'index.php'; 73 74 } 74 75 } 75 76 76 if ( substr($file,0,2) == "..")77 die ( "Sorry, can't edit files that are up one directory or more.");77 if ('..' == substr($file,0,2)) 78 die ('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'); 78 79 79 if ( substr($file,1,1) == ":")80 die ( "Sorry, can't call files with their real path.");80 if (':' == substr($file,1,1)) 81 die ('Sorry, can’t call files with their real path.'); 81 82 82 if (substr($file,0,1) == "/") 83 $file = ".".$file; 83 if ('/' == substr($file,0,1)) 84 $file = '.' . $file; 85 86 $file = stripslashes($file); 87 $file = '../' . $file; 84 88 85 89 if (!is_file($file)) 86 90 $error = 1; 87 91 88 $file = stripslashes($file); 89 90 if ((substr($file,0,2) == "b2") and (substr($file,-4,4) == ".php") and ($file != "b2.php")) 91 $warning = " - this is a b2 file, be careful when editing it !"; 92 92 if ((substr($file,0,2) == 'b2') and (substr($file,-4,4) == '.php') and ($file != 'b2.php')) 93 $warning = ' — this is a WordPress file, be careful when editing it!'; 94 93 95 if (!$error) { 94 $f = fopen($file,"r"); 95 $content = fread($f,filesize($file)); 96 // $content = template_simplify($content); 96 $f = fopen($file, 'r'); 97 $content = fread($f, filesize($file)); 97 98 $content = htmlspecialchars($content); 98 99 // $content = str_replace("</textarea","</textarea",$content); 99 100 } 100 101 101 echo $blankline;102 echo $tabletop;103 102 ?> 104 <table width="100%" cellpadding="5" cellspacing="0"> 105 <tr> 106 <td> 103 <div class="wrap"> 107 104 <?php 108 echo "Listing < b>$file</b>".$warning;109 if ( $a == "te")110 echo "< i> [ file edited ! ]</i>";105 echo "Listing <strong>$file</strong> $warning"; 106 if ('te' == $a) 107 echo "<em>File edited successfully.</em>"; 111 108 112 109 if (!$error) { … … 127 124 <?php 128 125 } else { 129 echo "<p>oops, no such file !</p>";126 echo '<p>Oops, no such file exists! Double check the name and try again, merci.</p>'; 130 127 } 131 echo $tablebottom;132 128 ?> 133 </td> 134 </table> 135 <br /> 136 <?php echo $tabletop; ?> 137 You can also edit the <a href="b2template.php?file=b2comments.php">comments' template</a> or the <a href="b2template.php?file=b2commentspopup.php">popup comments' template</a>, or edit any other file (provided it's writable by the server, e.g. CHMOD 766).<br /> 138 <br /> 139 To edit a file, type its name here: 140 <form name="file" action="b2template.php" method="get"> 129 </div> 130 131 <div class="wrap"> 132 <p>You can also edit the <a href="b2template.php?file=b2comments.php">comments 133 template</a> or the <a href="b2template.php?file=b2commentspopup.php">popup 134 comments template</a>, or edit any other file (provided it’s writable by 135 the server, e.g. CHMOD 766).</p> 136 <p>To edit a file, type its name here:</p> 137 <form name="file" action="b2template.php" method="get"> 141 138 <input type="text" name="file" /> 142 139 <input type="submit" name="submit" class="search" value="go" /> 143 140 </form> 144 <br />145 Note: of course, you can also edit the files/templates in your text editor and upload them. This online editor is only meant to be used when you don't have access to a text editor...146 141 147 <?php echo $tablebottom; ?> 142 <p>Note: of course, you can also edit the files/templates in your text editor 143 and upload them. This online editor is only meant to be used when you don't 144 have access to a text editor.</p> 145 </div> 148 146 149 147
Note: See TracChangeset
for help on using the changeset viewer.