<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

include_once("auth.php");
include("ftp_header.php");
if($edit) {
  if($edit != "new") {
    $fullpath = $edit;    
    $pathfilename = explode("/",$edit);
    $filename = $pathfilename[((count($pathfilename)-1))];
    $path = dirname($fullpath);
    $action_button = ltext("wftp_upload");
  }
  else {
  	$action_button = ltext("wftp_mkdir");
  }

  if($ftp->ftp_chdir($path)) {
    if($edit != "new") {
	$filecontent = $ftp->ftp_get($filename, $edit,1);
        //$filecontent = htmlentities($filecontent);
        $filecontent = htmlspecialchars($filecontent);
    }
    if(!$filesize || $filesize <= $maxEditSize) {
?>
<FORM METHOD="POST" ACTION="ftp_index.php?path=<?= urlencode($path) ?>">
<!--<INPUT TYPE="hidden" NAME="force" VALUE="">-->
<INPUT TYPE="hidden" NAME="path" VALUE="<? echo htmlspecialchars($path) ?>">
<INPUT TYPE="hidden" NAME="edit" VALUE="<? echo $edit ?>">
<table class="tblbgcolor" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<tr><td colspan="3">
<? echo $lang_text['wftp_filename'] ?>&nbsp;<INPUT NAME="editnew_filename" VALUE="<? echo $filename ?>" SIZE=30>
<table border=0 cellpadding=4 cellspacing=0>
<tr>
<td colspan=2 bgcolor="#EEEEEE" align=center>
<textarea rows=20 cols=80 wrap=virtual name="filecontent" style="width:430px"><? echo $filecontent ?></textarea>
</td>
</tr>
</table>
<? echo $lang_text['wftp_upload_force'] ?>&nbsp;<INPUT TYPE="checkbox" NAME="force" value="1"<? if($edit != "new") echo " checked"; ?>>
</td>
</tr>
<tr>
	<td align="center"><? echo std_button(ltext("wftp_back"), 'javascript:history.back()'); ?></td>
	<td align="center"><? echo std_button(ltext("wftp_reset"), 'javascript:document.forms[0].reset()'); ?></td>
	<td align="center"><? echo std_button($action_button, 'javascript:document.forms[0].submit()'); ?></td>
</tr>
</table>
</FORM>
<?
    } else {
      addInfoBoxMsg($lang_text['wftp_edit_filesize'],"|%maxfilesize%","|$maxEditSize");
    }
  } else {
    addInfoBoxMsg($lang_text["wftp_chdir_failed"],"|%fullpath%","|$path");
  }
  showInfoBox();
}

include("ftp_footer.php");
?>
