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

include_once("auth.php");
include_once( dirname(__FILE__) . "/../include/class.MenuItems.php" );

db_connect($db_host, $db_user, $db_pass);

$loUser = new SQLString($PHP_AUTH_USER);
$id = safe_query2( "SELECT * FROM kunden WHERE kunde = ?", $loUser );
$kunde = db_fetch_array($id);

$loRes = new SQLString($kunde["anbieter"]);
$id = safe_query2( "SELECT * FROM anbieter WHERE anbieter = ?", $loRes );
$reseller = db_fetch_array($id);
?>
<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">
<table width="90%" cellpadding="0" cellspacing="1" border=0>
<tr heigth = "1"></tr>

<?
function menu($seite,$text,$strSkinName,$target="content") {
  menu_unprocessed($seite,ltext($text),$strSkinName,$target);
}

function menu_unprocessed($seite,$text,$strSkinName,$target="content") {
?>
<tr>
<td class="menucolor">
<a href="<?=$seite?>" target=<?= $target ?> class="menu" onclick="top.fraToolbar.location.href = 'toolbar.php?text=<? echo urlencode($text); ?>'";>
<IMG src="<?=$strSkinName?>/pics/alpha.gif" width=4 height=12 border=0>
<IMG src="<?=$strSkinName?>/pics/arrow.gif" width=12 height=9 border=0><? echo $text; ?>
</a>
</td>
</tr>
<? }
function menutop($seite,$text,$strSkinName) {
?>
<tr>
<td class="menucolor">
<a href="<?=$seite?>" target=new class="menu">
<IMG src="<?=$strSkinName?>/pics/alpha.gif" width=4 height=12 border=0>
<IMG src="<?=$strSkinName?>/pics/arrow.gif" width=12 height=9 border=0><? echo ltext($text); ?>
</a>
</td>
</tr>
<? }


$id = db_query("select statistik,autoresponder,email,mysql,frontpage from admin");
$admin = db_fetch_array($id);

