Updated:
- Database users have to match the client of the parent website
- Update select boxes for database users on change of parent website
| | |
| | | |
| | | $json = $app->functions->json_encode($result); |
| | | } |
| | | |
| | | if($type == 'getdatabaseusers') { |
| | | $json = '{'; |
| | | |
| | | $sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id"; |
| | | $group = $app->db->queryOneRecord($sql); |
| | | if($group) { |
| | | $sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'"; |
| | | $records = $app->db->queryAllRecords($sql); |
| | | |
| | | foreach($records as $record) { |
| | | $json .= '"'.$record['database_user_id'].'": "'.$record['database_user'].'",'; |
| | | } |
| | | unset($records); |
| | | unset($group); |
| | | } |
| | | |
| | | if(substr($json,-1) == ',') $json = substr($json,0,-1); |
| | | $json .= '}'; |
| | | } |
| | | |
| | | //} |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | // check if client of database parent domain is client of db user! |
| | | $web_group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'"); |
| | | if($this->dataRecord['database_user_id']) { |
| | | $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_user_id'])."'"); |
| | | if($group['sys_groupid'] != $web_group['sys_groupid']) { |
| | | $app->error($app->tform->wordbook['database_client_differs_txt']); |
| | | } |
| | | } |
| | | if($this->dataRecord['database_ro_user_id']) { |
| | | $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_ro_user_id'])."'"); |
| | | if($group['sys_groupid'] != $web_group['sys_groupid']) { |
| | | $app->error($app->tform->wordbook['database_client_differs_txt']); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | $wb['database_remote_error_ips'] = 'Mindestens eine der eingegebenen IP Adressen ist ungültig.'; |
| | | $wb['client_txt'] = 'Kunde'; |
| | | $wb['active_txt'] = 'Aktiv'; |
| | | $wb['database_client_differs_txt'] = 'Der Kunde dieser Datenbank passt nicht zum Kunden des Datenbankusers.'; |
| | | $wb['database_name_error_empty'] = 'Datenbankname ist leer.'; |
| | | $wb['database_name_error_unique'] = 'Es existiert bereits eine Datenbank mit diesem Namen am Server. Um einen eindeutigen Namen zu erhalten können sie z.B. den Domainnamen vor dem Datenbanknamen verwenden.'; |
| | | $wb['database_name_error_regex'] = 'Ungültiger Datenbankname. Der Datenbankname darf die Zeichen: a-z, A-Z, 0-9 und den Unterstrich beinhalten. Länge: 2 - 64 Zeichen.'; |
| | |
| | | $wb["database_remote_error_ips"] = 'At least one of the entered ip addresses is invalid.'; |
| | | $wb["client_txt"] = 'Client'; |
| | | $wb["active_txt"] = 'Active'; |
| | | $wb['database_client_differs_txt'] = 'The client of the parent web and the database do not match.'; |
| | | $wb["database_name_error_empty"] = 'Database name is empty.'; |
| | | $wb["database_name_error_unique"] = 'There is already a database with this name on the server. To get a unique name, e.g. prepend your domain name to the database name.'; |
| | | $wb["database_name_error_regex"] = 'Invalid database name. The database name may contain these characters: a-z, A-Z, 0-9 and the underscore. Length: 2 - 64 characters.'; |
| | |
| | | |
| | | </div> |
| | | <script language="JavaScript" type="text/javascript"> |
| | | <tmpl_if name="is_admin"> |
| | | function reloadDatabaseUsers() { |
| | | var parentDomainId = jQuery('#parent_domain_id').val() |
| | | jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : parentDomainId, 'type': 'getdatabaseusers'}, function(data) { |
| | | var options = '<option value=""></option>'; |
| | | $.each(data, function(key, val) { |
| | | options += '<option value="'+key+'"'+ ($('#database_user_id').val() == key ? ' selected="selected"' : '') +'>'+val+'</option>'; |
| | | }); |
| | | $('#database_user_id').html(options).change(); |
| | | |
| | | options = '<option value=""></option>'; |
| | | $.each(data, function(key, val) { |
| | | options += '<option value="'+key+'"'+ ($('#database_ro_user_id').val() == key ? ' selected="selected"' : '') +'>'+val+'</option>'; |
| | | }); |
| | | $('#database_ro_user_id').html(options).change(); |
| | | }); |
| | | } |
| | | jQuery('#parent_domain_id').change(function() { reloadDatabaseUsers(); }); |
| | | </tmpl_if> |
| | | jQuery('#remote_ips').ispconfigSearch({ |
| | | dataSrc: '/sites/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |