@@ -99,26 +99,28 @@ function onShowEnd() {
9999 function onSubmit () {
100100 global $ app , $ conf ;
101101
102- // Get the limits of the client
103- $ client_group_id = $ _SESSION ["s " ]["user " ]["default_group " ];
104- $ client = $ app ->db ->queryOneRecord ("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
105-
106- // When the record is updated
107- if ($ this ->id > 0 ) {
108- // restore the server ID if the user is not admin and record is edited
109- $ tmp = $ app ->db ->queryOneRecord ("SELECT server_id FROM dns_soa WHERE id = " .intval ($ this ->id ));
110- $ this ->dataRecord ["server_id " ] = $ tmp ["server_id " ];
111- unset($ tmp );
112- // When the record is inserted
113- } else {
114- // set the server ID to the default mailserver of the client
115- $ this ->dataRecord ["server_id " ] = $ client ["default_dnsserver " ];
102+ if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' ) {
103+ // Get the limits of the client
104+ $ client_group_id = $ _SESSION ["s " ]["user " ]["default_group " ];
105+ $ client = $ app ->db ->queryOneRecord ("SELECT limit_dns_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
106+
107+ // When the record is updated
108+ if ($ this ->id > 0 ) {
109+ // restore the server ID if the user is not admin and record is edited
110+ $ tmp = $ app ->db ->queryOneRecord ("SELECT server_id FROM dns_soa WHERE id = " .intval ($ this ->id ));
111+ $ this ->dataRecord ["server_id " ] = $ tmp ["server_id " ];
112+ unset($ tmp );
113+ // When the record is inserted
114+ } else {
115+ // set the server ID to the default mailserver of the client
116+ $ this ->dataRecord ["server_id " ] = $ client ["default_dnsserver " ];
116117
117- // Check if the user may add another maildomain.
118- if ($ client ["limit_dns_zone " ] >= 0 ) {
119- $ tmp = $ app ->db ->queryOneRecord ("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $ client_group_id " );
120- if ($ tmp ["number " ] >= $ client ["limit_dns_zone " ]) {
121- $ app ->error ($ app ->tform ->wordbook ["limit_dns_zone_txt " ]);
118+ // Check if the user may add another maildomain.
119+ if ($ client ["limit_dns_zone " ] >= 0 ) {
120+ $ tmp = $ app ->db ->queryOneRecord ("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $ client_group_id " );
121+ if ($ tmp ["number " ] >= $ client ["limit_dns_zone " ]) {
122+ $ app ->error ($ app ->tform ->wordbook ["limit_dns_zone_txt " ]);
123+ }
122124 }
123125 }
124126 }
0 commit comments