mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
support to set the client-encoding (charset) for the DB and select a system-charset (utf-8 or others) at installation time
This commit is contained in:
parent
52fbe1064f
commit
64976f0b1c
@ -53,7 +53,7 @@
|
||||
@function loaddb
|
||||
@abstract include api db class for the ConfigDomain and connect to the db
|
||||
*/
|
||||
function loaddb()
|
||||
function loaddb($connect_and_setcharset=true)
|
||||
{
|
||||
if(!isset($this->ConfigDomain) || empty($this->ConfigDomain))
|
||||
{
|
||||
@ -75,6 +75,19 @@
|
||||
$this->db->Password = $GLOBALS['phpgw_domain'][$this->ConfigDomain]['db_pass'];
|
||||
|
||||
$this->db->set_app('phpgwapi');
|
||||
|
||||
if ($connect_and_setcharset)
|
||||
{
|
||||
$this->Halt_On_Error = 'no'; // table might not be created at that stage
|
||||
|
||||
// Set the DB's client charset if a system-charset is set
|
||||
$this->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='system_charset'",__LINE__,__FILE__);
|
||||
if ($this->db->next_record() && $this->db->f(0))
|
||||
{
|
||||
$this->db->Link_ID->SetCharSet($this->db->f(0));
|
||||
}
|
||||
$this->db->Halt_On_Error = 'yes'; // setting the default again
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,5 +131,51 @@
|
||||
}
|
||||
return $this->sql->install_langs($langs,'dumpold');
|
||||
}
|
||||
|
||||
/**
|
||||
* List availible charsets and it's supported languages
|
||||
* @param boolean/string $name=false name for selectbox or false to return an array
|
||||
* @param string $selected selected charset
|
||||
* @return string/array html for a selectbox or array with charset / languages pairs
|
||||
*/
|
||||
function get_charsets($name=false,$selected='')
|
||||
{
|
||||
$charsets = array(
|
||||
'utf-8' => 'utf-8: '.lang('all languages (incl. not listed ones)'),
|
||||
);
|
||||
if (($f = fopen('lang/languages','r')))
|
||||
{
|
||||
while(($line = fgets($f)) !== false)
|
||||
{
|
||||
list($lang,$language) = explode("\t",trim($line));
|
||||
if ($lang && ($lf = fopen("../phpgwapi/setup/phpgw_$lang.lang",'r')))
|
||||
{
|
||||
while(($line = fgets($lf)) !== false)
|
||||
{
|
||||
list($phrase,,,$charset) = explode("\t",$line);
|
||||
if ($phrase == 'charset')
|
||||
{
|
||||
$charset = trim(strtolower($charset));
|
||||
|
||||
if ($charset != 'utf-8')
|
||||
{
|
||||
$charsets[$charset] .= (isset($charsets[$charset]) ? ', ' : $charset.': ') . $language;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose($lf);
|
||||
}
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
if (!$name)
|
||||
{
|
||||
return $charsets;
|
||||
}
|
||||
$html = CreateObject('phpgwapi.html');
|
||||
|
||||
return $html->select($name,strtolower($selected),$charsets,true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -167,6 +167,12 @@
|
||||
}
|
||||
$GLOBALS['phpgw']->db->Halt_On_Error = 'yes';
|
||||
|
||||
// Set the DB's client charset if a system-charset is set
|
||||
$GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='system_charset'",__LINE__,__FILE__);
|
||||
if ($GLOBALS['phpgw']->db->next_record() && $GLOBALS['phpgw']->db->f(0))
|
||||
{
|
||||
$GLOBALS['phpgw']->db->Link_ID->SetCharSet($GLOBALS['phpgw']->db->f(0));
|
||||
}
|
||||
/* Fill phpgw_info["server"] array */
|
||||
// An Attempt to speed things up using cache premise
|
||||
$GLOBALS['phpgw']->db->query("select config_value from phpgw_config WHERE config_app='phpgwapi' and config_name='cache_phpgw_info'",__LINE__,__FILE__);
|
||||
|
@ -230,8 +230,8 @@
|
||||
$setup_tpl->set_var('proceed',lang('We can proceed'));
|
||||
$setup_tpl->set_var('coreapps',lang('all applications'));
|
||||
$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
|
||||
$setup_tpl->set_var('lang_system_charset',lang('use utf-8 (unicode) as system-charset (recomended if you use languages with different charsets or your language uses utf-8 as charset)'));
|
||||
$setup_tpl->set_var('utf8_checked',lang('charset') == 'uft-8' ? 'checked' : '');
|
||||
$setup_tpl->set_var('lang_system_charset',lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):'));
|
||||
$setup_tpl->set_var('system_charset',$GLOBALS['phpgw_setup']->translation->get_charsets('system_charset',lang('charset')));
|
||||
$setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.'));
|
||||
$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> '.
|
||||
'<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />');
|
||||
@ -322,6 +322,11 @@
|
||||
else
|
||||
{
|
||||
$setup_info = $GLOBALS['phpgw_setup']->detection->upgrade_exclude($setup_info);
|
||||
// Set the DB's client charset if a system-charset is set
|
||||
if ($_REQUEST['system_charset'])
|
||||
{
|
||||
$GLOBALS['phpgw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']);
|
||||
}
|
||||
$setup_info = $GLOBALS['phpgw_setup']->process->pass($setup_info,'new',$_REQUEST['debug'],True,$_REQUEST['system_charset']);
|
||||
$GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
00 (disable) setup de 00 (abgeschaltet/empfohlen)
|
||||
13 (ntp) setup de 13 (ntp)
|
||||
80 (http) setup de 80 (http)
|
||||
<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets): setup de <b>Zeichensatz</b> (benutzen sie utf-8 wenn sie planen Sprachen mit verschiedenen Zeichensätzen zu verwenden)
|
||||
<b>this will create 1 admin account and 3 demo accounts</b><br>the username/passwords are: demo/guest, demo2/guest and demo3/guest. setup de <b>Dies wird 1 Admin- und 3 Demo-Benutzerkonten anlegen.</b><br>Die Benutzernamen/Passwörter sind: demo/guest, demo2/guest und demo3/guest.
|
||||
accounts existing setup de Benutzerkonten existieren
|
||||
actions setup de Aktionen
|
||||
@ -23,6 +24,7 @@ after backing up your tables first. setup de Nach einer Datensicherung Ihrer Tab
|
||||
after retrieving the file, put it into place as the header.inc.php. then, click "continue". setup de Datei nach dem Herunterladen als header.inc.php speichern. Danach auf "Weiter" klicken.
|
||||
all applications setup de Alle Anwendungen
|
||||
all core tables and the admin and preferences applications setup de Sie alle Kern-Tabellen und die Anwendungen Admin und Einstellungen
|
||||
all languages (incl. not listed ones) setup de alle Sprachen (einschl. nicht aufgeführte)
|
||||
all users setup de Alle Benutzer
|
||||
analysis setup de Analyse
|
||||
and reload your webserver, so the above changes take effect !!! setup de UND reloaden Sie ihren Webserver, damit die obigen Änderungen in Kraft treten!!!
|
||||
@ -194,6 +196,7 @@ go back setup de Zur
|
||||
go to setup de Gehen zu
|
||||
grant access setup de Zugriff gewähren
|
||||
has a version mismatch setup de hat eine falsche Versionsanpassung
|
||||
header 0assword setup de Passwor Headerverwaltung
|
||||
header admin login setup de Login Headerverwaltung
|
||||
header password setup de Passwort der Headerverwaltung
|
||||
header username setup de Benutzername der Headerverwaltung
|
||||
@ -358,6 +361,8 @@ safe_mode is turned on, which is generaly a good thing as it makes your install
|
||||
sample configuration not found. using built in defaults setup de Beispiel Konfiguration nicht gefunden, benutze eingebaute Voreinstellungen
|
||||
save setup de Speichern
|
||||
save this text as contents of your header.inc.php setup de Speichern Sie diesen Text als Datei header.inc.php
|
||||
schedule setup de planen
|
||||
scheduled backups setup de Regelmäßige Datensicherungen
|
||||
select an app, enter a target version, then submit to process to that version.<br>if you do not enter a version, only the baseline tables will be installed for the app.<br><blink>this will drop all of the apps' tables first!</blink> setup de Wählen Sie eine Applikation, geben Sie eine Zielversion ein, dann bestätigen Sie den Vorgang.<br>Wenn Sie keine Version angeben, werden nur die Basis-Tabellen der Applikation installiert werden.<br><blink>DIES WIRD ZUERST ALLE TABELLEN DER APPLI
|
||||
select one... setup de Einen auswählen...
|
||||
select the default applications to which your users will have access setup de Wählen Sie die voreingestellten Anwendungen, zu denen Ihre Benutzer Zugriff haben werden
|
||||
@ -390,8 +395,6 @@ setup demo accounts in ldap setup de Demo-Benutzer in LDAP einrichten
|
||||
setup main menu setup de Setup-Hauptmenü
|
||||
setup the database setup de Datenbank einzurichten
|
||||
setup/config admin login setup de Setup-/Konfigurationsadmin-Login
|
||||
schedule setup de planen
|
||||
scheduled backups setup de Regelmäßige Datensicherungen
|
||||
show 'powered by' logo on setup de Zeige "powered by" Logo
|
||||
size setup de Größe
|
||||
some or all of its tables are missing setup de Einige oder alle Tabellen fehlen
|
||||
@ -456,7 +459,6 @@ uploads a backup and installs it on your db setup de l
|
||||
uploads a backup to the backup-dir, from where you can restore it setup de Läde eine Datensicherung in das Datensicherungsverzeichnis, von wo sie diese zurücksichern können
|
||||
use cookies to pass sessionid setup de SitzungsId in einem Cookie speichern
|
||||
use pure html compliant code (not fully working yet) setup de Vollständig HTML kompatiblen Code verwenden (nicht vollständig implementiert)
|
||||
use utf-8 (unicode) as system-charset (recomended if you use languages with different charsets or your language uses utf-8 as charset) setup de utf-8 (Unicode) als Systemzeichensatz benutzen (empfohlen wenn Sie Sprachen mit verschiedenem Zeichensätzen verwenden oder ihrer Sprache utf-8 als Zeichensatz verwendet)
|
||||
user account prefix setup de Präfix für Benutzernamen
|
||||
usernames are casesensitive setup de Benutzername mit Unterscheidung zwischen Groß- und Kleinschreibung
|
||||
users choice setup de Benutzerauswahl
|
||||
|
@ -6,6 +6,7 @@
|
||||
00 (disable) setup en 00 (disable / recomended)
|
||||
13 (ntp) setup en 13 (ntp)
|
||||
80 (http) setup en 80 (http)
|
||||
<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets): setup en <b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):
|
||||
<b>this will create 1 admin account and 3 demo accounts</b><br>the username/passwords are: demo/guest, demo2/guest and demo3/guest. setup en <b>This will create 1 admin account and 3 demo accounts</b><br>The username/passwords are: demo/guest, demo2/guest and demo3/guest.
|
||||
accounts existing setup en Accounts existing
|
||||
actions setup en Actions
|
||||
@ -23,6 +24,7 @@ after backing up your tables first. setup en After backing up your tables first.
|
||||
after retrieving the file, put it into place as the header.inc.php. then, click "continue". setup en After retrieving the file, put it into place as the header.inc.php. Then, click "continue".
|
||||
all applications setup en all applications
|
||||
all core tables and the admin and preferences applications setup en all core tables and the admin and preferences applications
|
||||
all languages (incl. not listed ones) setup en all languages (incl. not listed ones)
|
||||
all users setup en All Users
|
||||
analysis setup en Analysis
|
||||
and reload your webserver, so the above changes take effect !!! setup en AND reload your webserver, so the above changes take effect !!!
|
||||
@ -191,8 +193,8 @@ go back setup en Go back
|
||||
go to setup en Go to
|
||||
grant access setup en Grant Access
|
||||
has a version mismatch setup en has a version mismatch
|
||||
header 0assword setup en Header Password
|
||||
header admin login setup en Header Admin Login
|
||||
header password setup en Header Password
|
||||
header username setup en Header Username
|
||||
historylog removed setup en Historylog removed
|
||||
hooks deregistered setup en hooks deregistered
|
||||
@ -355,6 +357,8 @@ safe_mode is turned on, which is generaly a good thing as it makes your install
|
||||
sample configuration not found. using built in defaults setup en Sample configuration not found. using built in defaults
|
||||
save setup en Save
|
||||
save this text as contents of your header.inc.php setup en Save this text as contents of your header.inc.php
|
||||
schedule setup en schedule
|
||||
scheduled backups setup en scheduled backups
|
||||
select an app, enter a target version, then submit to process to that version.<br>if you do not enter a version, only the baseline tables will be installed for the app.<br><blink>this will drop all of the apps' tables first!</blink> setup en Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>
|
||||
select one... setup en select one...
|
||||
select the default applications to which your users will have access setup en Select the default applications to which your users will have access
|
||||
@ -387,8 +391,6 @@ setup demo accounts in ldap setup en Setup demo accounts in LDAP
|
||||
setup main menu setup en Setup Main Menu
|
||||
setup the database setup en Setup the database
|
||||
setup/config admin login setup en Setup/Config Admin Login
|
||||
schedule setup en schedule
|
||||
scheduled backups setup en scheduled backups
|
||||
show 'powered by' logo on setup en Show 'powered by' logo on
|
||||
size setup en size
|
||||
some or all of its tables are missing setup en Some or all of its tables are missing
|
||||
@ -452,7 +454,6 @@ uploads a backup and installs it on your db setup en uploads a backup and instal
|
||||
uploads a backup to the backup-dir, from where you can restore it setup en uploads a backup to the backup-dir, from where you can restore it
|
||||
use cookies to pass sessionid setup en Use cookies to pass sessionid
|
||||
use pure html compliant code (not fully working yet) setup en Use pure HTML compliant code (not fully working yet)
|
||||
use utf-8 (unicode) as system-charset (recomended if you use languages with different charsets or your language uses utf-8 as charset) setup en use utf-8 (unicode) as system-charset (recomended if you use languages with different charsets or your language uses utf-8 as charset)
|
||||
user account prefix setup en User account prefix
|
||||
usernames are casesensitive setup en Usernames are casesensitive
|
||||
users choice setup en Users Choice
|
||||
|
@ -68,8 +68,8 @@
|
||||
|
||||
{dbexists}<br>
|
||||
<input type="hidden" name="action" value="Install">
|
||||
{lang_system_charset} {system_charset}<br>
|
||||
<input type="checkbox" name="debug" value="1"> {lang_debug}<br>
|
||||
<input type="checkbox" name="system_charset" value="utf-8" {utf8_checked}> {lang_system_charset}<br>
|
||||
<input type="submit" name="label" value="{install}"> {coreapps}
|
||||
<hr>
|
||||
{lang_restore}<br>
|
||||
|
Loading…
Reference in New Issue
Block a user