if ($num == 1)
{
  $bar=urlencode(ltext("m_overview"));
  $content="allgemein_start.php";

  menu("allgemein_start.php","m_overview",$strSkinName);
  if($PHP_AUTH_USER != ($user_prefix . '0'))
  {
  	menu("help.php?left=allgemein_pwaendern.php&right1=alpw_desc1&right2=alpw_desc2", "ma_changepw",$strSkinName);
  }
  menu("help.php?left=allgemein_sprache.php&right1=alsp_title1&right2=alsp_descr1",
       "ma_selectlanguage",$strSkinName);
  menu("allgemein_transfer.php","ma_traffic",$strSkinName);


	$loUser = new SQLString($PHP_AUTH_USER);
  $id = safe_query2( "SELECT statistik FROM kunden WHERE kunde = ?", $loUser);
  $werte = db_fetch_array($id);
  $statistik = $werte["statistik"];
  if ($statistik == 1 && $admin['statistik']) {
    menu("allgemein_webalizer.php","ma_stats",$strSkinName);
  }
  menu('settings.php', 'm_settings', $strSkinName);
  menu("allgemein_servermeldungen.php","ma_servermessages",$strSkinName);
  $id = safe_query2( "SELECT domain FROM domains WHERE frontpage=1 and kunde=?", $loUser );
  if ($admin['frontpage'] && (db_num_rows($id) > 0)) {
    menu("help.php?left=allgemein_frontpage.php&right1=alfr_desc1&right2=alfr_desc3",
	 "ma_frontpage",$strSkinName);
  }

} else if ($num == 2) {

  $noemail = false;

  $id = safe_query2( "SELECT maxemail FROM  kunden WHERE kunde = ?", $loUser);

  $werte = db_fetch_array($id);
  if (($admin["email"] == 0) || ($werte["maxemail"] == 0)){
    $id = safe_query2( "SELECT COUNT(kunde) AS email FROM email WHERE kunde = ?", $loUser);
    $werte = db_fetch_array($id);
    if ($werte["email"] == 0) {
      $id = safe_query2( "SELECT COUNT(kunde) AS pop3 FROM pop3 WHERE kunde = ?", $loUser);
      $werte = db_fetch_array($id);
      if ($werte["pop3"] == 0)	{
	db_close();
	$noemail = true;
	//header("Location: ./noemail.php");
      }
    }	
  }

  $id = safe_query2("SELECT COUNT(ident) AS autoresponder FROM autoresponder WHERE kunde = ?", $loUser);
  $werte = db_fetch_array($id);
  $autoresponder = $werte["autoresponder"];

  $id = safe_query2( "SELECT maxemail, maxautoresponder, maxmaillist FROM kunden WHERE kunde = ?", $loUser);
  $werte = db_fetch_array($id);
  $maxautoresponder = $werte["maxautoresponder"];
  $bar=urlencode(ltext("m_overview"));
  $content="email_start.php";
  menu("email_start.php","m_overview",$strSkinName);

  if(!$noemail) {
    menu("help.php?left=email_pop3.php&right1=empo_desc1&right2=","me_pop3",$strSkinName);
    menu("help.php?left=email_email.php&right1=emem_desc1&right2=emem_desc2",
	 "me_email",$strSkinName);
    if ($admin["autoresponder"] && ($maxautoresponder != 0)){
      menu("help.php?left=email_autoresponder.php&right1=emau_desc1&right2=emau_desc2",
	   "me_autoresponder",$strSkinName);
    }
    if ($admin["majordomo"] && $werte['maxmaillist']) {
    	menu('maillist.php', 'm_maillist', $strSkinName);
    }
  }

} else if ($num == 3) {
  $id = safe_query2( "SELECT maxmysql FROM  kunden WHERE kunde = ?", $loUser);
  $werte = db_fetch_array($id);
  if (($admin["mysql"] == 0) || ($werte["maxmysql"] == 0)){
## herausfinden, ob mysql datenbanken genutzt werden
    $id = safe_query2( "SELECT kunde FROM mysql_datenbanken WHERE kunde = ?", $loUser);
    if (db_num_rows($id) < 1){
      //header("Location: ./nodb.php");
      $nodb=1;
    }
  }
  $id = db_query("SELECT mysqlshelluser, mysqlshellpasswort, mysqlshellhost, ".
		 " phpmyadmin, phpmyadminpfad FROM admin");
  $werte = db_fetch_array($id);
  $mysqlshelluser = $werte["mysqlshelluser"];
  $mysqlshellpasswort = $werte["mysqlshellpasswort"];
  $mysqlshellhost = $werte["mysqlshellhost"];
  $phpmyadmin = $werte["phpmyadmin"];
  $phpmyadminpfad = $werte["phpmyadminpfad"];
  if ("$nodb" == 1){
    $content="db_start.php";
    menu("db_start.php","m_overview",$strSkinName);
  }else	{
    $bar=urlencode(ltext("m_overview"));
    $content="db_start.php";
    menu("db_start.php","m_overview",$strSkinName);
    menu("db_mysql.php","md_mysql",$strSkinName);
    if ($phpmyadmin == 1) {
?>
<tr>
<td class="menucolor">
<a href="<?=$phpmyadminpfad?>" target="_blank" class="menu">
<IMG src="<?=$strSkinName?>/pics/alpha.gif" width=4 height=12 border=0>
<IMG src="<?=$strSkinName?>/pics/arrow.gif" width=12 height=9 border=0><? echo ltext("md_phpmyadmin"); ?>
</a>
</td>
</tr>
<?
    }	
  }
}
else if ($num == 4) {
  $id = safe_query2( "SELECT maxftp, webmail, webftp, pwschutz, fehlerseiten, perl, maxcronjobs, maxidn, maxatdomains ".
										 " FROM kunden WHERE kunde=?", $loUser );
  $werte = db_fetch_array($id);
  $maxftp = $werte["maxftp"];
  $skwebmail = $werte["webmail"];
  $skwebftp = $werte["webftp"];
  $skfehlerseiten = $werte["fehlerseiten"];
  $skpwschutz = $werte["pwschutz"];
  $skperl = $werte["perl"];
  $maxcronjobs = $werte["maxcronjobs"];
  $maxatdomains = $werte['maxatdomains'];

  $bar=urlencode(ltext("m_overview"));
  $content="tools_start.php";
  menu("tools_start.php","m_overview",$strSkinName);
  if ($skwebftp == 1) { 
    menutop("/ftplogin/","mt_webftp",$strSkinName); 
  }
  if ($skwebmail == 1) { 
    menutop("/poplogin/","mt_webmail",$strSkinName); 
  }
  if ($skperl == 1 || $skperl == 2) { 
    menu("tools_cgicheck.php","mt_cgicheck",$strSkinName); 
  }
  menu("tools_domains.php","mt_domains",$strSkinName);
  if ( $maxatdomains > 0 || $maxatdomains == -1 )
    menu("atdomains.php","mt_atdomains",$strSkinName);
  if ($skpwschutz == 1) { 
    menu("help.php?left=tools_pwschutz.php&right1=topw_desc1&right2=topw_desc2",
	 "mt_auth",$strSkinName); }
  if (($maxftp > 0) || ($maxftp == -1)) { 
    menu("help.php?left=tools_ftp.php&right1=toft_title&right2=toft_desc1",
	 "mt_ftpusers",$strSkinName); }
  if ($skfehlerseiten == 1) { 
    menu("help.php?left=tools_fehlerseiten.php&right1=tofe_title&right2=tofe_desc1",
	 "mt_errorfiles",$strSkinName); }

  if(!(isset($GLOBALS["backup_off"]) && $GLOBALS["backup_off"])) {
	  menu("help.php?left=tools_backup.php&right1=toba_desc1&right2=","m_backup",$strSkinName);
	  menu("help.php?left=tools_restore.php&right1=tore_desc1&right2=","m_restore",$strSkinName);
  }
  if($maxcronjobs) { 
    menu("help.php?left=tools_cron.php&right1=cron_desc_title&right2=cron_desc1",
	 "m_cron",$strSkinName);
  }
  if ($maxidn) {
  	menu("idn.php","m_idn",$strSkinName);
  }
}
else if ( $num >= 10 ) {
  $bar=urlencode(ltext("m_overview"));
  $content="custom_start.php?menublock_id=".$_GET["menublock_id"];
  menu ($content,"m_overview",$strSkinName);
  $onemenu = new MenuItems ( $_GET["menublock_id"] );
  for ( $onemenu->Start(); $onemenu->NextElement(); ) {
		if ( $onemenu->GetInFrame() ) {
			menu_unprocessed ( $onemenu->GetHRef(), $onemenu->GetLabel(), $strSkinName, "content" );
		} else {
			menu_unprocessed ( $onemenu->GetHRef(), $onemenu->GetLabel(), $strSkinName, "_blank" );
		}
	}
}

if ( ! preg_match ( "/^\\s*$/", $reseller["hilfecode"] ) )
	menu("confixx_hilfe.php","m_help",$strSkinName);

?>

<script>
top.fraToolbar.location.href = 'toolbar.php?text=<?=$bar?>';
parent.content.location.href = '<?=$content?>';
</script>
</table>
</body>
</html>
<?
db_close();
?>
