Commit be9816ee authored by redray's avatar redray
Browse files

No commit message

No commit message
parent e51e75b6
......@@ -1041,6 +1041,7 @@ CREATE TABLE `web_database` (
`database_name` varchar(255) default NULL,
`database_user` varchar(255) default NULL,
`database_password` varchar(255) default NULL,
`database_charset` varchar(64) default NULL,
`remote_access` varchar(255) NOT NULL default 'y',
`active` varchar(255) NOT NULL default 'y',
PRIMARY KEY (`database_id`)
......
......@@ -192,11 +192,14 @@ class page_action extends tform_actions {
function onUpdate() {
global $app, $conf;
//* Prevent that the database name is changed
//* Prevent that the database name and charset is changed
$old_record = $app->tform->getDataRecord($this->id);
if($old_record["database_name"] != $this->dataRecord["database_name"]) {
$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
}
if($old_record["database_charset"] != $this->dataRecord["database_charset"]) {
$app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />';
}
unset($old_record);
parent::onUpdate();
......
......@@ -115,6 +115,12 @@ $form["tabs"]['database'] = array (
'width' => '30',
'maxlength' => '255'
),
'database_charset' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'y',
'value' => array('' => 'MySQL Default','latin1' => 'Latin 1','utf8' => 'UTF-8')
),
'remote_access' => array (
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
......
......@@ -4,6 +4,7 @@ $wb['type_txt'] = 'Type';
$wb['database_name_txt'] = 'Database name';
$wb['database_user_txt'] = 'Database user';
$wb['database_password_txt'] = 'Database password';
$wb["database_charset_txt"] = 'Database charset';
$wb['remote_access_txt'] = 'Remote Access';
$wb['client_txt'] = 'Client';
$wb['active_txt'] = 'Active';
......@@ -17,4 +18,5 @@ $wb['database_user_error_unique'] = 'There is already a database user with this
$wb['database_user_error_regex'] = 'Invalid database user name. The username may contain these characters: a-z, A-Z, 0-9 and the underscore. Length: 2 - 64 characters.';
$wb['limit_database_txt'] = 'The max. number of databases is reached.';
$wb['database_name_change_txt'] = 'The database name can not be changed';
$wb["database_charset_change_txt"] = 'The database charset can not be changed';
?>
......@@ -4,6 +4,7 @@ $wb["type_txt"] = 'Type';
$wb["database_name_txt"] = 'Database name';
$wb["database_user_txt"] = 'Database user';
$wb["database_password_txt"] = 'Database password';
$wb["database_charset_txt"] = 'Database charset';
$wb["remote_access_txt"] = 'Remote Access';
$wb["client_txt"] = 'Client';
$wb["active_txt"] = 'Active';
......@@ -17,4 +18,5 @@ $wb["database_user_error_unique"] = 'There is already a database user with this
$wb["database_user_error_regex"] = 'Invalid database user name. The username may contain these characters: a-z, A-Z, 0-9 and the underscore. Length: 2 - 64 characters.';
$wb["limit_database_txt"] = 'The max. number of databases is reached.';
$wb["database_name_change_txt"] = 'The database name can not be changed';
$wb["database_charset_change_txt"] = 'The database charset can not be changed';
?>
\ No newline at end of file
......@@ -4,6 +4,7 @@ $wb["type_txt"] = 'Type';
$wb["database_name_txt"] = 'Databasenaam';
$wb["database_user_txt"] = 'Database gebruiker';
$wb["database_password_txt"] = 'Database wachtwoord';
$wb["database_charset_txt"] = 'Database charset';
$wb["remote_access_txt"] = 'Remote Access';
$wb["client_txt"] = 'Klant';
$wb["active_txt"] = 'Actief';
......@@ -17,4 +18,5 @@ $wb["database_user_error_unique"] = 'Er bestaat al een database gebruiker met de
$wb["database_user_error_regex"] = 'Ongeldige database gebruikersnaam. De gebruikersnaam bevat deze karakters: a-z, A-Z, 0-9 en de underscore. Lengte: 2 - 64 karakters.';
$wb["limit_database_txt"] = 'The max. aantal databases is bereikt.';
$wb["database_name_change_txt"] = 'De databasenaam kan niet worden gewijzigd.';
$wb["database_charset_change_txt"] = 'The database charset can not be changed';
?>
......@@ -4,6 +4,7 @@ $wb["type_txt"] = 'Тип';
$wb["database_name_txt"] = 'Database name';
$wb["database_user_txt"] = 'Database user';
$wb["database_password_txt"] = 'Database password';
$wb["database_charset_txt"] = 'Database charset';
$wb["remote_access_txt"] = 'Remote Access';
$wb["client_txt"] = 'Client';
$wb["active_txt"] = 'Активный';
......@@ -17,4 +18,5 @@ $wb["database_user_error_unique"] = 'There is already a database user with this
$wb["database_user_error_regex"] = 'Invalid database user name. The username may contain these characters: a-z, A-Z, 0-9 and the underscore. Length: 2 - 64 characters.';
$wb["limit_database_txt"] = 'The max. number of databases is reached.';
$wb["database_name_change_txt"] = 'The database name can not be changed';
$wb["database_charset_change_txt"] = 'The database charset can not be changed';
?>
......@@ -47,6 +47,14 @@
<td class="frmText11">{tmpl_var name='database_password_txt'}:</td>
<td class="frmText11"><input name="database_password" type="password" class="text" value="{tmpl_var name='database_password'}" size="30" maxlength="255"></td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='database_charset_txt'}:</td>
<td class="frmText11">
<select name="database_charset" class="text">
{tmpl_var name='database_charset'}
</select>
</td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='remote_access_txt'}:</td>
<td class="frmText11">{tmpl_var name='remote_access'}</td>
......
......@@ -69,9 +69,16 @@ class mysql_clientdb_plugin {
$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
return;
}
// Charset for the new table
if($data["new"]["database_charset"] != '') {
$query_charset_table = ' DEFAULT CHARACTER SET '.$data["new"]["database_charset"];
} else {
$query_charset_table = '';
}
//* Create the new database
if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($data["new"]["database_name"]),$link)) {
if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($data["new"]["database_name"]).$query_charset_table,$link)) {
$app->log('Created MySQL database: '.$data["new"]["database_name"],LOGLEVEL_DEBUG);
} else {
$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment