Commit 45ad27ed authored by tbrehm's avatar tbrehm

Fixed: FS#1530 - 'already a database with this name on the server' error if db...

Fixed: FS#1530 - 'already a database with this name on the server' error if db exists on other server
parent 6f45f69a
......@@ -8,6 +8,9 @@ $module['template'] = 'module.tpl.htm';
$module['startpage'] = 'mail/mail_domain_list.php';
$module['tab_width'] = '';
$app->uses('getconf');
$mail_config = $app->getconf->get_server_config(1,'mail');
//**** Email accounts menu
$items = array();
......@@ -134,14 +137,11 @@ if($app->auth->get_client_limit($userid,'fetchmail') != 0)
//**** Statistics menu
$items = array();
$items[] = array( 'title' => 'Mailbox traffic',
'target' => 'content',
'link' => 'mail/mail_user_stats.php',
'html_id' => 'mail_user_stats');
$module['nav'][] = array( 'title' => 'Statistics',
'open' => 1,
'items' => $items);
......
......@@ -279,7 +279,11 @@ class page_action extends tform_actions {
$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
}
//* Check for duplicates
$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."' AND database_id != '".$this->id."'");
if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->lng('database_name_error_unique').'<br />';
parent::onBeforeUpdate();
}
......@@ -316,6 +320,10 @@ class page_action extends tform_actions {
$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
}
//* Check for duplicates
$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."'");
if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique').'<br />';
parent::onBeforeInsert();
}
......
......@@ -80,9 +80,7 @@ $form["tabs"]['database'] = array (
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'database_name_error_empty'),
1 => array ( 'type' => 'UNIQUE',
'errmsg'=> 'database_name_error_unique'),
2 => array ( 'type' => 'REGEX',
1 => array ( 'type' => 'REGEX',
'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
'errmsg'=> 'database_name_error_regex'),
),
......
Markdown is supported
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