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


//
//  wws:debug
//
//$DEBUG=1;
//
//

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Pragma: no-cache");                          // HTTP/1.0


error_reporting(7);



if (!isset($umgesetzt)) {
  $umgesetzt = true;
  if (is_array($_GET)) {
    foreach($_GET as $key => $val) {
      if (!is_array($val)) {
	if (get_magic_quotes_gpc()) $val = StripSlashes($val);
	//$val = AddSlashes(StripSlashes($val));
      }
      $$key = $val;
    }
  } elseif (is_array($HTTP_GET_VARS)) {
    foreach($HTTP_GET_VARS as $key => $val) {
      if (!is_array($val)) {
	if (get_magic_quotes_gpc()) $val = StripSlashes($val);
	//$val = AddSlashes(StripSlashes($val));
      }
      $$key = $val;
    }
  }

  if (is_array($_POST)) {
    foreach($_POST as $key => $val) {
      if (!is_array($val)) {
	if (get_magic_quotes_gpc()) $val = StripSlashes($val);
	//$val = AddSlashes(StripSlashes($val));
      }
      $$key = $val;
    }
  } elseif (is_array($HTTP_POST_VARS)) {
    foreach($HTTP_POST_VARS as $key => $val) {
      if (!is_array($val)) {
	if (get_magic_quotes_gpc()) $val = StripSlashes($val);
	//$val = AddSlashes(StripSlashes($val));
      }
      $$key = $val;
    }
  }

  if (is_array($_SERVER)) {
    foreach($_SERVER as $key => $val) {
      $$key = $val;
    }
  } elseif (is_array($HTTP_SERVER_VARS)) {
    foreach($HTTP_SERVER_VARS as $key => $val) {
      $$key = $val;
    }
  }	
  unset($key, $val);
}

$PHP_AUTH_USER = $PHP_AUTH_PW = '';

include("../settings.inc.php");
include("../functions.inc.php");
include('../sessions.inc.php');

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

sessao_start();

if(preg_match('/^\/reseller\/([^\/]+)\/.*$/',$_SERVER['REQUEST_URI'], $ma))
{
	if(isSUserLogged($ma[1]))
	{
		$PHP_AUTH_USER = strtolower(trim($ma[1]));	
	}
}

if(!$PHP_AUTH_USER)
{
	db_close;
	include('../loginform.php');
	exit();
}

if (isset($PHP_AUTH_USER)) $PHP_AUTH_USER = strtolower(trim($PHP_AUTH_USER));
if (isset($kunde)) $kunde = strtolower(trim($kunde));

$strSkinName="/skins/skin_1";
$confixx_interface_version = 'xp30';


## set language
$loUser = new SQLString($PHP_AUTH_USER);
if(session_is_registered('_del_settings') && array_key_exists($PHP_AUTH_USER, $_SESSION['_del_settings']))
{
	$shortlang = $_SESSION['_del_settings'][$PHP_AUTH_USER]['shortlang'];
	$strSkinName = $_SESSION['_del_settings'][$PHP_AUTH_USER]['strSkinName'];
	$confixx_interface_version = $_SESSION['_del_settings'][$PHP_AUTH_USER]['confixx_interface_version'];
}
else 
{
	$id = safe_query2( "SELECT language FROM anbieter WHERE anbieter=?", $loUser);
	$werte = db_fetch_array($id);
	$shortlang = $werte["language"];
	$id = safe_query2( "SELECT custom_skins.path AS path, custom_skins.version AS version FROM skins ".
										 " INNER JOIN custom_skins ON (skins.skin_id = custom_skins.id) WHERE skins.cuser=?", $loUser);
	if(db_num_rows($id))
	{
		$werte = db_fetch_array($id);
		$confixx_interface_version = $werte['version'];
		$strSkinName = $werte['path'];
	}
}
$miscf = $shortlang."/misc.inc.php";
$langf = $shortlang."/reseller.inc.php";
include("../languages/$miscf");
include("../languages/$langf");

if($confixx_interface_version != 'classic20')
{
	include_once('gui/module.GuiXP.php');
	$gui = new tGuiXP($strSkinName); // trailing slash !!!
}
db_close();
?>
