diff --git a/phpgwapi/inc/class.setup_process.inc.php b/phpgwapi/inc/class.setup_process.inc.php
index ce085d194b..c8e1510352 100644
--- a/phpgwapi/inc/class.setup_process.inc.php
+++ b/phpgwapi/inc/class.setup_process.inc.php
@@ -117,7 +117,9 @@
/* Create tables and insert new records for each app in this list */
$passing = $this->current($pass,$DEBUG);
$passing = $this->default_records($passing,$DEBUG);
- $passing = $this->add_langs($passing,$DEBUG,$force_en);
+ $my_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2);
+ $passing = $this->add_langs($passing,$DEBUG,array($my_lang,'en'));
+ $this->save_minimal_config();
break;
case 'upgrade':
/* Run upgrade scripts on each app in the list */
@@ -181,6 +183,44 @@
return ($setup_info);
}
+ /*!
+ @function save_minimal_config
+ @abstract saves a minimal default config, so you get a running install without entering and saveing Step #2 config
+ */
+ function save_minimal_config()
+ {
+ $GLOBALS['current_config']['site_title'] = 'eGroupWare';
+ $GLOBALS['current_config']['hostname'] = $_SERVER['HTTP_HOST'];
+ // files-dir is not longer allowed in document root, for security reasons !!!
+ $GLOBALS['current_config']['files_dir'] = '/outside/webserver/docroot';
+
+ if(@is_dir('/tmp'))
+ {
+ $GLOBALS['current_config']['temp_dir'] = '/tmp';
+ }
+ else
+ {
+ $GLOBALS['current_config']['temp_dir'] = '/path/to/temp/dir';
+ }
+ // guessing the phpGW url
+ $parts = explode('/',$_SERVER['PHP_SELF']);
+ array_pop($parts); // remove config.php
+ array_pop($parts); // remove setup
+ $GLOBALS['current_config']['webserver_url'] = implode('/',$parts);
+
+ $datetime = CreateObject('phpgwapi.datetime');
+ $GLOBALS['current_config']['tz_offset'] = $datetime->getbestguess();
+ unset($datetime);
+
+ foreach($GLOBALS['current_config'] as $setting => $value)
+ {
+ $setting = $GLOBALS['phpgw_setup']->db->db_addslashes($setting);
+ $value = $GLOBALS['phpgw_setup']->db->db_addslashes($value);
+ @$GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='$setting'",__LINE__,__FILE__);
+ $GLOBALS['phpgw_setup']->db->query("INSERT INTO phpgw_config (config_app,config_name, config_value) VALUES ('phpgwapi','$setting','$value')");
+ }
+ }
+
/*!
@function droptables
@abstract drop tables per application, check that they are in the db first
@@ -350,13 +390,13 @@
@abstract process application lang files and uninstall
@param $setup_info array of application info from setup.inc.php files, etc.
*/
- function add_langs($setup_info,$DEBUG=False,$force_en=False)
+ function add_langs($setup_info,$DEBUG=False,$force_langs=False)
{
@reset($setup_info);
while(list($key,$null) = @each($setup_info))
{
$appname = $setup_info[$key]['name'];
- $this->translation->add_langs($appname,$DEBUG,$force_en);
+ $this->translation->add_langs($appname,$DEBUG,$force_langs);
if($DEBUG)
{
echo '
process->add_langs(): Translations added for ' . $appname . "\n";
diff --git a/phpgwapi/inc/class.setup_translation.inc.php b/phpgwapi/inc/class.setup_translation.inc.php
index a13aea3c3c..f8b8975e1c 100644
--- a/phpgwapi/inc/class.setup_translation.inc.php
+++ b/phpgwapi/inc/class.setup_translation.inc.php
@@ -164,12 +164,18 @@
@abstract process an application's lang files, calling get_langs() to see what langs the admin installed already
@param $appname app_name of application to process
*/
- function add_langs($appname,$DEBUG=False,$force_en=False)
+ function add_langs($appname,$DEBUG=False,$force_langs=False)
{
$langs = $this->get_langs($DEBUG);
- if($force_en && !@in_array('en',$langs))
+ if(is_array($force_langs))
{
- $langs[] = 'en';
+ foreach($force_langs as $lang)
+ {
+ if (!in_array($lang,$langs))
+ {
+ $langs[] = $lang;
+ }
+ }
}
if($DEBUG)
diff --git a/phpgwapi/inc/class.translation_sql.inc.php b/phpgwapi/inc/class.translation_sql.inc.php
index e4f5bf5e74..99471f4399 100644
--- a/phpgwapi/inc/class.translation_sql.inc.php
+++ b/phpgwapi/inc/class.translation_sql.inc.php
@@ -24,15 +24,23 @@
/* $Id$ */
- // define the maximal length of a message_id, all message_ids have to be unique
+ // define the maximal length of a message_id, all message_ids have to be unique
// in this length, our column is varchar 255, but addslashes might add some length
- define('MAX_MESSAGE_ID_LENGTH',230);
-
+ if (!defined('MAX_MESSAGE_ID_LENGTH'))
+ {
+ define('MAX_MESSAGE_ID_LENGTH',230);
+ }
+
class translation
{
var $userlang = 'en';
var $loaded_apps = array();
+ function translation()
+ {
+ $this->db = is_object($GLOBALS['phpgw']->db) ? $GLOBALS['phpgw']->db : $GLOBALS['phpgw_setup']->db;
+ }
+
function init()
{
// post-nuke and php-nuke are using $GLOBALS['lang'] too
@@ -56,6 +64,11 @@
$this->add_app($GLOBALS['phpgw_info']['flags']['currentapp']);
}
+ /*!
+ @function translate
+ @abstract translates a phrase and evtl. substitute some variables
+ @returns the translation
+ */
function translate($key, $vars=false )
{
if (!$vars)
@@ -83,6 +96,13 @@
return $ret;
}
+ /*!
+ @function add_app
+ @abstract adds translations for an application from the database to the lang-array
+ @syntax add_app($app,$lang=False)
+ @param $app name of the application to add (or 'common' for the general translations)
+ @param $lang 2-char code of the language to use or False if the users language should be used
+ */
function add_app($app,$lang=False)
{
$lang = $lang ? $lang : $this->userlang;
@@ -90,29 +110,219 @@
if (!isset($this->loaded_apps[$app]) || $this->loaded_apps[$app] != $lang)
{
$sql = "select message_id,content from phpgw_lang where lang='".$lang."' and app_name='".$app."'";
- $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
- while ($GLOBALS['phpgw']->db->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
{
- $GLOBALS['lang'][strtolower ($GLOBALS['phpgw']->db->f('message_id'))] = $GLOBALS['phpgw']->db->f('content');
+ $GLOBALS['lang'][strtolower ($this->db->f('message_id'))] = $this->db->f('content');
}
$this->loaded_apps[$app] = $lang;
}
}
+ /*!
+ @function get_installed_langs
+ @abstract returns a list of installed langs
+ @returns array with 2-character lang-code as key and descriptiv lang-name as data
+ */
function get_installed_langs()
{
if (!is_array($this->langs))
{
- $GLOBALS['phpgw']->db->query("SELECT DISTINCT l.lang,ln.lang_name FROM phpgw_lang l,phpgw_languages ln WHERE l.lang = ln.lang_id",__LINE__,__FILE__);
- if (!$GLOBALS['phpgw']->db->num_rows())
+ $this->db->query("SELECT DISTINCT l.lang,ln.lang_name FROM phpgw_lang l,phpgw_languages ln WHERE l.lang = ln.lang_id",__LINE__,__FILE__);
+ if (!$this->db->num_rows())
{
return False;
}
- while ($GLOBALS['phpgw']->db->next_record())
+ while ($this->db->next_record())
{
- $this->langs[$GLOBALS['phpgw']->db->f('lang')] = $GLOBALS['phpgw']->db->f('lang_name');
+ $this->langs[$this->db->f('lang')] = $this->db->f('lang_name');
}
}
return $this->langs;
}
+
+ /*!
+ @function get_installed_charsets
+ @abstract returns a list of installed charsets
+ @returns array with charset as key and comma-separated list of langs useing the charset as data
+ */
+ function get_installed_charsets()
+ {
+ if (!is_array($this->charsets))
+ {
+ $this->db->query("SELECT DISTINCT l.lang,ln.lang_name,l.content AS charset FROM phpgw_lang l,phpgw_languages ln WHERE l.lang = ln.lang_id AND l.message_id='charset'",__LINE__,__FILE__);
+ if (!$this->db->num_rows())
+ {
+ return False;
+ }
+ while ($this->db->next_record())
+ {
+ $data = &$this->charsets[$charset = $this->db->f('charset')];
+ $data .= ($data ? ', ' : $charset.': ').
+ $this->db->f('lang_name').' ('.$this->db->f('lang').')';
+ }
+ }
+ return $this->charsets;
+ }
+
+ /*!
+ @function install_langs
+ @abstract installs translations for the selected langs into the database
+ @syntax install_langs($langs,$upgrademethod='dumpold')
+ @param $langs array of langs to install (as data NOT keys (!))
+ @param $upgrademethod 'dumpold' (recommended & fastest), 'addonlynew' languages, 'addmissing' phrases
+ */
+ function install_langs($langs,$upgrademethod='dumpold')
+ {
+ @set_time_limit(0); // we might need some time
+
+ if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod != 'dumpold')
+ {
+ $this->db->query("select * from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__);
+ if ($this->db->next_record())
+ {
+ $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize(stripslashes($this->db->f('config_value')));
+ }
+ }
+
+ if (!is_array($langs) || !count($langs))
+ {
+ return;
+ }
+ $this->db->transaction_begin();
+
+ if ($upgrademethod == 'dumpold')
+ {
+ // dont delete the custom main- & loginscreen messages every time
+ $this->db->query("DELETE FROM phpgw_lang where app_name != 'mainscreen' AND app_name != 'loginscreen'",__LINE__,__FILE__);
+ //echo '
Test: dumpold';
+ $GLOBALS['phpgw_info']['server']['lang_ctimes'] = array();
+ }
+ foreach($langs as $lang)
+ {
+ //echo '
Working on: ' . $lang;
+ $addlang = False;
+ if ($upgrademethod == 'addonlynew')
+ {
+ //echo "
Test: addonlynew - select count(*) from phpgw_lang where lang='".$lang."'";
+ $this->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE lang='".$lang."'",__LINE__,__FILE__);
+ $this->db->next_record();
+
+ if ($this->db->f(0) == 0)
+ {
+ //echo '
Test: addonlynew - True';
+ $addlang = True;
+ }
+ }
+ if (($addlang && $upgrademethod == 'addonlynew') || ($upgrademethod != 'addonlynew'))
+ {
+ //echo '
Test: loop above file()';
+ if (!is_object($GLOBALS['phpgw_setup']))
+ {
+ $GLOBALS['phpgw_setup'] = CreateObject('phpgwapi.setup');
+ $GLOBALS['phpgw_setup']->db = $this->db;
+ }
+ $setup_info = $GLOBALS['phpgw_setup']->detection->get_versions();
+ $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info);
+ $raw = array();
+ // Visit each app/setup dir, look for a phpgw_lang file
+ foreach($setup_info as $key => $app)
+ {
+ $appfile = PHPGW_SERVER_ROOT . SEP . @$app['name'] . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) . '.lang';
+ //echo '
Checking in: ' . $app['name'];
+ if($GLOBALS['phpgw_setup']->app_registered(@$app['name']) && file_exists($appfile))
+ {
+ //echo '
Including: ' . $appfile;
+ $lines = file($appfile);
+ foreach($lines as $line)
+ {
+ list($message_id,$app_name,,$content) = explode("\t",$line);
+ $message_id = $this->db->db_addslashes(substr(strtolower(chop($message_id)),0,MAX_MESSAGE_ID_LENGTH));
+ $app_name = $this->db->db_addslashes(chop($app_name));
+ $content = $this->db->db_addslashes(chop($content));
+
+ $raw[$app_name][$message_id] = $content;
+ }
+ $GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app['name']] = filectime($appfile);
+ }
+ }
+ foreach($raw as $app_name => $ids)
+ {
+ foreach($ids as $message_id => $content)
+ {
+ $addit = False;
+ //echo '
APPNAME:' . $app_name . ' PHRASE:' . $message_id;
+ if ($upgrademethod == 'addmissing')
+ {
+ //echo '
Test: addmissing';
+ $this->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE message_id='$message_id' AND lang='$lang' AND (app_name='$app_name' OR app_name='common') AND content='$content'",__LINE__,__FILE__);
+ $this->db->next_record();
+
+ if ($this->db->f(0) == 0)
+ {
+ //echo '
Test: addmissing - True - Total: ' . $this->db->f(0);
+ $addit = True;
+ }
+ }
+
+ if ($addit || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
+ {
+ if($message_id && $content)
+ {
+ //echo "
adding - insert into phpgw_lang values ('$message_id','$app_name','$lang','$content')";
+ $result = $this->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content) VALUES('$message_id','$app_name','$lang','$content')",__LINE__,__FILE__);
+ if (intval($result) <= 0)
+ {
+ echo "
Error inserting record: phpgw_lang values ('$message_id','$app_name','$lang','$content')";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ $this->db->transaction_commit();
+
+ // update the ctimes of the installed langsfiles for the autoloading of the lang-files
+ //
+ $this->db->query("DELETE from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__);
+ $this->db->query($query="INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES ('phpgwapi','lang_ctimes','".
+ addslashes(serialize($GLOBALS['phpgw_info']['server']['lang_ctimes']))."')",__LINE__,__FILE__);
+ }
+
+ /*!
+ @function autolaod_changed_langfiles
+ @abstract re-loads all (!) langfiles if one langfile for the an app and the language of the user has changed
+ */
+ function autoload_changed_langfiles()
+ {
+ //echo "
check_langs()
\n";
+ if ($GLOBALS['phpgw_info']['server']['lang_ctimes'] && !is_array($GLOBALS['phpgw_info']['server']['lang_ctimes']))
+ {
+ $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize($GLOBALS['phpgw_info']['server']['lang_ctimes']);
+ }
+ //_debug_array($GLOBALS['phpgw_info']['server']['lang_ctimes']);
+
+ $lang = $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+ $apps = $GLOBALS['phpgw_info']['user']['apps'];
+ $apps['phpgwapi'] = True; // check the api too
+ foreach($apps as $app => $data)
+ {
+ $fname = PHPGW_SERVER_ROOT . "/$app/setup/phpgw_$lang.lang";
+
+ if (file_exists($fname))
+ {
+ $ctime = filectime($fname);
+ $ltime = intval($GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app]);
+ //echo "checking lang='$lang', app='$app', ctime='$ctime', ltime='$ltime'
\n";
+
+ if ($ctime != $ltime)
+ {
+ // update all langs
+ $this->install_langs(array_keys($this->get_installed_langs()));
+ break;
+ }
+ }
+ }
+ }
}
diff --git a/setup/config.php b/setup/config.php
index 9454b6bc47..038edb277a 100644
--- a/setup/config.php
+++ b/setup/config.php
@@ -24,7 +24,7 @@
Authorize the user to use setup app and load the database
Does not return unless user is authorized
*/
- if(!$GLOBALS['phpgw_setup']->auth('Config'))
+ if(!$GLOBALS['phpgw_setup']->auth('Config') || @$_POST['cancel'])
{
Header('Location: index.php');
exit;
@@ -69,31 +69,6 @@
$GLOBALS['phpgw_setup']->loaddb();
- /* Guessing default values. */
- $GLOBALS['current_config']['hostname'] = $_SERVER['HTTP_HOST'];
- // files-dir is not longer allowed in document root, for security reasons !!!
- $GLOBALS['current_config']['files_dir'] = '/outside/webserver/docroot';
-
- if(@is_dir('/tmp'))
- {
- $GLOBALS['current_config']['temp_dir'] = '/tmp';
- }
- else
- {
- $GLOBALS['current_config']['temp_dir'] = '/path/to/temp/dir';
- }
- // guessing the phpGW url
- $parts = explode('/',$_SERVER['PHP_SELF']);
- unset($parts[count($parts)-1]); // config.php
- unset($parts[count($parts)-1]); // setup
- $GLOBALS['current_config']['webserver_url'] = implode('/',$parts);
-
- if(@get_var('cancel',Array('POST')))
- {
- Header('Location: index.php');
- exit;
- }
-
/* Check api version, use correct table */
$setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions();
@@ -106,8 +81,8 @@
$configtbl = 'phpgw_config';
}
- $newsettings = get_var('newsettings',Array('POST'));
- $files_in_docroot = in_docroot($GLOBALS['HTTP_POST_VARS']['newsettings']['files_dir']);
+ $newsettings = $_POST['newsettings'];
+ $files_in_docroot = in_docroot($newsettings['files_dir']);
if(@get_var('submit',Array('POST')) && @$newsettings && !$files_in_docroot)
{
diff --git a/setup/index.php b/setup/index.php
index 11084d1a28..17ba32512b 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -259,9 +259,6 @@
/* process all apps and langs(last param True), excluding apps with the no_mass_update flag set. */
$setup_info = $GLOBALS['phpgw_setup']->detection->upgrade_exclude($setup_info);
$setup_info = $GLOBALS['phpgw_setup']->process->pass($setup_info,'new',$GLOBALS['DEBUG'],True);
-
- $GLOBALS['included'] = True;
- include('lang.php');
$GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
break;
case 'oldversion':
diff --git a/setup/lang.php b/setup/lang.php
index def98340eb..71cdf76373 100644
--- a/setup/lang.php
+++ b/setup/lang.php
@@ -12,235 +12,103 @@
/* $Id$ */
$phpgw_info = array();
- if (!@$included)
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'noheader' => True,
+ 'nonavbar' => True,
+ 'currentapp' => 'home',
+ 'noapi' => True
+ );
+ include('./inc/functions.inc.php');
+ // Authorize the user to use setup app and load the database
+ // Does not return unless user is authorized
+ if (!$GLOBALS['phpgw_setup']->auth('Config'))
{
- $GLOBALS['phpgw_info']['flags'] = array(
- 'noheader' => True,
- 'nonavbar' => True,
- 'currentapp' => 'home',
- 'noapi' => True
- );
- include('./inc/functions.inc.php');
- // Authorize the user to use setup app and load the database
- // Does not return unless user is authorized
- if (!$GLOBALS['phpgw_setup']->auth('Config'))
- {
- Header('Location: index.php');
- exit;
- }
- $GLOBALS['phpgw_setup']->loaddb();
-
- include(PHPGW_API_INC.'/class.common.inc.php');
- $common = new common;
- // this is not used
- //$sep = $common->filesystem_separator();
- }
- elseif ($included != 'from_login')
- {
- $newinstall = True;
- $lang_selected['en'] = 'en';
- $submit = True;
- }
-
- if (!defined('MAX_MESSAGE_ID_LENGTH'))
- {
- define('MAX_MESSAGE_ID_LENGTH',230);
+ Header('Location: index.php');
+ exit;
}
+ $GLOBALS['phpgw_setup']->loaddb();
if (@$_POST['submit'])
{
- $lang_selected = @$_POST['lang_selected'];
- $upgrademethod = @$_POST['upgrademethod'];
-
- if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod != 'dumpold')
- {
- $GLOBALS['phpgw_setup']->db->query("select * from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__);
- if ($GLOBALS['phpgw_setup']->db->next_record())
- {
- $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize(stripslashes($GLOBALS['phpgw_setup']->db->f('config_value')));
- }
- }
-
- $GLOBALS['phpgw_setup']->db->transaction_begin();
- if (count($lang_selected))
- {
- if ($upgrademethod == 'dumpold')
- {
- // dont delete the custom main- & loginscreen messages every time
- $GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_lang where app_name != 'mainscreen' AND app_name != 'loginscreen'",__LINE__,__FILE__);
- //echo '
Test: dumpold';
- $GLOBALS['phpgw_info']['server']['lang_ctimes'] = array();
- }
- foreach($lang_selected as $lang)
- {
- //echo '
Working on: ' . $lang;
- $addlang = False;
- if ($upgrademethod == 'addonlynew')
- {
- //echo "
Test: addonlynew - select count(*) from phpgw_lang where lang='".$lang."'";
- $GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE lang='".$lang."'",__LINE__,__FILE__);
- $GLOBALS['phpgw_setup']->db->next_record();
+ include(PHPGW_API_INC.'/class.translation_sql.inc.php');
+ $translation = new translation;
- if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
- {
- //echo '
Test: addonlynew - True';
- $addlang = True;
- }
- }
- if (($addlang && $upgrademethod == 'addonlynew') || ($upgrademethod != 'addonlynew'))
- {
- //echo '
Test: loop above file()';
- $setup_info = $GLOBALS['phpgw_setup']->detection->get_versions();
- $setup_info = $GLOBALS['phpgw_setup']->detection->get_db_versions($setup_info);
- $raw = array();
- // Visit each app/setup dir, look for a phpgw_lang file
- while (list($key,$app) = each($setup_info))
- {
- $appfile = PHPGW_SERVER_ROOT . SEP . @$app['name'] . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) . '.lang';
- //echo '
Checking in: ' . $app['name'];
- if($GLOBALS['phpgw_setup']->app_registered(@$app['name']) && file_exists($appfile))
- {
- //echo '
Including: ' . $appfile;
- $lines = file($appfile);
- foreach($lines as $line)
- {
- list($message_id,$app_name,,$content) = explode("\t",$line);
- $message_id = $GLOBALS['phpgw_setup']->db->db_addslashes(substr(strtolower(chop($message_id)),0,MAX_MESSAGE_ID_LENGTH));
- $app_name = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));
- $content = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($content));
-
- $raw[$app_name][$message_id] = $content;
- }
- $GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app['name']] = filectime($appfile);
- }
- }
- foreach($raw as $app_name => $ids)
- {
- foreach($ids as $message_id => $content)
- {
- $addit = False;
- //echo '
APPNAME:' . $app_name . ' PHRASE:' . $message_id;
- if ($upgrademethod == 'addmissing')
- {
- //echo '
Test: addmissing';
- $GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE message_id='$message_id' AND lang='$lang' AND (app_name='$app_name' OR app_name='common') AND content='$content'",__LINE__,__FILE__);
- $GLOBALS['phpgw_setup']->db->next_record();
+ $translation->install_langs(@$_POST['lang_selected'],@$_POST['upgrademethod']);
+ }
+ if(@$_POST['submit'] || @$_POST['cancel'])
+ {
+ Header('Location: index.php');
+ exit;
+ }
- if ($GLOBALS['phpgw_setup']->db->f(0) == 0)
- {
- //echo '
Test: addmissing - True - Total: ' . $GLOBALS['phpgw_setup']->db->f(0);
- $addit = True;
- }
- }
+ $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
+ $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
+ $setup_tpl->set_file(array(
+ 'T_head' => 'head.tpl',
+ 'T_footer' => 'footer.tpl',
+ 'T_alert_msg' => 'msg_alert_msg.tpl',
+ 'T_lang_main' => 'lang_main.tpl'
+ ));
- if ($addit || @$newinstall || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold')
- {
- if($message_id && $content)
- {
- //echo "
adding - insert into phpgw_lang values ('$message_id','$app_name','$lang','$content')";
- $result = $GLOBALS['phpgw_setup']->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content) VALUES('$message_id','$app_name','$lang','$content')",__LINE__,__FILE__);
- if (intval($result) <= 0)
- {
- echo "
Error inserting record: phpgw_lang values ('$message_id','$app_name','$lang','$content')";
- }
- }
- }
- }
- }
- }
- }
- $GLOBALS['phpgw_setup']->db->transaction_commit();
-
- $GLOBALS['phpgw_setup']->db->query("DELETE from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__);
- $GLOBALS['phpgw_setup']->db->query($query="INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES ('phpgwapi','lang_ctimes','".
- addslashes(serialize($GLOBALS['phpgw_info']['server']['lang_ctimes']))."')",__LINE__,__FILE__);
- }
- if(!@$included)
- {
- Header('Location: index.php');
- exit;
- }
+ $setup_tpl->set_block('T_lang_main','B_choose_method','V_choose_method');
+
+ $stage_title = lang('Multi-Language support setup');
+ $stage_desc = lang('This program will help you upgrade or install different languages for phpGroupWare');
+ $tbl_width = @$newinstall ? '60%' : '80%';
+ $td_colspan = @$newinstall ? '1' : '2';
+ $td_align = @$newinstall ? ' align="center"' : '';
+ $hidden_var1 = @$newinstall ? '' : '';
+
+ if (!@$newinstall && !isset($GLOBALS['phpgw_info']['setup']['installed_langs']))
+ {
+ $GLOBALS['phpgw_setup']->detection->check_lang(false); // get installed langs
+ }
+ $select_box_desc = lang('Select which languages you would like to use');
+ $select_box = '';
+ $GLOBALS['phpgw_setup']->db->query($q="SELECT lang_id,lang_name FROM phpgw_languages WHERE available='Yes' ORDER BY lang_name");
+ while ($GLOBALS['phpgw_setup']->db->next_record())
+ {
+ $id = $GLOBALS['phpgw_setup']->db->f('lang_id');
+ $select_box_langs =
+ @$select_box_langs
+ .''
+ ."\n";
+ }
+
+ if (!@$newinstall)
+ {
+ $meth_desc = lang('Select which method of upgrade you would like to do');
+ $blurb_addonlynew = lang('Only add languages that are not in the database already');
+ $blurb_addmissing = lang('Only add new phrases');
+ $blurb_dumpold = lang('Delete all old languages and install new ones');
+
+ $setup_tpl->set_var('meth_desc',$meth_desc);
+ $setup_tpl->set_var('blurb_addonlynew',$blurb_addonlynew);
+ $setup_tpl->set_var('blurb_addmissing',$blurb_addmissing);
+ $setup_tpl->set_var('blurb_dumpold',$blurb_dumpold);
+ $setup_tpl->parse('V_choose_method','B_choose_method');
}
else
{
- if (@$_POST['cancel'])
- {
- Header('Location: index.php');
- exit;
- }
-
- if (!@$included)
- {
- $tpl_root = $GLOBALS['phpgw_setup']->html->setup_tpl_dir('setup');
- $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
- $setup_tpl->set_file(array(
- 'T_head' => 'head.tpl',
- 'T_footer' => 'footer.tpl',
- 'T_alert_msg' => 'msg_alert_msg.tpl',
- 'T_lang_main' => 'lang_main.tpl'
- ));
-
- $setup_tpl->set_block('T_lang_main','B_choose_method','V_choose_method');
-
- $stage_title = lang('Multi-Language support setup');
- $stage_desc = lang('This program will help you upgrade or install different languages for phpGroupWare');
- $tbl_width = @$newinstall ? '60%' : '80%';
- $td_colspan = @$newinstall ? '1' : '2';
- $td_align = @$newinstall ? ' align="center"' : '';
- $hidden_var1 = @$newinstall ? '' : '';
-
- if (!@$newinstall && !isset($GLOBALS['phpgw_info']['setup']['installed_langs']))
- {
- $GLOBALS['phpgw_setup']->detection->check_lang(false); // get installed langs
- }
- $select_box_desc = lang('Select which languages you would like to use');
- $select_box = '';
- $GLOBALS['phpgw_setup']->db->query($q="SELECT lang_id,lang_name FROM phpgw_languages WHERE available='Yes' ORDER BY lang_name");
- while ($GLOBALS['phpgw_setup']->db->next_record())
- {
- $id = $GLOBALS['phpgw_setup']->db->f('lang_id');
- $select_box_langs =
- @$select_box_langs
- .''
- ."\n";
- }
-
- if (!@$newinstall)
- {
- $meth_desc = lang('Select which method of upgrade you would like to do');
- $blurb_addonlynew = lang('Only add languages that are not in the database already');
- $blurb_addmissing = lang('Only add new phrases');
- $blurb_dumpold = lang('Delete all old languages and install new ones');
-
- $setup_tpl->set_var('meth_desc',$meth_desc);
- $setup_tpl->set_var('blurb_addonlynew',$blurb_addonlynew);
- $setup_tpl->set_var('blurb_addmissing',$blurb_addmissing);
- $setup_tpl->set_var('blurb_dumpold',$blurb_dumpold);
- $setup_tpl->parse('V_choose_method','B_choose_method');
- }
- else
- {
- $setup_tpl->set_var('V_choose_method','');
- }
-
- $setup_tpl->set_var('stage_title',$stage_title);
- $setup_tpl->set_var('stage_desc',$stage_desc);
- $setup_tpl->set_var('tbl_width',$tbl_width);
- $setup_tpl->set_var('td_colspan',$td_colspan);
- $setup_tpl->set_var('td_align',$td_align);
- $setup_tpl->set_var('hidden_var1',$hidden_var1);
- $setup_tpl->set_var('select_box_desc',$select_box_desc);
- $setup_tpl->set_var('select_box_langs',$select_box_langs);
-
- $setup_tpl->set_var('lang_install',lang('install'));
- $setup_tpl->set_var('lang_cancel',lang('cancel'));
-
- $ConfigDomain = $GLOBALS['HTTP_COOKIE_VARS']['ConfigDomain'] ? $GLOBALS['HTTP_COOKIE_VARS']['ConfigDomain'] : $_POST['ConfigDomain'];
- $GLOBALS['phpgw_setup']->html->show_header("$stage_title",False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
- $setup_tpl->pparse('out','T_lang_main');
- $GLOBALS['phpgw_setup']->html->show_footer();
- }
+ $setup_tpl->set_var('V_choose_method','');
}
+
+ $setup_tpl->set_var('stage_title',$stage_title);
+ $setup_tpl->set_var('stage_desc',$stage_desc);
+ $setup_tpl->set_var('tbl_width',$tbl_width);
+ $setup_tpl->set_var('td_colspan',$td_colspan);
+ $setup_tpl->set_var('td_align',$td_align);
+ $setup_tpl->set_var('hidden_var1',$hidden_var1);
+ $setup_tpl->set_var('select_box_desc',$select_box_desc);
+ $setup_tpl->set_var('select_box_langs',$select_box_langs);
+
+ $setup_tpl->set_var('lang_install',lang('install'));
+ $setup_tpl->set_var('lang_cancel',lang('cancel'));
+
+ $ConfigDomain = $_COOKIE['ConfigDomain'] ? $_COOKIE['ConfigDomain'] : $_POST['ConfigDomain'];
+ $GLOBALS['phpgw_setup']->html->show_header("$stage_title",False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
+ $setup_tpl->pparse('out','T_lang_main');
+ $GLOBALS['phpgw_setup']->html->show_footer();
?>
diff --git a/setup/setup_demo.php b/setup/setup_demo.php
index 37bf415850..cf900ea407 100644
--- a/setup/setup_demo.php
+++ b/setup/setup_demo.php
@@ -192,7 +192,7 @@
"tz_offset" => 0,
"dateformat" => "Y/m/d",
"timeformat" => "24",
- "lang" => "en",
+ "lang" => get_var('ConfigLang',Array('POST','COOKIE'),'en'),
"default_app" => "calendar",
"currency" => "$",
'show_help' => True,
diff --git a/setup/templates/default/setup_main.tpl b/setup/templates/default/setup_main.tpl
index db102de9fe..e27fb4f05d 100644
--- a/setup/templates/default/setup_main.tpl
+++ b/setup/templates/default/setup_main.tpl
@@ -2,8 +2,7 @@
- {db_step_text} |
- |
+ {db_step_text} |
{V_db_filled_block}
@@ -11,11 +10,10 @@
- {config_step_text} |
- |
+ {config_step_text} |
-
+ |
|
@@ -31,8 +29,7 @@
|
- {lang_step_text} |
- |
+ {lang_step_text} |
@@ -45,8 +42,7 @@
|
- {apps_step_text} |
- |
+ {apps_step_text} |
|