initial commit of file from CVS for smeserver-webshare on Sat Sep 7 21:15:27 AEST 2024
This commit is contained in:
69
root/opt/webshare-tools/phpfm/incl/edit.inc.php
Normal file
69
root/opt/webshare-tools/phpfm/incl/edit.inc.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
if (!@include_once("./incl/auth.inc.php"))
|
||||
include_once("../incl/auth.inc.php");
|
||||
|
||||
if ($AllowEdit && isset($_GET['save']) && isset($_POST['filename']))
|
||||
{
|
||||
$text = stripslashes($_POST['text']);
|
||||
|
||||
if (!is_valid_name(stripslashes($_POST['filename'])))
|
||||
print "<font color='#CC0000'>$StrFileInvalidName</font>";
|
||||
else if ($fp = @fopen ($home_directory.$path.stripslashes($_POST['filename']), "wb"))
|
||||
{
|
||||
fwrite($fp, $text);
|
||||
fclose($fp);
|
||||
print "<font color='#009900'>$StrSaveFileSuccess</font>";
|
||||
}
|
||||
else
|
||||
print "<font color='#CC0000'>$StrSaveFileFail</font>";
|
||||
|
||||
}
|
||||
|
||||
else if ($AllowEdit && isset($_GET['filename']))
|
||||
{
|
||||
print "<table class='index' width=800 cellpadding=0 cellspacing=0>";
|
||||
print "<tr>";
|
||||
print "<td class='iheadline' height=21>";
|
||||
print "<font class='iheadline'> $StrEditing \"".htmlentities($filename)."\"</font>";
|
||||
print "</td>";
|
||||
print "<td class='iheadline' align='right' height=21>";
|
||||
print "<font class='iheadline'><a href='$base_url&path=".htmlentities(rawurlencode($path))."'><img src='icon/back.gif' border=0 alt='$StrBack'></a></font>";
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
print "<tr>";
|
||||
print "<td valign='top' colspan=2>";
|
||||
|
||||
print "<center><br />";
|
||||
|
||||
if ($fp = @fopen($home_directory.$path.$filename, "rb"))
|
||||
{
|
||||
print "<form action='$base_url&output=edit&save=true' method='post'>";
|
||||
|
||||
print "<textarea cols=120 rows=20 name='text'>";
|
||||
print htmlentities(fread($fp, filesize($home_directory.$path.$filename)));
|
||||
fclose ($fp);
|
||||
print "</textarea>";
|
||||
|
||||
print "<br /><br />";
|
||||
print "$StrFilename <input size=40 name='filename' value=\"".htmlentities($filename)."\">";
|
||||
|
||||
print "<br /><br />";
|
||||
print "<input class='bigbutton' type='reset' value='$StrRestoreOriginal'> <input class='bigbutton' type='submit' value='$StrSaveAndExit'>";
|
||||
|
||||
print "<input type='hidden' name='path' value=\"".htmlentities($path)."\">";
|
||||
print "</form>";
|
||||
}
|
||||
else
|
||||
print "<font color='#CC0000'>$StrErrorOpeningFile</font>";
|
||||
|
||||
print "<br /><br /></center>";
|
||||
|
||||
print "</td>";
|
||||
print "</tr>";
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
print "<font color='#CC0000'>$StrAccessDenied</font>";
|
||||
|
||||
?>
|
Reference in New Issue
Block a user