<?
########## 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(!$shProps)
{
    header("Location: index.php");
}

$fullpath = $shProps;
$path = str_replace(($pathfilename),"",$shProps);
$pathfilename = explode("/",$shProps);
$pathfilename = array_pop($pathfilename);  ## get last chunk
$path = dirname($fullpath);

if($ftp->ftp_chdir($path) && $ftp->ftp_file_exists($pathfilename)) {

  $ftp_dirlist = $ftp->ftp_rawlist("$path");

  if($ftp_dirlist != "") {
  	$dirlist = parse_ftp_rawlist($ftp_dirlist);
  	for($i=1;$i<=count($dirlist);$i++) {
	  	if(!strcmp($pathfilename,$dirlist[$i]['name'])){	  
        	$showProps[1] = $dirlist[$i];
			break;
      	}
    }
  }
?>
  <form ACTION="ftp_index.php" METHOD="POST" name="set_props">
  <input type="hidden" name="shProps" value="<?= htmlspecialchars($fullpath) ?>">
  <input type="hidden" name="path" value="<?= htmlspecialchars($path) ?>">
  <input type="hidden" name="oldPath" value="<?= htmlspecialchars($path) ?>">
  <input type="hidden" name="oldName" value="<?= htmlspecialchars($showProps[1]['name']) ?>">
  <input type="hidden" name="isDir" value="<?= htmlspecialchars($showProps[1]['is_dir']) ?>">
  <input type="hidden" name="oldPerms" value="<?= htmlspecialchars($showProps[1]['octal']) ?>">
  <input type="hidden" name="setProps" value="1">
  <table class="tblbgcolor" width="100%" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
  <tr>
  <td><? echo $lang_text['wftp_propsfrom'] ?></td>
  <td colspan="2"><input type="text" value="<?= htmlspecialchars($showProps[1]['name']) ?>" name="newName"></td>
  </tr>
  <tr>
  <td><? echo $lang_text['wftp_fullpath'] ?></td>
  <td colspan="2"><?= htmlspecialchars($fullpath) ?></td>
  </tr>
  <tr>
  <td><? echo $lang_text['wftp_owner'] ?></td>
  <td colspan="2"><?= htmlspecialchars($showProps[1]['user']) ?></td>
  </tr>
  <tr>
  <td><? echo $lang_text['wftp_group'] ?></td>
  <td colspan="2"><?= htmlspecialchars($showProps[1]['group']) ?></td>
  </tr>
  <tr>
  <td><? echo $lang_text['wftp_size'] ?></td>
  <td colspan="2"><?= htmlspecialchars($showProps[1]['size']) ?></td>
  </tr>
  <tr>
  <td><? echo $lang_text['wftp_date'] ?></td>
  <td colspan="2"><?= htmlspecialchars($showProps[1]['date']) ?></td>
  </tr>
  <tr>
  <td valign="top"><? echo $lang_text['wftp_perms'] ?></td>
  <td colspan="2">
    <table class="tblbgcolor" width="250" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
    <tr>
    <td width="25%">&nbsp;</td>
    <td width="25%" align="center"><? echo $lang_text['wftp_read'] ?></td>
    <td width="25%" align="center"><? echo $lang_text['wftp_write'] ?></td>
    <td width="25%" align="center"><? echo $lang_text['wftp_execute'] ?></td>
    </tr>
    <tr>
    <td><? echo $lang_text['wftp_owner'] ?></td>
    <td align="center"><input type=checkbox name="owner1"<? if(substr(($showProps[1]['perms']),1,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="owner2"<? if(substr(($showProps[1]['perms']),2,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="owner3"<? if(substr(($showProps[1]['perms']),3,1) != "-") echo " checked"; ?>></td>
    </tr>
    <tr>
    <td><? echo $lang_text['wftp_group'] ?></td>
    <td align="center"><input type=checkbox name="group1"<? if(substr(($showProps[1]['perms']),4,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="group2"<? if(substr(($showProps[1]['perms']),5,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="group3"<? if(substr(($showProps[1]['perms']),6,1) != "-") echo " checked"; ?>></td>
    </tr>
    <tr>
    <td><? echo $lang_text['wftp_other'] ?></td>
    <td align="center"><input type=checkbox name="other1"<? if(substr(($showProps[1]['perms']),7,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="other2"<? if(substr(($showProps[1]['perms']),8,1) != "-") echo " checked"; ?>></td>
    <td align="center"><input type=checkbox name="other3"<? if(substr(($showProps[1]['perms']),9,1) != "-") echo " checked"; ?>></td>
    </tr>
    <tr>
    <td><? echo $lang_text['wftp_direct'] ?></td>
    <td colspan="3"><input type="text" name="directPerms" value="<?= htmlspecialchars($showProps[1]['octal']) ?>" size="4" maxlength="3"></td>
    </tr>
    </table>
  </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(ltext("wftp_submit"), 'javascript:document.forms[0].submit()'); ?></td>
  </tr>
  </table>
  </form>
<?
} else {
  addInfoBoxMsg($lang_text["wftp_chdir_notfound"],"|%fullpath%","|$fullpath");
  showInfoBox();
}

include("ftp_footer.php");
?>
