@@ -107,7 +107,6 @@ function insert($event_name, $data) {
107107 // load the server configuration options
108108 $ app ->uses ("getconf " );
109109 $ this ->data = $ data ;
110- $ this ->app = $ app ;
111110 $ this ->jailkit_config = $ app ->getconf ->get_server_config ($ conf ["server_id " ], 'jailkit ' );
112111 foreach (array ('jailkit_chroot_app_sections ' , 'jailkit_chroot_app_programs ' ) as $ section ) {
113112 if (isset ($ web [$ section ]) && $ web [$ section ] != '' ) {
@@ -190,7 +189,6 @@ function update($event_name, $data) {
190189 // load the server configuration options
191190 $ app ->uses ("getconf " );
192191 $ this ->data = $ data ;
193- $ this ->app = $ app ;
194192 $ this ->jailkit_config = $ app ->getconf ->get_server_config ($ conf ["server_id " ], 'jailkit ' );
195193 foreach (array ('jailkit_chroot_app_sections ' , 'jailkit_chroot_app_programs ' ) as $ section ) {
196194 if (isset ($ web [$ section ]) && $ web [$ section ] != '' ) {
@@ -300,7 +298,7 @@ function _setup_jailkit_chroot()
300298 $ options = array ( 'allow_hardlink ' , );
301299 }
302300
303- $ web = $ this -> app ->db ->queryOneRecord ("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ? " , $ this ->data ['new ' ]["parent_domain_id " ]);
301+ $ web = $ app ->db ->queryOneRecord ("SELECT domain, last_jailkit_hash FROM web_domain WHERE domain_id = ? " , $ this ->data ['new ' ]["parent_domain_id " ]);
304302
305303 $ last_updated = preg_split ('/[\s,]+/ ' , $ this ->jailkit_config ['jailkit_chroot_app_sections ' ]
306304 .' ' .$ this ->jailkit_config ['jailkit_chroot_app_programs ' ]
@@ -315,11 +313,11 @@ function _setup_jailkit_chroot()
315313 if (!is_dir ($ this ->data ['new ' ]['dir ' ].'/etc/jailkit ' ))
316314 {
317315 $ app ->system ->create_jailkit_chroot ($ this ->data ['new ' ]['dir ' ], $ this ->jailkit_config ['jailkit_chroot_app_sections ' ], $ options );
318- $ this -> app ->log ("Added jailkit chroot " , LOGLEVEL_DEBUG );
316+ $ app ->log ("Added jailkit chroot " , LOGLEVEL_DEBUG );
319317
320318 $ this ->_add_jailkit_programs ($ options );
321319
322- $ this -> app ->load ('tpl ' );
320+ $ app ->load ('tpl ' );
323321
324322 $ tpl = new tpl ();
325323 $ tpl ->newTemplate ("bash.bashrc.master " );
@@ -334,7 +332,7 @@ function _setup_jailkit_chroot()
334332 file_put_contents ($ bashrc , $ tpl ->grab ());
335333 unset($ tpl );
336334
337- $ this -> app ->log ("Added bashrc script: " .$ bashrc , LOGLEVEL_DEBUG );
335+ $ app ->log ("Added bashrc script: " .$ bashrc , LOGLEVEL_DEBUG );
338336
339337 $ tpl = new tpl ();
340338 $ tpl ->newTemplate ("motd.master " );
@@ -376,7 +374,7 @@ function _add_jailkit_programs($opts=array())
376374 if (is_file ($ jailkit_chroot_app_program ) || is_dir ($ jailkit_chroot_app_program )){
377375 //copy over further programs and its libraries
378376 $ app ->system ->create_jailkit_programs ($ this ->data ['new ' ]['dir ' ], $ jailkit_chroot_app_program , $ opts );
379- $ this -> app ->log ("Added programs to jailkit chroot " , LOGLEVEL_DEBUG );
377+ $ app ->log ("Added programs to jailkit chroot " , LOGLEVEL_DEBUG );
380378 }
381379 }
382380 }
@@ -425,13 +423,13 @@ function _add_jailkit_user()
425423 $ app ->system ->chown ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome , $ this ->data ['new ' ]['username ' ]);
426424 $ app ->system ->chgrp ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome , $ this ->data ['new ' ]['pgroup ' ]);
427425
428- $ this -> app ->log ("Added created jailkit user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome , LOGLEVEL_DEBUG );
426+ $ app ->log ("Added created jailkit user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_userhome , LOGLEVEL_DEBUG );
429427
430428 if (!is_dir ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome )) mkdir ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome , 0750 , true );
431429 $ app ->system ->chown ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome , $ this ->data ['new ' ]['puser ' ]);
432430 $ app ->system ->chgrp ($ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome , $ this ->data ['new ' ]['pgroup ' ]);
433431
434- $ this -> app ->log ("Added jailkit parent user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome , LOGLEVEL_DEBUG );
432+ $ app ->log ("Added jailkit parent user home in : " .$ this ->data ['new ' ]['dir ' ].$ jailkit_chroot_puserhome , LOGLEVEL_DEBUG );
435433
436434
437435 }
@@ -460,13 +458,13 @@ function _update_website_security_level() {
460458
461459 private function _setup_ssh_rsa () {
462460 global $ app ;
463- $ this -> app ->log ("ssh-rsa setup shelluser_jailkit " , LOGLEVEL_DEBUG );
461+ $ app ->log ("ssh-rsa setup shelluser_jailkit " , LOGLEVEL_DEBUG );
464462 // Get the client ID, username, and the key
465- $ domain_data = $ this -> app ->db ->queryOneRecord ('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = ? ' , $ this ->data ['new ' ]['parent_domain_id ' ]);
466- $ sys_group_data = $ this -> app ->db ->queryOneRecord ('SELECT * FROM sys_group WHERE sys_group.groupid = ? ' , $ domain_data ['sys_groupid ' ]);
463+ $ domain_data = $ app ->db ->queryOneRecord ('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = ? ' , $ this ->data ['new ' ]['parent_domain_id ' ]);
464+ $ sys_group_data = $ app ->db ->queryOneRecord ('SELECT * FROM sys_group WHERE sys_group.groupid = ? ' , $ domain_data ['sys_groupid ' ]);
467465 $ id = intval ($ sys_group_data ['client_id ' ]);
468466 $ username = $ sys_group_data ['name ' ];
469- $ client_data = $ this -> app ->db ->queryOneRecord ('SELECT * FROM client WHERE client.client_id = ? ' , $ id );
467+ $ client_data = $ app ->db ->queryOneRecord ('SELECT * FROM client WHERE client.client_id = ? ' , $ id );
470468 $ userkey = $ client_data ['ssh_rsa ' ];
471469 unset($ domain_data );
472470 unset($ client_data );
@@ -487,7 +485,7 @@ private function _setup_ssh_rsa() {
487485 $ app ->uses ('functions ' );
488486 $ app ->functions ->generate_ssh_key ($ id , $ username );
489487
490- $ this -> app ->log ("ssh-rsa keypair generated for " .$ username , LOGLEVEL_DEBUG );
488+ $ app ->log ("ssh-rsa keypair generated for " .$ username , LOGLEVEL_DEBUG );
491489 };
492490
493491 if (!file_exists ($ sshkeys )){
@@ -511,7 +509,7 @@ private function _setup_ssh_rsa() {
511509 // add the user's key
512510 file_put_contents ($ sshkeys , $ final_keys );
513511 $ app ->file ->remove_blank_lines ($ sshkeys );
514- $ this -> app ->log ("ssh-rsa authorisation keyfile created in " .$ sshkeys , LOGLEVEL_DEBUG );
512+ $ app ->log ("ssh-rsa authorisation keyfile created in " .$ sshkeys , LOGLEVEL_DEBUG );
515513 }
516514 //* Get the keys
517515 $ existing_keys = file ($ sshkeys , FILE_IGNORE_NEW_LINES );
@@ -546,7 +544,7 @@ private function _setup_ssh_rsa() {
546544 // add the custom key
547545 $ app ->system ->file_put_contents ($ sshkeys , $ final_keys );
548546 $ app ->file ->remove_blank_lines ($ sshkeys );
549- $ this -> app ->log ("ssh-rsa key updated in " .$ sshkeys , LOGLEVEL_DEBUG );
547+ $ app ->log ("ssh-rsa key updated in " .$ sshkeys , LOGLEVEL_DEBUG );
550548
551549 // set proper file permissions
552550 $ app ->system ->exec_safe ("chown -R ?:? ? " , $ this ->data ['new ' ]['puser ' ], $ this ->data ['new ' ]['pgroup ' ], $ sshdir );
0 commit comments