@@ -293,11 +293,13 @@ function onAfterInsert() {
293293 }
294294
295295 // Set the values for document_root, system_user and system_group
296- $ system_user = 'web ' .$ this ->id ;
297- $ system_group = 'client ' .$ client_id ;
298- $ document_root = str_replace ("[client_id] " ,$ client_id ,$ document_root );
296+ $ system_user = $ app ->db ->quote ('web ' .$ this ->id );
297+ $ system_group = $ app ->db ->quote ('client ' .$ client_id );
298+ $ document_root = $ app ->db ->quote (str_replace ("[client_id] " ,$ client_id ,$ document_root ));
299+ $ php_open_basedir = $ app ->db ->quote (str_replace ("[website_path] " ,$ document_root ,$ web_config ["php_open_basedir " ]));
300+ $ htaccess_allow_override = $ app ->db ->quote ($ web_config ["htaccess_allow_override " ]);
299301
300- $ sql = "UPDATE web_domain SET system_user = ' $ system_user', system_group = ' $ system_group', document_root = ' $ document_root' WHERE domain_id = " .$ this ->id ;
302+ $ sql = "UPDATE web_domain SET system_user = ' $ system_user', system_group = ' $ system_group', document_root = ' $ document_root', allow_override = ' $ htaccess_allow_override ', php_open_basedir = ' $ php_open_basedir ' WHERE domain_id = " .$ this ->id ;
301303 $ app ->db ->query ($ sql );
302304 }
303305
@@ -372,9 +374,9 @@ function onAfterUpdate() {
372374
373375 if (($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' || $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) && isset ($ this ->dataRecord ["client_group_id " ]) && $ this ->dataRecord ["client_group_id " ] != $ this ->oldDataRecord ["client_group_id " ]) {
374376 // Set the values for document_root, system_user and system_group
375- $ system_user = 'web ' .$ this ->id ;
376- $ system_group = 'client ' .$ client_id ;
377- $ document_root = str_replace ("[client_id] " ,$ client_id ,$ document_root );
377+ $ system_user = $ app -> db -> quote ( 'web ' .$ this ->id ) ;
378+ $ system_group = $ app -> db -> quote ( 'client ' .$ client_id) ;
379+ $ document_root = $ app -> db -> quote ( str_replace ("[client_id] " ,$ client_id ,$ document_root) );
378380
379381 $ sql = "UPDATE web_domain SET system_user = ' $ system_user', system_group = ' $ system_group', document_root = ' $ document_root' WHERE domain_id = " .$ this ->id ;
380382 //$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group' WHERE domain_id = ".$this->id;
@@ -393,6 +395,17 @@ function onAfterUpdate() {
393395 unset($ subdomain );
394396 }
395397
398+ //* Set allow_override and php_open_basedir if empty
399+ if ($ web_rec ['allow_override ' ] == '' ) {
400+ $ sql = "UPDATE web_domain SET allow_override = ' " .$ app ->db ->quote ($ web_config ["htaccess_allow_override " ])."' WHERE domain_id = " .$ this ->id ;
401+ $ app ->db ->query ($ sql );
402+ }
403+ if ($ web_rec ['php_open_basedir ' ] == '' ) {
404+ $ php_open_basedir = $ app ->db ->quote (str_replace ("[website_path] " ,$ document_root ,$ web_config ["php_open_basedir " ]));
405+ $ sql = "UPDATE web_domain SET php_open_basedir = ' $ php_open_basedir' WHERE domain_id = " .$ this ->id ;
406+ $ app ->db ->query ($ sql );
407+ }
408+
396409 }
397410
398411 function onAfterDelete () {
0 commit comments