| | |
| | | if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { |
| | | |
| | | // Get the limits of the client |
| | | $client_group_id = $_SESSION["s"]["user"]["default_group"]; |
| | | $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); |
| | | $client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); |
| | | |
| | | // Set the webserver to the default server of the client |
| | | $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_dbserver]"); |
| | | $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$app->functions->intval($client['default_dbserver'])); |
| | | $app->tpl->setVar("server_id", "<option value='$client[default_dbserver]'>$tmp[server_name]</option>"); |
| | | unset($tmp); |
| | | |
| | | } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) { |
| | | |
| | | // Get the limits of the client |
| | | $client_group_id = $_SESSION["s"]["user"]["default_group"]; |
| | | $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); |
| | | $client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); |
| | | |
| | | // Set the webserver to the default server of the client |
| | | $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]"); |
| | | $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$app->functions->intval($client['default_webserver'])); |
| | | $app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>"); |
| | | unset($tmp); |
| | | |
| | |
| | | |
| | | if($_SESSION["s"]["user"]["typ"] != 'admin') { |
| | | // Get the limits of the client |
| | | $client_group_id = $_SESSION["s"]["user"]["default_group"]; |
| | | $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); |
| | | $client = $app->db->queryOneRecord("SELECT default_dbserver, limit_database FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); |
| | | |
| | | // When the record is updated |
| | |
| | | } |
| | | |
| | | //* 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."'"); |
| | | $tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($this->dataRecord['database_name'])."' AND server_id = '".$app->functions->intval($this->dataRecord["server_id"])."' AND database_id != '".$this->id."'"); |
| | | if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->lng('database_name_error_unique').'<br />'; |
| | | |
| | | // get the web server ip (parent domain) |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'"); |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'"); |
| | | if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) { |
| | | // we need remote access rights for this server, so get it's ip address |
| | | $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server'); |
| | |
| | | } |
| | | |
| | | //* 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"]."'"); |
| | | $tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($this->dataRecord['database_name'])."' AND server_id = '".$app->functions->intval($this->dataRecord["server_id"])."'"); |
| | | if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique').'<br />'; |
| | | |
| | | // get the web server ip (parent domain) |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'"); |
| | | $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'"); |
| | | if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) { |
| | | // we need remote access rights for this server, so get it's ip address |
| | | $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server'); |
| | |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); |
| | | |
| | | //* The Database user shall be owned by the same group then the website |
| | | $sys_groupid = $web['sys_groupid']; |
| | | $backup_interval = $web['backup_interval']; |
| | | $backup_copies = $web['backup_copies']; |
| | | $sys_groupid = $app->functions->intval($web['sys_groupid']); |
| | | $backup_interval = $app->functions->intval($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; |
| | | $app->db->query($sql); |
| | |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); |
| | | |
| | | //* The Database user shall be owned by the same group then the website |
| | | $sys_groupid = $web['sys_groupid']; |
| | | $backup_interval = $web['backup_interval']; |
| | | $backup_copies = $web['backup_copies']; |
| | | $sys_groupid = $app->functions->intval($web['sys_groupid']); |
| | | $backup_interval = $app->functions->intval($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; |
| | | $app->db->query($sql); |