2001-07-30 17:59:25 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - Setup *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
2002-02-17 21:23:26 +01:00
|
|
|
* This file written by Joseph Engo<jengo@phpgroupware.org> *
|
|
|
|
* and Dan Kuykendall<seek3r@phpgroupware.org> *
|
|
|
|
* and Mark Peters<skeeter@phpgroupware.org> *
|
|
|
|
* and Miles Lott<milosch@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
2001-07-30 17:59:25 +02:00
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
/* ######## Start security check ########## */
|
2002-01-14 13:14:40 +01:00
|
|
|
$d1 = strtolower(substr(@$GLOBALS['phpgw_info']['server']['api_inc'],0,3));
|
|
|
|
$d2 = strtolower(substr(@$GLOBALS['phpgw_info']['server']['server_root'],0,3));
|
|
|
|
$d3 = strtolower(substr(@$GLOBALS['phpgw_info']['server']['app_inc'],0,3));
|
2001-07-30 17:59:25 +02:00
|
|
|
if($d1 == 'htt' || $d1 == 'ftp' || $d2 == 'htt' || $d2 == 'ftp' || $d3 == 'htt' || $d3 == 'ftp')
|
|
|
|
{
|
|
|
|
echo 'Failed attempt to break in via an old Security Hole!<br>';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
unset($d1);unset($d2);unset($d3);
|
|
|
|
/* ######## End security check ########## */
|
2002-03-03 22:53:00 +01:00
|
|
|
|
2001-07-30 17:59:25 +02:00
|
|
|
if(file_exists('../header.inc.php'))
|
|
|
|
{
|
|
|
|
include('../header.inc.php');
|
|
|
|
}
|
2002-03-03 22:53:00 +01:00
|
|
|
/* If we included the header.inc.php, but it is somehow broken, cover ourselves... */
|
|
|
|
if(!defined('PHPGW_SERVER_ROOT') && !defined('PHPGW_INCLUDE_ROOT'))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
|
|
|
define('PHPGW_SERVER_ROOT','..');
|
|
|
|
define('PHPGW_INCLUDE_ROOT','..');
|
|
|
|
}
|
|
|
|
|
2002-03-03 22:53:00 +01:00
|
|
|
if (floor(phpversion()) == 3)
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2002-03-03 22:53:00 +01:00
|
|
|
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/inc/php3_support_functions.inc.php');
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
2002-03-03 22:53:00 +01:00
|
|
|
include(PHPGW_INCLUDE_ROOT . '/phpgwapi/inc/common_functions.inc.php');
|
2001-07-30 17:59:25 +02:00
|
|
|
|
|
|
|
define('SEP',filesystem_separator());
|
|
|
|
|
|
|
|
/*!
|
2001-09-17 04:10:34 +02:00
|
|
|
@function lang
|
|
|
|
@abstract function to handle multilanguage support
|
2001-07-30 17:59:25 +02:00
|
|
|
*/
|
2001-09-17 04:10:34 +02:00
|
|
|
function lang($key,$m1='',$m2='',$m3='',$m4='',$m5='',$m6='',$m7='',$m8='',$m9='',$m10='')
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2001-09-17 04:10:34 +02:00
|
|
|
if(is_array($m1))
|
|
|
|
{
|
|
|
|
$vars = $m1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
|
|
|
|
}
|
2002-03-03 22:53:00 +01:00
|
|
|
$value = $GLOBALS['phpgw_setup']->translation->translate("$key", $vars );
|
2001-07-30 17:59:25 +02:00
|
|
|
return $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
@function get_langs
|
|
|
|
@abstract returns array of languages we support, with enabled set
|
|
|
|
to True if the lang file exists
|
|
|
|
*/
|
|
|
|
function get_langs()
|
|
|
|
{
|
2002-03-03 22:53:00 +01:00
|
|
|
$f = fopen('./lang/languages','rb');
|
|
|
|
while($line = fgets($f,200))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
|
|
|
list($x,$y) = split("\t",$line);
|
|
|
|
$languages[$x]['lang'] = trim($x);
|
|
|
|
$languages[$x]['descr'] = trim($y);
|
|
|
|
$languages[$x]['available'] = False;
|
|
|
|
}
|
|
|
|
fclose($f);
|
|
|
|
|
|
|
|
$d = dir('./lang');
|
|
|
|
while($entry=$d->read())
|
|
|
|
{
|
2002-03-03 22:53:00 +01:00
|
|
|
if(ereg('^phpgw_',$entry))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
|
|
|
$z = substr($entry,6,2);
|
|
|
|
$languages[$z]['available'] = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$d->close();
|
|
|
|
|
|
|
|
//print_r($languages);
|
|
|
|
return $languages;
|
|
|
|
}
|
|
|
|
|
|
|
|
function lang_select()
|
|
|
|
{
|
2002-04-10 01:43:55 +02:00
|
|
|
$ConfigLang = get_var('ConfigLang',Array('POST','COOKIE'));
|
2001-07-30 17:59:25 +02:00
|
|
|
|
|
|
|
$select = '<select name="ConfigLang">' . "\n";
|
|
|
|
$languages = get_langs();
|
2002-03-03 22:53:00 +01:00
|
|
|
while(list($null,$data) = each($languages))
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
2002-03-03 22:53:00 +01:00
|
|
|
if($data['available'])
|
2001-07-30 17:59:25 +02:00
|
|
|
{
|
|
|
|
$selected = '';
|
|
|
|
$short = substr($data['lang'],0,2);
|
|
|
|
if ($short == $ConfigLang)
|
|
|
|
{
|
|
|
|
$selected = ' selected';
|
|
|
|
}
|
|
|
|
$select .= '<option value="' . $data['lang'] . '"' . $selected . '>' . $data['descr'] . '</option>' . "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$select .= '</select>' . "\n";
|
|
|
|
|
|
|
|
return $select;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
|
|
|
|
{
|
2002-01-11 04:40:59 +01:00
|
|
|
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); /* To set the current core version */
|
2001-09-17 04:10:34 +02:00
|
|
|
/* This will change to just use setup_info */
|
2001-09-01 00:29:23 +02:00
|
|
|
$GLOBALS['phpgw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-01 00:29:23 +02:00
|
|
|
$GLOBALS['phpgw_info']['server']['versions']['phpgwapi'] = 'Undetected';
|
2001-07-30 17:59:25 +02:00
|
|
|
}
|
|
|
|
|
2001-09-01 00:29:23 +02:00
|
|
|
$GLOBALS['phpgw_info']['server']['app_images'] = 'templates/default/images';
|
2001-07-30 17:59:25 +02:00
|
|
|
|
2002-03-03 22:53:00 +01:00
|
|
|
$GLOBALS['phpgw_setup'] = CreateObject('phpgwapi.setup',True,True);
|
2001-07-30 17:59:25 +02:00
|
|
|
?>
|