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

include_once( "../include/class.SQLString.php" );
include_once("auth.php");

## mysql verbindung aufbauen
db_connect($db_host, $db_user, $db_pass);
## /mysql verbindung aufbauen

$id = safe_query( "select maxftp, webmail, webftp, pwschutz, fehlerseiten, perl from kunden where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
$werte = db_fetch_array($id);
$maxftp = $werte["maxftp"];
$skwebmail = $werte["webmail"];
$skwebftp = $werte["webftp"];
$skfehlerseiten = $werte["fehlerseiten"];
$skpwschutz = $werte["pwschutz"];
$skperl = $werte["perl"];
## so viel darf noch eingerichtet werden + ftp benutzer in tabelle

$id = safe_query( "select account, pfad from ftp where kunde = ?  order by number", TRUE, new SQLString( $PHP_AUTH_USER ) );
$genutzteftp = db_num_rows($id);

if ($maxftp != "-1") { $freieftp = $maxftp - $genutzteftp; }
else { $freieftp = -1; }

## /so viel darf noch eingerichtet werden + ftp benutzer in tabelle

?>

<HTML>
<HEAD>
<META content="text/html; charset=<? echo $lang_html_charset; ?>" http-equiv=Content-Type>
<LINK href="<?=$strSkinName?>/style.css" rel=stylesheet type=text/css>
</HEAD>

<BODY bgColor=#ffffff bottomMargin=0 leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<br><? include("../fehler.inc.php"); ?>
<script>
<?
echo js_f_call_help('toft_title', 'toft_desc1');
?>
function doChange()
{
document.forms[0].submit();
}
</script>
<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<tr>
    <TD valign="top" colspan=4>
      <? echo ltext("toft_desc2", array($genutzteftp)); ?><br>
      <? 
if ($freieftp == "-1")
	{ echo ltext("toft_desc2a"); }
else 
	 { echo ltext("toft_desc2b", array($freieftp)); }
?>
      <? if ($genutzteftp > 0) {
?><br>
<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
	<tr><td colspan=4 class="titel-3" ><? echo ltext("toft_subtitle1"); ?></td></tr>
	<tr > 
          <td class="titel-3" >
            <? echo ltext("toft_cell_user"); ?>
            </td>
          <td class="titel-3" >
            <? echo ltext("toft_cell_dir"); ?>
            </td>
          <td class="titel-3" >
            <? echo ltext("toft_cell_action"); ?>
            </td>
          <td class="titel-3" >
            <? echo ltext("toft_cell_action"); ?>
            </td>
        </tr>
        <?
while ($werte = db_fetch_array($id))
	{
$account = $werte["account"];
$ftppfad = $werte["pfad"];
?>
        <tr > 
          <td > 
            <? echo $account; ?>
            </td>
          <td  align="left" >
	  /<? echo $ftppfad; ?>
            </td>
          <td align="center" ><a class=data href="tools_ftp_pwaendern.php?account=<? echo $account; ?>">
            <? echo ltext("toft_link_change"); ?>
            </a></td>
          <td align="center" ><a class=data href="tools_ftp_loeschen.php?account=<? echo $account; ?>">
            <? echo ltext("toft_link_del"); ?>
            </a></td>
        </tr>
        <? } ?>
      <? }
if (($freieftp > 0) || ($freieftp == "-1")) {
?>
        <tr > 
          <td colspan=2 class="titel-3" ><? echo ltext("topw_cell_dir"); ?></td>
          <td colspan=2 class="titel-3" ><? echo ltext("topw_cell_action"); ?></td>
        </tr>
<?
## html
echo '<tr><td colspan=2><img src="'.$strSkinName.'/file_icons/file_dir.gif"  height="16" border="0"> <a class=data href="tools_ftp.php?dir=/">html</a></td><td colspan=2>&nbsp;</td></tr>';

$id = safe_query( "select pfad, account from ftp where kunde = ? ", TRUE, new SQLString( $PHP_AUTH_USER ) );
while($werte = db_fetch_array($id))
	{
	 $pfade[] = $werte["pfad"];
	 $accounts[] = $werte["account"];
	}

if (substr($dir, 0, 1) != "/") $dir = "/".$dir;
$dir = "/$PHP_AUTH_USER/html".$dir;

$dirs = explode("/", $dir);
$i = 2;
$start = true;
$abbau = false;
while ($i > 1)
	{
	 $i1 = $i+1;
	 $listname = "lines".$i;
	 $startdir = "dir".$i;
	 if (istleer($$startdir)) $$startdir = 0;
	 if (!$abbau)
		{
		 $exec = $bindir."/lsdir.pl ";
		 for ($e = 1; $e <= $i; $e++) $exec .= "/".$dirs[$e];
		 exec($exec, $$listname, $return);
		}
	 if (count($$listname) > $$startdir)
		{
		 for ($n = $$startdir; $n < count($$listname); $n++)
			{
			 $leer =  ($i-1) * 16;
			 $link = "";
			 for ($e = 3; $e <= $i; $e++) $link .= "/".$dirs[$e];
			 $link .= "/".${$listname}[$n];
			 $protected = 0;
			 $account = "";
			 $link2 = $link;
			 while (ereg("^/", $link2)) $link2 = substr($link2, 1, (strlen($link2) -1));
			 if ($link2 == "cgi-bin") $protected = 1;
			 for ($z = 0; $z < count($pfade); $z++)
				{
				 $dbpfad = $werte["pfad"];
				 if ((ereg("^".$pfade[$z]."/", $link2."/")) || (ereg("^".$link2."/", $pfade[$z]."/"))) { 
					 $protected = 1;
					 if ($link2 == $pfade[$z]) $account = $accounts[$z];
				 }
				}
			 if ($protected == 1) $actionlink = $account."&nbsp;"; else $actionlink = '<a class=data href="tools_ftp_neu.php?pfad='.$link.'">'.ltext("toft_cell_new").'</a>';
			 echo '<tr><td colspan=2><img src="'.$strSkinName.'/file_icons/1x1.gif" width="'.$leer.'" height="16"><img src="'.$strSkinName.'/file_icons/file_dir.gif"  height="16" border="0"> <a class=data href="tools_ftp.php?dir='.$link.'">'.${$listname}[$n].'</a></td><td colspan=2>'.$actionlink.'</td></tr>';
			 if (${$listname}[$n] == $dirs[$i1])
				{
				 $i++;
				 $$startdir = $n+1;
				 break 1;
				}

			 if (($n+1) == count($$listname))
				{
				 $i--;
				 $abbau = true;
				}
			}
		} else
		{
		 $i--;
		 $abbau = true;
		}
	}
?>
        <? echo ltext("topw_desc2"); ?>
    <? } ?>
</table>
    </TD>
  </TR>
   
</TABLE>
</BODY>
</HTML>

<?
db_close();
?>
