@@ -467,7 +467,7 @@ function onSubmit() {
467467
468468 //* get the server config for this server
469469 $ app ->uses ("getconf " );
470- $ web_config = $ app ->getconf ->get_server_config (intval ($ this ->dataRecord ["server_id " ]),'web ' );
470+ $ web_config = $ app ->getconf ->get_server_config (intval (isset ( $ this ->dataRecord ["server_id " ]) ? $ this -> dataRecord [ " server_id " ] : 0 ),'web ' );
471471 //* Check for duplicate ssl certs per IP if SNI is disabled
472472 if (isset ($ this ->dataRecord ['ssl ' ]) && $ this ->dataRecord ['ssl ' ] == 'y ' && $ web_config ['enable_sni ' ] != 'y ' ) {
473473 $ sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = ' " .$ app ->db ->quote ($ this ->dataRecord ['ip_address ' ])."' and domain_id != " .$ this ->id ;
@@ -600,10 +600,11 @@ function onAfterUpdate() {
600600 $ web_rec = $ app ->tform ->getDataRecord ($ this ->id );
601601 $ web_config = $ app ->getconf ->get_server_config (intval ($ web_rec ["server_id " ]),'web ' );
602602 $ document_root = str_replace ("[website_id] " ,$ this ->id ,$ web_config ["website_path " ]);
603- $ document_root = str_replace ("[website_idhash_1] " ,$ this ->id_hash ($ page_form ->id ,1 ),$ document_root );
604- $ document_root = str_replace ("[website_idhash_2] " ,$ this ->id_hash ($ page_form ->id ,1 ),$ document_root );
605- $ document_root = str_replace ("[website_idhash_3] " ,$ this ->id_hash ($ page_form ->id ,1 ),$ document_root );
606- $ document_root = str_replace ("[website_idhash_4] " ,$ this ->id_hash ($ page_form ->id ,1 ),$ document_root );
603+ $ page_formid = isset ($ page_form ->id ) ? $ page_form ->id : '' ;
604+ $ document_root = str_replace ("[website_idhash_1] " ,$ this ->id_hash ($ page_formid ,1 ),$ document_root );
605+ $ document_root = str_replace ("[website_idhash_2] " ,$ this ->id_hash ($ page_formid ,1 ),$ document_root );
606+ $ document_root = str_replace ("[website_idhash_3] " ,$ this ->id_hash ($ page_formid ,1 ),$ document_root );
607+ $ document_root = str_replace ("[website_idhash_4] " ,$ this ->id_hash ($ page_formid ,1 ),$ document_root );
607608
608609 // get the ID of the client
609610 if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && !$ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
@@ -666,7 +667,7 @@ function onAfterUpdate() {
666667 }
667668
668669 //* If the domain name has been changed, we will have to change all subdomains
669- if ($ this ->dataRecord ["domain " ] != '' && $ this ->oldDataRecord ["domain " ] != '' && $ this ->dataRecord ["domain " ] != $ this ->oldDataRecord ["domain " ]) {
670+ if (! empty ( $ this ->dataRecord ["domain " ]) && ! empty ( $ this ->oldDataRecord ["domain " ]) && $ this ->dataRecord ["domain " ] != $ this ->oldDataRecord ["domain " ]) {
670671 $ records = $ app ->db ->queryAllRecords ("SELECT domain_id,domain FROM web_domain WHERE type = 'subdomain' AND domain LIKE '%. " .$ app ->db ->quote ($ this ->oldDataRecord ["domain " ])."' " );
671672 foreach ($ records as $ rec ) {
672673 $ subdomain = $ app ->db ->quote (str_replace ($ this ->oldDataRecord ["domain " ],$ this ->dataRecord ["domain " ],$ rec ['domain ' ]));
@@ -684,8 +685,8 @@ function onAfterUpdate() {
684685 }
685686
686687 //* Set php_open_basedir if empty or domain or client has been changed
687- if ($ web_rec ['php_open_basedir ' ] == '' ||
688- ($ this ->dataRecord ["domain " ] != '' && $ this ->oldDataRecord ["domain " ] != '' && $ this ->dataRecord ["domain " ] != $ this ->oldDataRecord ["domain " ]) ||
688+ if (empty ( $ web_rec ['php_open_basedir ' ]) ||
689+ (! empty ( $ this ->dataRecord ["domain " ]) && ! empty ( $ this ->oldDataRecord ["domain " ]) && $ this ->dataRecord ["domain " ] != $ this ->oldDataRecord ["domain " ]) ||
689690 (isset ($ this ->dataRecord ["client_group_id " ]) && $ this ->dataRecord ["client_group_id " ] != $ this ->oldDataRecord ["sys_groupid " ])) {
690691 $ document_root = $ app ->db ->quote (str_replace ("[client_id] " ,$ client_id ,$ document_root ));
691692 $ php_open_basedir = str_replace ("[website_path] " ,$ document_root ,$ web_config ["php_open_basedir " ]);
0 commit comments