diff --git a/phpgwapi/inc/class.translation.inc.php b/phpgwapi/inc/class.translation.inc.php
index e1896ede58..0f1e66282b 100644
--- a/phpgwapi/inc/class.translation.inc.php
+++ b/phpgwapi/inc/class.translation.inc.php
@@ -69,14 +69,7 @@
}
else
{
- $this->db->select($this->config_table,'config_value',array(
- 'config_app'=>'phpgwapi',
- 'config_name'=>'system_charset'
- ),__LINE__,__FILE__);
- if ($this->db->next_record())
- {
- $this->system_charset = $this->db->f(0);
- }
+ $this->system_charset =& $GLOBALS['egw_setup']->system_charset;
}
// load multi-byte-string-extension if needed, and set its internal encodeing to your system_charset
if ($this->system_charset && substr($this->system_charset,0,9) != 'iso-8859-1')
diff --git a/setup/setup_demo.php b/setup/admin_account.php
similarity index 89%
rename from setup/setup_demo.php
rename to setup/admin_account.php
index 28cb43ae1a..e592885cff 100644
--- a/setup/setup_demo.php
+++ b/setup/admin_account.php
@@ -29,8 +29,28 @@
Header('Location: index.php');
exit;
}
+ $GLOBALS['egw_setup']->loaddb(true);
- if(!get_var('submit',Array('POST')))
+ $error = '';
+ if ($_POST['submit'])
+ {
+ /* Posted admin data */
+ $passwd = get_var('passwd',Array('POST'));
+ $passwd2 = get_var('passwd2',Array('POST'));
+ $username = get_var('username',Array('POST'));
+ $fname = get_var('fname',Array('POST'));
+ $lname = get_var('lname',Array('POST'));
+
+ if($passwd != $passwd2 || !$username)
+ {
+ $error = '
'.lang('Passwords did not match, please re-enter') . ".
\n";
+ }
+ if(!$username)
+ {
+ $error = ''.lang('You must enter a username for the admin') . ".
\n";
+ }
+ }
+ if(!$_POST['submit'] || $error)
{
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
$setup_tpl = CreateObject('setup.Template',$tpl_root);
@@ -40,14 +60,20 @@
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
- 'T_setup_demo' => 'setup_demo.tpl'
+ 'T_admin_account' => 'admin_account.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
- $GLOBALS['egw_setup']->html->show_header(lang('Demo Server Setup'));
+ $GLOBALS['egw_setup']->html->show_header(lang('Create admin account'));
- $setup_tpl->set_var('action_url','setup_demo.php');
+ $setup_tpl->set_var(array(
+ 'error' => $error,
+ 'username' => $username,
+ 'fname' => $fname,
+ 'lname' => $lname,
+ ));
+ $setup_tpl->set_var('action_url','admin_account.php');
$setup_tpl->set_var('description',lang('This will create 1 admin account and 3 demo accounts
The username/passwords are: demo/guest, demo2/guest and demo3/guest.'));
$setup_tpl->set_var('lang_deleteall',lang('Delete all existing SQL accounts, groups, ACLs and preferences (normally not necessary)?'));
@@ -61,42 +87,21 @@
$setup_tpl->set_var('lang_submit',lang('Save'));
$setup_tpl->set_var('lang_cancel',lang('Cancel'));
- $setup_tpl->pparse('out','T_setup_demo');
+ $setup_tpl->pparse('out','T_admin_account');
$GLOBALS['egw_setup']->html->show_footer();
}
else
{
- /* Posted admin data */
- $passwd = get_var('passwd',Array('POST'));
- $passwd2 = get_var('passwd2',Array('POST'));
- $username = get_var('username',Array('POST'));
- $fname = get_var('fname',Array('POST'));
- $lname = get_var('lname',Array('POST'));
-
- if($passwd != $passwd2)
- {
- echo lang('Passwords did not match, please re-enter') . '.';
- exit;
- }
- if(!$username)
- {
- echo lang('You must enter a username for the admin') . '.';
- exit;
- }
-
- $GLOBALS['egw_setup']->loaddb();
/* Begin transaction for acl, etc */
$GLOBALS['egw_setup']->db->transaction_begin();
if($_POST['delete_all'])
{
/* Now, clear out existing tables */
- foreach(array($GLOBALS['egw_setup']->accounts_table,$GLOBALS['egw_setup']->prefs_table,$GLOBALS['egw_setup']->acl_table) as $table)
+ foreach(array($GLOBALS['egw_setup']->accounts_table,$GLOBALS['egw_setup']->prefs_table,$GLOBALS['egw_setup']->acl_table,'egw_access_log') as $table)
{
- $GLOBALS['egw_setup']->db->delete($table,'1=1');
+ $GLOBALS['egw_setup']->db->delete($table,'1=1',__LINE__,__FILE__);
}
- /* Clear the access log, since these are all new users anyway */
- $GLOBALS['egw_setup']->db->query('DELETE FROM egw_access_log');
}
/* Create the demo groups */
$defaultgroupid = (int)$GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php
index 182b8edeac..878ede3da8 100644
--- a/setup/inc/class.setup.inc.php
+++ b/setup/inc/class.setup.inc.php
@@ -38,10 +38,12 @@
var $cats_table = 'egw_categories';
var $oProc;
- var $detection = '';
- var $process = '';
- var $lang = '';
- var $html = '';
+ var $detection;
+ var $process;
+ var $lang;
+ var $html;
+
+ var $system_charset;
/* table name vars */
var $tbl_apps;
@@ -50,12 +52,17 @@
function setup($html=False, $translation=False)
{
+ // setup us as $GLOBALS['egw_setup'], as this gets used in our sub-objects
+ $GLOBALS['egw_setup'] =& $this;
+
$this->detection =& CreateObject('setup.setup_detection');
$this->process =& CreateObject('setup.setup_process');
+ if ($_REQUEST['system_charset']) $this->system_charset = $_REQUEST['system_charset'];
+
/* The setup application needs these */
- $this->html = $html ? CreateObject('setup.setup_html') : '';
- $this->translation = $translation ? CreateObject('setup.setup_translation') : '';
+ if ($html) $this->html =& CreateObject('setup.setup_html');
+ if ($translation) $this->translation =& CreateObject('setup.setup_translation');
}
/**
diff --git a/setup/inc/class.setup_html.inc.php b/setup/inc/class.setup_html.inc.php
index 5baf5ba1a6..0aa8203494 100644
--- a/setup/inc/class.setup_html.inc.php
+++ b/setup/inc/class.setup_html.inc.php
@@ -114,9 +114,9 @@
function show_header($title='',$nologoutbutton=False, $logoutfrom='config', $configdomain='')
{
// add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv)
- header('Content-type: text/html; charset='.lang('charset'));
+ header('Content-type: text/html; charset='.$GLOBALS['egw_setup']->system_charset);
- $GLOBALS['setup_tpl']->set_var('charset',lang('charset'));
+ $GLOBALS['setup_tpl']->set_var('charset',$GLOBALS['egw_setup']->system_charset);
$style = array(
'th_bg' => '#486591',
'th_text' => '#FFFFFF',
diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php
index 229ba7d25e..d2177bc6bb 100755
--- a/setup/inc/class.setup_process.inc.php
+++ b/setup/inc/class.setup_process.inc.php
@@ -57,7 +57,7 @@
* @param boolean $force_en=false install english language files
* @param string $system_charset=null charset to use
*/
- function pass($setup_info,$method='new',$DEBUG=False,$force_en=False,$system_charset=null)
+ function pass($setup_info,$method='new',$DEBUG=False,$force_en=False)
{
if(!$method)
{
@@ -118,7 +118,7 @@
case 'new':
/* Create tables and insert new records for each app in this list */
$passing = $this->current($pass,$DEBUG);
- $this->save_minimal_config($system_charset);
+ $this->save_minimal_config();
$passing = $this->default_records($passing,$DEBUG);
$do_langs = true; // just do it once at the end of all passes
break;
@@ -191,7 +191,7 @@
* saves a minimal default config, so you get a running install without entering and saveing Step #2 config
*
*/
- function save_minimal_config($system_charset)
+ function save_minimal_config()
{
$GLOBALS['current_config']['site_title'] = 'eGroupWare';
$GLOBALS['current_config']['hostname'] = $_SERVER['HTTP_HOST'];
@@ -202,9 +202,9 @@
{
$GLOBALS['current_config']['temp_dir'] = '/tmp';
}
- elseif(@is_dir('c:\\temp'))
+ elseif(@is_dir('c:\\windows\\temp'))
{
- $GLOBALS['current_config']['temp_dir'] = 'c:\\temp';
+ $GLOBALS['current_config']['temp_dir'] = 'c:\\windows\\temp';
}
else
{
@@ -223,13 +223,9 @@
// RalfBecker: php.net recommend this for security reasons, it should be our default too
$GLOBALS['current_config']['usecookies'] = 'True';
- if ($system_charset)
+ if ($GLOBALS['egw_setup']->system_charset)
{
- $GLOBALS['current_config']['system_charset'] = $system_charset;
- if (is_object($GLOBALS['egw_setup']->translation->sql))
- {
- $GLOBALS['egw_setup']->translation->sql->system_charset = $system_charset;
- }
+ $GLOBALS['current_config']['system_charset'] = $GLOBALS['egw_setup']->system_charset;
}
foreach($GLOBALS['current_config'] as $name => $value)
diff --git a/setup/inc/class.setup_translation.inc.php b/setup/inc/class.setup_translation.inc.php
index 1e1388aa2c..15a6755356 100644
--- a/setup/inc/class.setup_translation.inc.php
+++ b/setup/inc/class.setup_translation.inc.php
@@ -49,7 +49,7 @@
{
$lang = $ConfigLang;
}
-
+
$fn = '.' . SEP . 'lang' . SEP . 'phpgw_' . $lang . '.lang';
if (!file_exists($fn))
{
@@ -65,6 +65,11 @@
$this->langarray[strtolower(trim($message_id))] = str_replace("\n",'',$content);
}
fclose($fp);
+
+ if (!$GLOBALS['egw_setup']->system_charset)
+ {
+ $GLOBALS['egw_setup']->system_charset = $this->langarray['charset'];
+ }
}
}
@@ -82,6 +87,14 @@
{
$ret = $this->langarray[$key];
}
+ if ($GLOBALS['egw_setup']->system_charset != $this->langarray['charset'])
+ {
+ if (!is_object($this->sql))
+ {
+ $this->setup_translation_sql();
+ }
+ $ret = $this->sql->convert($ret,$this->langarray['charset']);
+ }
if (is_array($vars))
{
foreach($vars as $n => $var)
diff --git a/setup/index.php b/setup/index.php
index 9f46bad566..4f7487efc0 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -179,7 +179,7 @@
$setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management',1));
$setup_tpl->set_var('lang_system_charset',lang('charset to use (use utf-8 if you plan to use languages with different charsets):'));
$setup_tpl->set_var('system_charset',$GLOBALS['egw_setup']->translation->get_charsets('system_charset',
- $_POST['system_charset'] ? $_POST['system_charset'] : lang('charset')));
+ $GLOBALS['egw_setup']->system_charset));
switch($GLOBALS['egw_info']['setup']['stage']['db'])
{
@@ -339,7 +339,7 @@
$GLOBALS['egw_setup']->system_charset = $_REQUEST['system_charset'];
$GLOBALS['egw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']);
}
- $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'new',$_REQUEST['debug'],True,$_REQUEST['system_charset']);
+ $setup_info = $GLOBALS['egw_setup']->process->pass($setup_info,'new',$_REQUEST['debug'],True);
$GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
}
break;
@@ -373,7 +373,7 @@
$GLOBALS['egw_setup']->db->Halt_On_Error = 'no';
$setup_tpl->set_var('re-check_my_installation',lang('Re-Check My Installation'));
- $setup_tpl->set_var('system_charset',$_POST['system_charset']);
+ $setup_tpl->set_var('system_charset',$GLOBALS['egw']->system_charset);
$setup_tpl->parse('V_db_stage_6_post','B_db_stage_6_post');
$db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
@@ -504,7 +504,7 @@
$setup_tpl->set_var('admin_status_alt',$no_accounts ? lang('not completed') : lang('completed'));
$setup_tpl->set_var('admin_table_data',$GLOBALS['egw_setup']->html->make_frm_btn_simple(
$no_accounts ? lang('No accounts existing') : lang('Accounts existing'),
- 'post','setup_demo.php',
+ 'post','admin_account.php',
'submit',lang('Create admin account'),
''
));
@@ -551,10 +551,8 @@
'submit',lang('Manage Languages'),
'');
// show system-charset and offer conversation
- include_once(EGW_API_INC.'/class.translation.inc.php');
- $translation = new translation;
$btn_manage_lang .= lang('Current system-charset is %1, click %2here%3 to change it.',
- $translation->system_charset ? "'$translation->system_charset'" : lang('not set'),
+ $GLOBALS['egw_setup']->system_charset ? "'".$GLOBALS['egw_setup']->system_charset."'" : lang('not set'),
'','');
$setup_tpl->set_var('lang_table_data',$btn_manage_lang);
break;
diff --git a/setup/lang/languages b/setup/lang/languages
index 1a5587cc6b..c249813025 100644
--- a/setup/lang/languages
+++ b/setup/lang/languages
@@ -1,14 +1,14 @@
bg Bulgarian
-ca Catalán
+ca Catalán
cs Czech
da Danish
de Deutsch
en English
el Greek
-es-es Español
+es-es Español
fa Persian
fi Suomi
-fr Français
+fr Français
hr Croatian
hu Hungarian
it Italiano
diff --git a/setup/lang/phpgw_de.lang b/setup/lang/phpgw_de.lang
index 6c96ce3ae2..153b0cbe31 100644
--- a/setup/lang/phpgw_de.lang
+++ b/setup/lang/phpgw_de.lang
@@ -428,7 +428,7 @@ step %1 - db backup and restore setup de Schritt %1 - DB Datensicherung und Wied
step %1 - language management setup de Schritt %1 - Verwaltung der Sprachen
step %1 - simple application management setup de Schritt %1 - Einfache Verwaltung der Anwendungen
succesfully uploaded file %1 setup de Datei %1 erfolgreich hochgeladen
-table change messages setup de Tabellenänderungsmeldungen
+table change messages setup de Tabellenänderungsmeldungen
tables dropped setup de Tabellen wurden gelöscht
tables installed, unless there are errors printed above setup de Tabellen wurden installiert, außer oben sind Fehlermelungen zu sehen
tables upgraded setup de Tabellen wurden aktualisiert
diff --git a/setup/ldap.php b/setup/ldap.php
index 5971f730c0..321822cf24 100644
--- a/setup/ldap.php
+++ b/setup/ldap.php
@@ -64,7 +64,7 @@
$setup_tpl->set_var('ldapmodify','ldapmodify.php');
$setup_tpl->set_var('ldapimport','ldapimport.php');
$setup_tpl->set_var('ldapexport','ldapexport.php');
- $setup_tpl->set_var('ldapdummy','setup_demo.php');
+ $setup_tpl->set_var('ldapdummy','admin_account.php');
$setup_tpl->set_var('action_url','index.php');
$setup_tpl->set_var('cancel',lang('Cancel'));
diff --git a/setup/templates/default/setup_demo.tpl b/setup/templates/default/admin_account.tpl
similarity index 79%
rename from setup/templates/default/setup_demo.tpl
rename to setup/templates/default/admin_account.tpl
index ad3c26c302..ab27b79009 100644
--- a/setup/templates/default/setup_demo.tpl
+++ b/setup/templates/default/admin_account.tpl
@@ -1,4 +1,4 @@
-
+