@@ -220,25 +220,6 @@ function onSubmit() {
220220 parent ::onSubmit ();
221221}
222222
223- function onAfterInsert () {
224- global $ app , $ conf ;
225-
226- // make sure that the record belongs to the client group and not the admin group when a dmin inserts it
227- if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' && isset ($ this ->dataRecord ["client_group_id " ])) {
228- $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
229- $ app ->db ->query ("UPDATE dns_soa SET sys_groupid = $ client_group_id, sys_perm_group = 'ru' WHERE id = " .$ this ->id );
230- // And we want to update all rr records too, that belong to this record
231- $ app ->db ->query ("UPDATE dns_rr SET sys_groupid = $ client_group_id WHERE zone = " .$ this ->id );
232- }
233- if ($ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ]) && isset ($ this ->dataRecord ["client_group_id " ])) {
234- $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
235- $ app ->db ->query ("UPDATE dns_soa SET sys_groupid = $ client_group_id, sys_perm_group = 'riud' WHERE id = " .$ this ->id );
236- // And we want to update all rr records too, that belong to this record
237- $ app ->db ->query ("UPDATE dns_rr SET sys_groupid = $ client_group_id WHERE zone = " .$ this ->id );
238- }
239-
240- }
241-
242223function onBeforeUpdate () {
243224 global $ app , $ conf ;
244225
@@ -256,42 +237,6 @@ function onBeforeUpdate () {
256237 }
257238}
258239
259- function onAfterUpdate () {
260- global $ app , $ conf ;
261-
262- $ tmp = $ app ->db ->diffrec ($ this ->oldDataRecord , $ app ->tform ->getDataRecord ($ this ->id ));
263- if ($ tmp ['diff_num ' ] > 0 ) {
264- // Update the serial number of the SOA record
265- $ soa = $ app ->db ->queryOneRecord ("SELECT serial FROM dns_soa WHERE id = " .$ this ->id );
266- $ app ->db ->query ("UPDATE dns_soa SET serial = ' " .$ app ->validate_dns ->increase_serial ($ soa ["serial " ])."' WHERE id = " .$ this ->id );
267- }
268-
269- // make sure that the record belongs to the client group and not the admin group when a dmin inserts it
270- if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' && isset ($ this ->dataRecord ["client_group_id " ])) {
271- $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
272- $ app ->db ->query ("UPDATE dns_soa SET sys_groupid = $ client_group_id, sys_perm_group = 'ru' WHERE id = " .$ this ->id );
273- // And we want to update all rr records too, that belong to this record
274- $ app ->db ->query ("UPDATE dns_rr SET sys_groupid = $ client_group_id WHERE zone = " .$ this ->id );
275- }
276- if ($ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ]) && isset ($ this ->dataRecord ["client_group_id " ])) {
277- $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
278- $ app ->db ->query ("UPDATE dns_soa SET sys_groupid = $ client_group_id, sys_perm_group = 'riud' WHERE id = " .$ this ->id );
279- // And we want to update all rr records too, that belong to this record
280- $ app ->db ->query ("UPDATE dns_rr SET sys_groupid = $ client_group_id WHERE zone = " .$ this ->id );
281- }
282-
283- //** When the client group has changed, change also the owner of the record if the owner is not the admin user
284- if ($ this ->oldDataRecord ["client_group_id " ] != $ this ->dataRecord ["client_group_id " ] && $ this ->dataRecord ["sys_userid " ] != 1 ) {
285- $ client_group_id = $ app ->functions ->intval ($ this ->dataRecord ["client_group_id " ]);
286- $ tmp = $ app ->db ->queryOneREcord ("SELECT userid FROM sys_user WHERE default_group = " .$ client_group_id );
287- if ($ tmp ["userid " ] > 0 ) {
288- $ app ->db ->query ("UPDATE dns_soa SET sys_userid = " .$ tmp ["userid " ]." WHERE id = " .$ this ->id );
289- $ app ->db ->query ("UPDATE dns_rr SET sys_userid = " .$ tmp ["userid " ]." WHERE zone = " .$ this ->id );
290- }
291- }
292-
293- }
294-
295240}
296241
297242$ page = new page_action ;
0 commit comments