Skip to content

Commit 00dfbaf

Browse files
author
redray
committed
charset corrections
1 parent 141f4cf commit 00dfbaf

26 files changed

+269
-1330
lines changed

install/dist/conf/centos52.conf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//* Main
66
$conf['language'] = 'en';
77
$conf['distname'] = 'centos52';
8-
$conf['hostname'] = 'server1.example.com'; // Full hostname
8+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
99
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
1010
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
1111
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
@@ -24,6 +24,7 @@
2424
$conf['mysql']['database'] = 'dbispconfig';
2525
$conf['mysql']['admin_user'] = 'root';
2626
$conf['mysql']['admin_password'] = '';
27+
$conf['mysql']['charset'] = 'utf8';
2728
$conf['mysql']['ispconfig_user'] = 'ispconfig';
2829
$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
2930

install/dist/conf/debian40.conf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//* Main
66
$conf['language'] = 'en';
77
$conf['distname'] = 'debian40';
8-
$conf['hostname'] = 'server1.example.com'; // Full hostname
8+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
99
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
1010
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
1111
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
@@ -24,6 +24,7 @@
2424
$conf['mysql']['database'] = 'dbispconfig';
2525
$conf['mysql']['admin_user'] = 'root';
2626
$conf['mysql']['admin_password'] = '';
27+
$conf['mysql']['charset'] = 'utf8';
2728
$conf['mysql']['ispconfig_user'] = 'ispconfig';
2829
$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
2930

install/dist/conf/fedora9.conf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//* Main
66
$conf['language'] = 'en';
77
$conf['distname'] = 'fedora9';
8-
$conf['hostname'] = 'server1.example.com'; // Full hostname
8+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
99
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
1010
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
1111
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
@@ -24,6 +24,7 @@
2424
$conf['mysql']['database'] = 'dbispconfig';
2525
$conf['mysql']['admin_user'] = 'root';
2626
$conf['mysql']['admin_password'] = '';
27+
$conf['mysql']['charset'] = 'utf8';
2728
$conf['mysql']['ispconfig_user'] = 'ispconfig';
2829
$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
2930

install/dist/conf/opensuse110.conf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//* Main
66
$conf['language'] = 'en';
77
$conf['distname'] = 'opensuse110';
8-
$conf['hostname'] = 'server1.example.com'; // Full hostname
8+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
99
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
1010
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
1111
$conf['ispconfig_log_priority'] = 2; // 0 = Debug, 1 = Warning, 2 = Error
@@ -24,6 +24,7 @@
2424
$conf['mysql']['database'] = 'dbispconfig';
2525
$conf['mysql']['admin_user'] = 'root';
2626
$conf['mysql']['admin_password'] = '';
27+
$conf['mysql']['charset'] = 'utf8';
2728
$conf['mysql']['ispconfig_user'] = 'ispconfig';
2829
$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
2930

install/install.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
ISPConfig 3 installer.
3333
*/
3434

35-
//** Check for existing installation
36-
//if(is_dir("/usr/local/ispconfig")) die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.');
37-
3835
error_reporting(E_ALL|E_STRICT);
3936

4037
//** The banner on the command line
@@ -56,20 +53,25 @@
5653
//** Include the base class of the installer class
5754
require_once('lib/installer_base.lib.php');
5855

56+
//** Install logfile
57+
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
58+
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));
59+
60+
//** Check for existing installation
61+
/*if(is_dir("/usr/local/ispconfig")) {
62+
die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.');
63+
}*/
64+
5965
//** Get distribution identifier
6066
$dist = get_distname();
6167

62-
if($dist['id'] == '') die('Linux Dustribution or Version not recognized.');
68+
if($dist['id'] == '') die('Linux Distribution or Version not recognized.');
6369

6470
//** Include the distribution specific installer class library and configuration
6571
if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
6672
include_once('dist/lib/'.$dist['id'].'.lib.php');
6773
include_once('dist/conf/'.$dist['id'].'.conf.php');
6874

69-
//** Install logfile
70-
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
71-
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));
72-
7375
//****************************************************************************************************
7476
//** Installer Interface
7577
//****************************************************************************************************
@@ -97,7 +99,7 @@
9799
//** Get the hostname
98100
$tmp_out = array();
99101
exec('hostname -f', $tmp_out);
100-
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg foo.example.com ', $tmp_out[0]);
102+
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $tmp_out[0]);
101103
unset($tmp_out);
102104

103105
//** Get MySQL root credentials
@@ -107,13 +109,15 @@
107109
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user']);
108110
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
109111
$tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']);
112+
$tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset']);
110113

111114
//* Initialize the MySQL server connection
112115
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
113116
$conf['mysql']['host'] = $tmp_mysql_server_host;
114117
$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
115118
$conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password;
116119
$conf['mysql']['database'] = $tmp_mysql_server_database;
120+
$conf['mysql']['charset'] = $tmp_mysql_server_charset;
117121
$finished = true;
118122
} else {
119123
swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());

install/lib/installer_base.lib.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function configure_database()
119119

120120
$cf = $conf['mysql']; // make $conf['mysql'] more accessible
121121
//** Create the database
122-
if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$cf['database'])) {
122+
if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$cf['database'].' DEFAULT CHARACTER SET '.$cf['charset'])) {
123123
$this->error('Unable to create MySQL database: '.$cf['database'].'.');
124124
}
125125

@@ -132,10 +132,10 @@ public function configure_database()
132132
$this->error('Stopped: Database already contains some tables.');
133133
} else {
134134
if($cf['admin_password'] == '') {
135-
caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
135+
caselog("mysql --default-character-set=".$cf['charset']." -h '".$cf['host']."' -u '".$cf['admin_user']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
136136
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
137137
} else {
138-
caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' -p'".$cf['admin_password']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
138+
caselog("mysql --default-character-set=".$cf['charset']." -h '".$cf['host']."' -u '".$cf['admin_user']."' -p'".$cf['admin_password']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
139139
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
140140
}
141141
$db_tables = $this->db->getTables();

install/lib/mysql.lib.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@
2929

3030
class db
3131
{
32-
var $dbHost = ""; // hostname of the MySQL server
33-
var $dbName = ""; // logical database name on that server
34-
var $dbUser = ""; // database authorized user
35-
var $dbPass = ""; // user's password
36-
var $linkId = 0; // last result of mysql_connect()
37-
var $queryId = 0; // last result of mysql_query()
38-
var $record = array(); // last record fetched
39-
var $autoCommit = 1; // Autocommit Transactions
40-
var $currentRow; // current row number
41-
var $errorNumber = 0; // last error number
42-
var $errorMessage = ""; // last error message
43-
var $errorLocation = "";// last error location
32+
var $dbHost = ""; // hostname of the MySQL server
33+
var $dbName = ""; // logical database name on that server
34+
var $dbUser = ""; // database authorized user
35+
var $dbPass = ""; // user's password
36+
var $dbCharset = ""; // what charset comes and goes to mysql: utf8 / latin1
37+
var $linkId = 0; // last result of mysql_connect()
38+
var $queryId = 0; // last result of mysql_query()
39+
var $record = array(); // last record fetched
40+
var $autoCommit = 1; // Autocommit Transactions
41+
var $currentRow; // current row number
42+
var $errorNumber = 0; // last error number
43+
var $errorMessage = ""; // last error message
44+
var $errorLocation = ""; // last error location
4445
var $show_error_messages = false;
4546

4647
// constructor
@@ -52,6 +53,7 @@ function db()
5253
//$this->dbName = $conf["mysql"]["database"];
5354
$this->dbUser = $conf["mysql"]["admin_user"];
5455
$this->dbPass = $conf["mysql"]["admin_password"];
56+
$this->dbCharset = $conf["mysql"]["charset"];
5557
//$this->connect();
5658
}
5759

@@ -79,6 +81,7 @@ function connect()
7981
$this->updateError('DB::connect()<br />mysql_connect');
8082
return false;
8183
}
84+
$this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId);
8285
}
8386
return true;
8487
}

install/options.conf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
$conf['language'] = 'en';
88
$conf['distname'] = 'debian40';
9-
$conf['hostname'] = 'server1.example.com'; // Full hostname
9+
$conf['hostname'] = 'server1.domain.tld'; // Full hostname
1010
$conf['ispconfig_install_dir'] = '/usr/local/ispconfig';
1111
$conf['ispconfig_config_dir'] = '/usr/local/ispconfig';
1212
$conf['server_id'] = 1;
@@ -18,6 +18,7 @@
1818
$conf['mysql']['database'] = 'dbispconfig';
1919
$conf['mysql']['admin_user'] = 'root';
2020
$conf['mysql']['admin_password'] = '';
21+
$conf['mysql']['charset'] = 'utf8';
2122
$conf['mysql']['ispconfig_user'] = 'ispconfig';
2223
$conf['mysql']['ispconfig_password'] = '5sDrewBhk';
2324

0 commit comments

Comments
 (0)