@@ -60,7 +60,7 @@ function onShowNew() {
6060 $ client_group_id = $ _SESSION ["s " ]["user " ]["default_group " ];
6161 $ client = $ app ->db ->queryOneRecord ("SELECT limit_web_domain FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $ client_group_id " );
6262
63- // Check if the user may add another maildomain .
63+ // Check if the user may add another website .
6464 if ($ client ["limit_web_domain " ] >= 0 ) {
6565 $ tmp = $ app ->db ->queryOneRecord ("SELECT count(domain_id) as number FROM web_domain WHERE sys_groupid = $ client_group_id and type = 'vhost' " );
6666 if ($ tmp ["number " ] >= $ client ["limit_web_domain " ]) {
@@ -75,7 +75,7 @@ function onShowNew() {
7575 function onShowEnd () {
7676 global $ app , $ conf ;
7777
78- // If the logged in user is not admin and has no sub clients (no rseller)
78+ //* Client: If the logged in user is not admin and has no sub clients (no rseller)
7979 if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && !$ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
8080
8181 // Get the limits of the client
@@ -88,10 +88,23 @@ function onShowEnd() {
8888 unset($ tmp );
8989
9090 // Fill the IP select field with the IP addresses that are allowed for this client
91+ // $ip_select = "<option value='*'>*</option>";
92+ // $app->tpl->setVar("ip_address",$ip_select);
93+ $ sql = "SELECT ip_address FROM server_ip WHERE server_id = " .$ client ['default_webserver ' ];
94+ $ ips = $ app ->db ->queryAllRecords ($ sql );
9195 $ ip_select = "<option value='*'>*</option> " ;
96+ //$ip_select = "";
97+ if (is_array ($ ips )) {
98+ foreach ( $ ips as $ ip ) {
99+ $ selected = ($ ip ["ip_address " ] == $ this ->dataRecord ["ip_address " ])?'SELECTED ' :'' ;
100+ $ ip_select .= "<option value=' $ ip [ip_address]' $ selected> $ ip [ip_address]</option> \r\n" ;
101+ }
102+ }
92103 $ app ->tpl ->setVar ("ip_address " ,$ ip_select );
104+ unset($ tmp );
105+ unset($ ips );
93106
94- // If the logged in user is not admin and has sub clients (is a rseller)
107+ //* Reseller: If the logged in user is not admin and has sub clients (is a rseller)
95108 } elseif ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
96109
97110 // Get the limits of the client
@@ -116,10 +129,23 @@ function onShowEnd() {
116129 $ app ->tpl ->setVar ("client_group_id " ,$ client_select );
117130
118131 // Fill the IP select field with the IP addresses that are allowed for this client
132+ //$ip_select = "<option value='*'>*</option>";
133+ //$app->tpl->setVar("ip_address",$ip_select);
134+ $ sql = "SELECT ip_address FROM server_ip WHERE server_id = " .$ client ['default_webserver ' ];
135+ $ ips = $ app ->db ->queryAllRecords ($ sql );
119136 $ ip_select = "<option value='*'>*</option> " ;
137+ //$ip_select = "";
138+ if (is_array ($ ips )) {
139+ foreach ( $ ips as $ ip ) {
140+ $ selected = ($ ip ["ip_address " ] == $ this ->dataRecord ["ip_address " ])?'SELECTED ' :'' ;
141+ $ ip_select .= "<option value=' $ ip [ip_address]' $ selected> $ ip [ip_address]</option> \r\n" ;
142+ }
143+ }
120144 $ app ->tpl ->setVar ("ip_address " ,$ ip_select );
145+ unset($ tmp );
146+ unset($ ips );
121147
122- // If the logged in user is admin
148+ //* Admin: If the logged in user is admin
123149 } else {
124150
125151 // The user is admin, so we fill in all IP addresses of the server
0 commit comments