<?php
/* +----------------------------------------------------------------------+
| Netautor Professional Application Server |
+----------------------------------------------------------------------+
| Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net> |
+----------------------------------------------------------------------+
| This file is subject to license, that is bundled with this package |
| in the file LICENSE.TXT, and is available at through the |
| world-wide-web at http://www.netautor.com/license/ |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| hide@address.com so we can mail you a copy. |
+----------------------------------------------------------------------+
| Authors: Stefan Rottensteiner <hide@address.com> |
| Marek Kadziela <hide@address.com> |
| Gregor Wollner |
| Christian Unger |
| Helli Kleinhans |
+----------------------------------------------------------------------+*/
/**
* Include for software setup/update
*
* @author Stefan Rottensteiner
* @version $Revision: 1.34 $
*/
define ('SOFTWARE_NAME_FULL' ,'Netautor Professional');
define ('SOFTWARE_NAME_SHORT' ,'napro4');
define ('SOFTWARE_VERSION_FULL','5.3.1');
require_once ('./setup_text.php');
/* Wird nur während des Installationsprozesses benötigt. */
if (@strpos($_SERVER['REQUEST_URI'],'setup_again.php') === false)
{
$eval_postget = false;
/** ComPat 1
* MAGIC_QUOTES_GPC korrigieren
*/
if(ini_get('magic_quotes_gpc')==1)
{
if (!function_exists('recursive_stripslashes'))
{
function recursive_stripslashes(&$var)
{
if (!isset($var) || is_null($var)) return ;
if(is_array($var))
{
foreach( $var as $key=>$val) recursive_stripslashes($var[$key]);
}
else
{
$var = stripslashes($var);
}
}
}
recursive_stripslashes($_POST);
recursive_stripslashes($_GET);
recursive_stripslashes($_REQUEST);
recursive_stripslashes($GLOBALS['HTTP_POST_VARS']);
recursive_stripslashes($GLOBALS['HTTP_GET_VARS']);
$eval_postget = TRUE;
}
/** ComPat 2
* VARIABLES_ORDER korrigieren
*/
if(strpos(strtoupper(ini_get('variables_order')),'PG') === false || $eval_postget)
{
$_REQUEST = array();
foreach($_POST as $idx=>$wert) $GLOBALS[$idx] = $_POST[$idx];
foreach($_GET as $idx=>$wert) $GLOBALS[$idx] = $_GET[$idx];
$_REQUEST = array_merge( $_POST, $_GET);
}
/** ComPat3
* Implement missing function html_entity_decode - if not defined
*/
if (!function_exists('html_entity_decode'))
{
if (!defined('ENT_NOQUOTES')) define('ENT_NOQUOTES' , 0);
if (!defined('ENT_COMPAT')) define('ENT_COMPAT' , 2);
if (!defined('ENT_QUOTES')) define('ENT_QUOTES' , 3);
function html_entity_decode ($string, $opt = ENT_COMPAT, $charset='ISO-8859-1')
{
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
if ($opt & 1)
$trans_tbl['''] = "'";
if (!($opt & 2))
unset($trans_tbl['"']);
return strtr ($string, $trans_tbl);
}
}
/** ComPat4
* Implement missing stripos - if not defined
*/
if (!function_exists('stripos'))
{
function stripos ($haystack, $needle, $offset=0 ) {
return strpos( strtolower($haystack), strtolower($needle), $offset);
}
}
/** ComPat 5
* Implement missing array_unique - if not defined
*/
if (!function_exists('array_unique'))
{
function array_unique ( $array ) {
return array_flip( array_flip( $array));
}
}
/** ComPat 6
* Implement missing file_get_contents - if not defined
*/
if (!function_exists('file_get_contents'))
{
function file_get_contents ( $filename ) {
if (!file_exists( filename) || !is_file( $filename))
return '';
$file = @file( $filename);
if (!$file)
return '';
return implode('', $file);
}
}
}
/**
* Sprache einstellen
*/
if (empty($SETUP_LANGUAGE) && !empty($_POST['SETUP_LANGUAGE']))
$SETUP_LANGUAGE=$_POST['SETUP_LANGUAGE'];
if (empty($SETUP_LANGUAGE))
{
@$browser_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
if (empty($browser_language))
{
$SETUP_LANGUAGE='en';
}
else
{
$browser_language = explode(',',$browser_language);
foreach($browser_language as $bl_index => $bl_value)
{
$language = strtolower(substr($bl_value,0,2));
if (isset($setup_text_array[$language])) {$SETUP_LANGUAGE=$language;break;}
}
if (empty($SETUP_LANGUAGE)) $SETUP_LANGUAGE='en';
}
}
$SETUP_LANGUAGE_TEXT = $setup_text_array[$SETUP_LANGUAGE];
define ('SETUP_LANGUAGE',$SETUP_LANGUAGE);
if (empty($_POST['SETUP_LANGUAGE']))
$_POST['SETUP_LANGUAGE']= SETUP_LANGUAGE;
/**
* Runs throug given array an creates HTML-fields
* @param array $SearchArray Given values
* @param string $DontPrefix ,-separated list of variable prefixis which shoul be ignored
* @return A piece of HTML code
*/
function setup_getMyVars(&$SearchArray,$DontPrefix='')
{
if (!is_array($SearchArray)) return '';
$result='';
$DontPrefix = explode(',',$DontPrefix);
reset($SearchArray);
foreach($SearchArray as $_i => $_v)
{
if (!empty($DontPrefix))
{
$continue=false;
foreach($DontPrefix as $j => $_dp)
{
if (empty($_dp)) continue;
if ( substr($_i,0,strlen($_dp)) == $_dp) $continue=true;
}
if ($continue==true) continue;
}
if (is_array($_v))
{
$result.=setup_getMyVars($_v,$_i,$DontPrefix);
}
else
{
$GLOBALS[$_i]=$_v;
$result.='<input type="hidden" name="'.$_i.'" value="'.htmlspecialchars($_v).'">'."\r\n";
}
}
return $result;
}
/**
* create a full path
*/
function setup_MkDir($folder, $mask=0777)
{
clearstatcache();
$folder = str_replace('\\','/',trim($folder));
if (empty($folder)) return true;
if (substr($folder,-1) != '/') $folder.='/';
if (@is_dir($folder)) return true;
if (!setup_MkDir( dirname($folder) , $mask)) return false;
return (@mkdir($folder, $mask));
}
?>