Commit b846a278 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.0.5' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.0.5

parents c64502b5 ed768786
ALTER TABLE `client`
ADD `limit_database_quota` int(11) NOT NULL default '-1' AFTER `limit_database`;
ALTER TABLE `client_template`
ADD `limit_database_quota` int(11) NOT NULL default '-1' AFTER `limit_database`;
ALTER TABLE `web_database`
ADD `database_quota` int(11) unsigned DEFAULT NULL AFTER `database_name_prefix`,
ADD `last_quota_notification` date NULL default NULL;
ALTER TABLE `country` ADD `eu` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'BE';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'BG';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'DK';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'DE';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'EE';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'FI';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'FR';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'GR';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'IE';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'IT';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'HR';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'LV';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'LT';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'LU';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'MT';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'NL';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'AT';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'PL';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'PT';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'RO';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'SE';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'SK';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'SI';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'ES';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'CZ';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'HU';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'GB';
UPDATE `country` SET `eu` = 'y' WHERE `iso` = 'CY';
This diff is collapsed.
......@@ -1763,7 +1763,18 @@ class remoting {
$this->dataRecord = $params;
$app->sites_database_plugin->processDatabaseInsert($this);
return $this->insertQueryExecute($sql, $params);
$retval = $this->insertQueryExecute($sql, $params);
// set correct values for backup_interval and backup_copies
if(isset($params['backup_interval']) || isset($params['backup_copies'])){
$sql_set = array();
if(isset($params['backup_interval'])) $sql_set[] = "backup_interval = '".$app->db->quote($params['backup_interval'])."'";
if(isset($params['backup_copies'])) $sql_set[] = "backup_copies = ".$app->functions->intval($params['backup_copies']);
//$app->db->query("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$retval);
$this->updateQueryExecute("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$retval, $retval, $params);
}
return $retval;
}
return false;
......@@ -1786,7 +1797,18 @@ class remoting {
$this->id = $primary_id;
$this->dataRecord = $params;
$app->sites_database_plugin->processDatabaseUpdate($this);
return $this->updateQueryExecute($sql, $primary_id, $params);
$retval = $this->updateQueryExecute($sql, $primary_id, $params);
// set correct values for backup_interval and backup_copies
if(isset($params['backup_interval']) || isset($params['backup_copies'])){
$sql_set = array();
if(isset($params['backup_interval'])) $sql_set[] = "backup_interval = '".$app->db->quote($params['backup_interval'])."'";
if(isset($params['backup_copies'])) $sql_set[] = "backup_copies = ".$app->functions->intval($params['backup_copies']);
//$app->db->query("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$primary_id);
$this->updateQueryExecute("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$primary_id, $primary_id, $params);
}
return $retval;
}
return false;
......
......@@ -421,7 +421,7 @@ class page_action extends tform_actions {
//* The Database user shall be owned by the same group then the website
$sys_groupid = $app->functions->intval($web['sys_groupid']);
$backup_interval = $app->functions->intval($web['backup_interval']);
$backup_interval = $app->db->quote($web['backup_interval']);
$backup_copies = $app->functions->intval($web['backup_copies']);
$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
......@@ -437,7 +437,7 @@ class page_action extends tform_actions {
//* The Database user shall be owned by the same group then the website
$sys_groupid = $app->functions->intval($web['sys_groupid']);
$backup_interval = $app->functions->intval($web['backup_interval']);
$backup_interval = $app->db->quote($web['backup_interval']);
$backup_copies = $app->functions->intval($web['backup_copies']);
$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
......
......@@ -4,4 +4,5 @@ $wb['parent_domain_id_txt'] = 'Webseite';
$wb['path_txt'] = 'Pfad';
$wb['active_txt'] = 'Aktiv';
$wb['path_error_regex'] = 'Ungültiger Pfad.';
$wb['error_folder_already_protected_txt'] = 'Für diesen Ordner existiert schon ein Eintrag.';
?>
\ No newline at end of file
......@@ -10,4 +10,5 @@ $wb['repeat_password_txt'] = 'Passwort wiederholen';
$wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
$wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
$wb['no_folder_perm'] = 'Sie haben keine Berechtigung für diesen Ordner.';
$wb['error_user_exists_already_txt'] = 'Für diesen Benutzer existiert schon ein Eintrag.';
?>
\ No newline at end of file
......@@ -4,4 +4,5 @@ $wb["parent_domain_id_txt"] = 'Website';
$wb["path_txt"] = 'Path';
$wb["active_txt"] = 'Active';
$wb["path_error_regex"] = 'Invalid folder path.';
$wb['error_folder_already_protected_txt'] = 'There is already a record for this folder.';
?>
\ No newline at end of file
......@@ -10,4 +10,5 @@ $wb['repeat_password_txt'] = 'Repeat Password';
$wb['password_mismatch_txt'] = 'The passwords do not match.';
$wb['password_match_txt'] = 'The passwords do match.';
$wb["no_folder_perm"] = 'You have no permission for this folder.';
$wb['error_user_exists_already_txt'] = 'There is already a record for this user.';
?>
\ No newline at end of file
......@@ -1012,7 +1012,7 @@ class page_action extends tform_actions {
//* Change database backup options when web backup options have been changed
if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
//* Update all databases
$backup_interval = $app->functions->intval($this->dataRecord['backup_interval']);
$backup_interval = $app->db->quote($this->dataRecord['backup_interval']);
$backup_copies = $app->functions->intval($this->dataRecord['backup_copies']);
$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
foreach($records as $rec) {
......
......@@ -60,9 +60,45 @@ class page_action extends tform_actions {
// Set a few fixed values
$this->dataRecord["server_id"] = $parent_domain["server_id"];
// make sure this folder isn't protected already
if($this->id > 0){
$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = ".$this->dataRecord['parent_domain_id']." AND path = '".$this->dataRecord['path']."' AND web_folder_id != ".$this->id);
} else {
$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE parent_domain_id = ".$this->dataRecord['parent_domain_id']." AND path = '".$this->dataRecord['path']."'");
}
if(is_array($folder) && !empty($folder)) $app->tform->errorMessage .= $app->tform->lng('error_folder_already_protected_txt');
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
// The web folder entry shall be owned by the same group as the website
$sys_groupid = $app->functions->intval($web['sys_groupid']);
$sql = "UPDATE web_folder SET sys_groupid = '$sys_groupid' WHERE web_folder_id = ".$this->id;
$app->db->query($sql);
}
function onAfterUpdate() {
global $app, $conf;
//* When the site of the web folder has been changed
if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) {
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
// The web folder entry shall be owned by the same group as the website
$sys_groupid = $app->functions->intval($web['sys_groupid']);
$sql = "UPDATE web_folder SET sys_groupid = '$sys_groupid' WHERE web_folder_id = ".$this->id;
$app->db->query($sql);
}
}
}
......
......@@ -60,9 +60,45 @@ class page_action extends tform_actions {
// Set a few fixed values
$this->dataRecord["server_id"] = $folder["server_id"];
// make sure this folder/user combination does not exist already
if($this->id > 0){
$user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = ".$this->dataRecord['web_folder_id']." AND username = '".$this->dataRecord['username']."' AND web_folder_user_id != ".$this->id);
} else {
$user = $app->db->queryOneRecord("SELECT * FROM web_folder_user WHERE web_folder_id = ".$this->dataRecord['web_folder_id']." AND username = '".$this->dataRecord['username']."'");
}
if(is_array($user) && !empty($user)) $app->tform->errorMessage .= $app->tform->lng('error_user_exists_already_txt');
parent::onSubmit();
}
function onAfterInsert() {
global $app, $conf;
$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".$app->functions->intval($this->dataRecord["web_folder_id"]));
// The web folder user entry shall be owned by the same group as the web folder
$sys_groupid = $app->functions->intval($folder['sys_groupid']);
$sql = "UPDATE web_folder_user SET sys_groupid = '$sys_groupid' WHERE web_folder_user_id = ".$this->id;
$app->db->query($sql);
}
function onAfterUpdate() {
global $app, $conf;
//* When the web folder has been changed
if(isset($this->dataRecord['web_folder_id']) && $this->oldDataRecord['web_folder_id'] != $this->dataRecord['web_folder_id']) {
$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".$app->functions->intval($this->dataRecord["web_folder_id"]));
// The web folder user entry shall be owned by the same group as the web folder
$sys_groupid = $app->functions->intval($folder['sys_groupid']);
$sql = "UPDATE web_folder_user SET sys_groupid = '$sys_groupid' WHERE web_folder_user_id = ".$this->id;
$app->db->query($sql);
}
}
}
......
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