<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
//v1.1 www.bcoos.net 2006-08 GPL
error_reporting(2039);
set_magic_quotes_runtime(0);
init_wiz();
include_once("../include/version.php");
include_once("../include/functions.php");
include_once("../modules/system/cache/config.php");
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function init_wiz() {
global $_COOKIE, $_POST, $_GET, $_SERVER, $_ENV;
$globals_test = @ini_get('register_globals');
if ( isset($globals_test) && empty($globals_test) ) {
	if ( !empty($_GET) )  { extract($_GET, EXTR_SKIP);  }
	if ( !empty($_POST) ) { extract($_POST, EXTR_OVERWRITE); }
	define('_GLOBALS', FALSE);
	} else {
		define('_GLOBALS', TRUE);
	}
define('_PHP_SELF', $_SERVER['PHP_SELF']);
!empty($_SERVER['HTTP_HOST'])       ? define('_HTTP_HOST'      , $_SERVER['HTTP_HOST'])       : define('_HTTP_HOST'      , $_ENV['HTTP_HOST']);
!empty($_SERVER['QUERY_STRING'])    ? define('_QUERY_STRING'   , $_SERVER['QUERY_STRING'])    : define('_QUERY_STRING'   , $_ENV['QUERY_STRING']);
!empty($_SERVER['SCRIPT_NAME'])     ? define('_SCRIPT_NAME'    , $_SERVER['SCRIPT_NAME'])     : define('_SCRIPT_NAME'    , $_ENV['SCRIPT_NAME']);
!empty($_SERVER['HTTP_REFERER'])    ? define('_HTTP_REFERER'   , $_SERVER['HTTP_REFERER'])    : define('_HTTP_REFERER'   , $_ENV['HTTP_REFERER']);
!empty($_SERVER['REQUEST_METHOD'])  ? define('_REQUEST_METHOD' , $_SERVER['REQUEST_METHOD'])  : define('_REQUEST_METHOD' , $_ENV['REQUEST_METHOD']);
!empty($_SERVER['HTTP_USER_AGENT']) ? define('_HTTP_USER_AGENT', $_SERVER['HTTP_USER_AGENT']) : define('_HTTP_USER_AGENT', $_ENV['HTTP_USER_AGENT']);
$R_URI = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_ENV['REQUEST_URI'];
!empty($R_URI) ? define('_REQUEST_URI', $R_URI) : define('_REQUEST_URI', _PHP_SELF._QUERY_STRING);
switch(strtoupper(PHP_OS)) {
	case 'WINDOWS':
	case 'CYGWIN':
	case 'WINNT':
	case 'WIN32':
		define('_OS', 'W');
		break;
	case 'DARWIN':
	case 'OSX':
		define('_OS', 'M');
		break;
	default:
		define('_OS', 'U');
}
$base_path = str_replace('\\', '/', getcwd());
if ( substr($base_path, -1) == '/') {
	$base_path = substr($base_path, 0, -1);
}
define('WIZ_PATH', $base_path);
if ( !defined('XOOPS_ROOT_PATH') &&  XOOPS_ROOT_PATH != '' ) {
	define('XOOPS_ROOT_PATH', preg_replace("/\/_install.*/i", "", WIZ_PATH));
}
$parts = pathinfo(_PHP_SELF);
define('BASE_URL', preg_replace("/\/_install.*/i", "", $parts["dirname"]));
if ( !defined('XOOPS_URL') && XOOPS_URL != '' ) {
	$root_url = "http://" . _HTTP_HOST. preg_replace("'/_install/install\.php$'i", "", _PHP_SELF);
	define("XOOPS_URL", $root_url);
}
$lang = !empty($_POST['lang']) ? $_POST['lang'] : $_COOKIE['lang'];
if ( @file_exists(WIZ_PATH."/language/".$lang."/main.php") ) {
	include_once(WIZ_PATH."/language/".$lang."/main.php");
	} else {
		include_once(WIZ_PATH."/language/english/main.php");
	}
if ( @file_exists("../language/".$lang."/global.php") ) {
	include_once("../language/".$lang."/global.php");
	} else {
		include_once("../language/english/global.php");
	}
if ( @file_exists("../language/".$lang."/admin.php") ) {
	include_once("../language/".$lang."/admin.php");
	} else {
		include_once("../language/english/admin.php");
	}
if ( @file_exists("../language/".$lang."/user.php") ) {
	include_once("../language/".$lang."/user.php");
	} else {
		include_once("../language/english/user.php");
	}
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function wiz_header($title=_INSTALL_G_TITLE) {
?><html>
<head>
<title><?php echo $title;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="style/style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table align="center" width="100%" border="0" cellpadding="0" cellspacing="0"><tr>
<td width="250"><img src="images/ob_01.png" ></td>
<td width="100%">&nbsp;</td>
</tr><tr>
<td width="250"><img src="images/ob_03.gif" ></td>
<td width="100%"><img src="images/spaziatore.gif" width="1" height="2"></td>
</tr><tr>
<td width="250"><img src="images/ob_04.gif" width="280" height="18"></td>
<td width="100%" bgcolor="#D0CCD0">
<div align="right">
<strong><font color="#FFFFFF" size="1" face="Verdana"><?php echo XOOPS_VERSION;?>&nbsp;&nbsp;&nbsp;</font></strong>
</div></td>
</tr><tr>
<td width="250"><img src="images/ob_05.gif" width="280" height="7"></td>
<td width="100%"><img src="images/spaziatore.gif" width="1" height="7"></td>
</tr><tr>
<td colspan="2">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
<td width="7"><img src="images/ob_08.gif" width="7" height="13"></td>
<td width="100%"><img src="images/ob_09.gif" width="100%" height="13"></td>
<td width="7"><img src="images/ob_11.gif" width="7" height="13"></td>
</tr><tr>
<td width="7" background="images/ob_15.gif">&nbsp;</td>
<td align="center" width="100%">
<font color="#999999" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<br />
<?php
}
//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function wiz_footer() {
?>
</font></td>
<td width="7" background="images/ob_17.gif">&nbsp;</td>
</tr><tr>
<td width="7" height="13"><img src="images/ob_20.gif" width="7" height="13"></td>
<td width="100%"><img src="images/ob_21.gif" width="100%" height="13"></td>
<td width="7"><img src="images/ob_22.gif" width="7" height="13"></td>
</tr></table></td>
</tr></table>
<br /><br />
</body>
</html>
<?php
}
//---------------------------------------------------------------------------------------//
// <commit> http://www.hackthebox.org/
// http://www.exoops.info/modules/newbb/viewtopic.php?topic_id=57&forum=6
// http://www.exoops.info/modules/mydownloads/singlefile.php?lid=92
function version_check($min, $curr) {
	list($min_major,$min_minor,$min_sub) = split(".", $min);
	list($cur_major,$cur_minor,$cur_sub) = split(".", $curr);
	if ( intval($cur_major) >= intval($min_major) ) { 
		if (intval($cur_minor) >= intval($min_minor) )  {
			if (intval($cur_sub) >= intval($min_minor) ) { return true; } 
		}
	}
	
	return false;
}
// </commit>
?>
