@@ -75,6 +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)
7879 if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && !$ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
7980
8081 // Get the limits of the client
@@ -89,7 +90,8 @@ function onShowEnd() {
8990 // Fill the IP select field with the IP addresses that are allowed for this client
9091 $ ip_select = "<option value='*'>*</option> " ;
9192 $ app ->tpl ->setVar ("ip_address " ,$ ip_select );
92-
93+
94+ // If the logged in user is not admin and has sub clients (is a rseller)
9395 } elseif ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
9496
9597 // Get the limits of the client
@@ -116,12 +118,13 @@ function onShowEnd() {
116118 // Fill the IP select field with the IP addresses that are allowed for this client
117119 $ ip_select = "<option value='*'>*</option> " ;
118120 $ app ->tpl ->setVar ("ip_address " ,$ ip_select );
119-
121+
122+ // If the logged in user is admin
120123 } else {
121124
122125 // The user is admin, so we fill in all IP addresses of the server
123126 if ($ this ->id > 0 ) {
124- $ server_id = $ this ->dataRecord ["server_id " ];
127+ $ server_id = @ $ this ->dataRecord ["server_id " ];
125128 } else {
126129 // Get the first server ID
127130 $ tmp = $ app ->db ->queryOneRecord ("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1 " );
@@ -242,6 +245,22 @@ function onAfterInsert() {
242245 $ app ->db ->query ($ sql );
243246 }
244247
248+ function onBeforeUpdate () {
249+ global $ app , $ conf ;
250+
251+ //* Check that all fields for the SSL cert creation are filled
252+ if (isset ($ this ->dataRecord ['ssl_action ' ]) && $ this ->dataRecord ['ssl_action ' ] == 'create ' ) {
253+ if ($ this ->dataRecord ['ssl_state ' ] == '' ) $ app ->tform ->errorMessage .= $ app ->tform ->lng ('error_ssl_state_empty ' ).'<br /> ' ;
254+ if ($ this ->dataRecord ['ssl_locality ' ] == '' ) $ app ->tform ->errorMessage .= $ app ->tform ->lng ('error_ssl_locality_empty ' ).'<br /> ' ;
255+ if ($ this ->dataRecord ['ssl_organisation ' ] == '' ) $ app ->tform ->errorMessage .= $ app ->tform ->lng ('error_ssl_organisation_empty ' ).'<br /> ' ;
256+ if ($ this ->dataRecord ['ssl_organisation_unit ' ] == '' ) $ app ->tform ->errorMessage .= $ app ->tform ->lng ('error_ssl_organisation_unit_empty ' ).'<br /> ' ;
257+ if ($ this ->dataRecord ['ssl_country ' ] == '' ) $ app ->tform ->errorMessage .= $ app ->tform ->lng ('error_ssl_country_empty ' ).'<br /> ' ;
258+ }
259+
260+ }
261+
262+
263+
245264 function onAfterUpdate () {
246265 global $ app , $ conf ;
247266
0 commit comments