Skip to content

Commit 78ce49a

Browse files
committed
eliminate all usage of $this->app
1 parent 5454f62 commit 78ce49a

File tree

7 files changed

+38
-50
lines changed

7 files changed

+38
-50
lines changed

install/lib/installer_base.lib.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class installer_base {
4242

4343
public function __construct() {
4444
global $conf; //TODO: maybe $conf should be passed to constructor
45-
//$this->conf = $conf;
4645
}
4746

4847
//: TODO Implement the translation function and language files for the installer.

interface/lib/classes/remoting.inc.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public function __construct($methods = array())
5959
$app->uses('remoting_lib');
6060

6161
$this->_methods = $methods;
62-
63-
/*
64-
$this->app = $app;
65-
$this->conf = $conf;
66-
*/
6762
}
6863

6964
//* remote login function

server/plugins-available/apache2_plugin.inc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,11 +3714,11 @@ function _setup_jailkit_chroot()
37143714
if (!is_dir($this->website['document_root'].'/etc/jailkit'))
37153715
{
37163716
$app->system->create_jailkit_chroot($this->website['document_root'], $this->jailkit_config['jailkit_chroot_app_sections'], $options);
3717-
$this->app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
3717+
$app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
37183718

37193719
$this->_add_jailkit_programs($options);
37203720

3721-
$this->app->load('tpl');
3721+
$app->load('tpl');
37223722

37233723
$tpl = new tpl();
37243724
$tpl->newTemplate("bash.bashrc.master");
@@ -3733,7 +3733,7 @@ function _setup_jailkit_chroot()
37333733
file_put_contents($bashrc, $tpl->grab());
37343734
unset($tpl);
37353735

3736-
$this->app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG);
3736+
$app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG);
37373737

37383738
$tpl = new tpl();
37393739
$tpl->newTemplate("motd.master");
@@ -3773,10 +3773,10 @@ function _add_jailkit_programs($opts=array())
37733773

37743774
//copy over further programs and its libraries
37753775
$app->system->create_jailkit_programs($this->website['document_root'], $this->jailkit_config['jailkit_chroot_app_programs'], $opts);
3776-
$this->app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
3776+
$app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
37773777

37783778
$app->system->create_jailkit_programs($this->website['document_root'], $this->jailkit_config['jailkit_chroot_cron_programs'], $opts);
3779-
$this->app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
3779+
$app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
37803780
}
37813781

37823782
function _get_home_dir($username)
@@ -3804,7 +3804,7 @@ function _add_jailkit_user()
38043804
$app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']);
38053805
$app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']);
38063806

3807-
$this->app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
3807+
$app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
38083808
}
38093809

38103810
private function _delete_jailkit_if_unused($parent_domain_id) {

server/plugins-available/cron_jailkit_plugin.inc.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function insert($event_name, $data) {
105105
// load the server configuration options
106106
$app->uses("getconf");
107107
$this->data = $data;
108-
$this->app = $app;
109108
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
110109
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
111110
if (isset($parent_domain[$section]) && $parent_domain[$section] != '' ) {
@@ -174,7 +173,6 @@ function update($event_name, $data) {
174173
// load the server configuration options
175174
$app->uses("getconf");
176175
$this->data = $data;
177-
$this->app = $app;
178176
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
179177
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
180178
if (isset($parent_domain[$section]) && $parent_domain[$section] != '' ) {
@@ -255,11 +253,11 @@ function _setup_jailkit_chroot()
255253
if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
256254
{
257255
$app->system->create_jailkit_chroot($this->parent_domain['document_root'], $this->jailkit_config['jailkit_chroot_app_sections'], $options);
258-
$this->app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
256+
$app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
259257

260258
$this->_add_jailkit_programs($options);
261259

262-
$this->app->load('tpl');
260+
$app->load('tpl');
263261

264262
$tpl = new tpl();
265263
$tpl->newTemplate("bash.bashrc.master");
@@ -274,7 +272,7 @@ function _setup_jailkit_chroot()
274272
$app->system->file_put_contents($bashrc, $tpl->grab());
275273
unset($tpl);
276274

277-
$this->app->log('Added bashrc script: '.$bashrc, LOGLEVEL_DEBUG);
275+
$app->log('Added bashrc script: '.$bashrc, LOGLEVEL_DEBUG);
278276

279277
$tpl = new tpl();
280278
$tpl->newTemplate('motd.master');
@@ -312,10 +310,10 @@ function _add_jailkit_programs($opts=array())
312310

313311
//copy over further programs and its libraries
314312
$app->system->create_jailkit_programs($this->parent_domain['document_root'], $this->jailkit_config['jailkit_chroot_app_programs'], $opts);
315-
$this->app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
313+
$app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
316314

317315
$app->system->create_jailkit_programs($this->parent_domain['document_root'], $this->jailkit_config['jailkit_chroot_cron_programs'], $opts);
318-
$this->app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
316+
$app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
319317
}
320318

321319
function _add_jailkit_user()

server/plugins-available/nginx_plugin.inc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,11 +3499,11 @@ function _setup_jailkit_chroot()
34993499
if (!is_dir($this->website['document_root'].'/etc/jailkit'))
35003500
{
35013501
$app->system->create_jailkit_chroot($this->website['document_root'], $this->jailkit_config['jailkit_chroot_app_sections'], $options);
3502-
$this->app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
3502+
$app->log("Added jailkit chroot", LOGLEVEL_DEBUG);
35033503

35043504
$this->_add_jailkit_programs($options);
35053505

3506-
$this->app->load('tpl');
3506+
$app->load('tpl');
35073507

35083508
$tpl = new tpl();
35093509
$tpl->newTemplate("bash.bashrc.master");
@@ -3518,7 +3518,7 @@ function _setup_jailkit_chroot()
35183518
file_put_contents($bashrc, $tpl->grab());
35193519
unset($tpl);
35203520

3521-
$this->app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG);
3521+
$app->log("Added bashrc script: ".$bashrc, LOGLEVEL_DEBUG);
35223522

35233523
$tpl = new tpl();
35243524
$tpl->newTemplate("motd.master");
@@ -3558,10 +3558,10 @@ function _add_jailkit_programs($opts=array())
35583558

35593559
//copy over further programs and its libraries
35603560
$app->system->create_jailkit_programs($this->website['document_root'], $this->jailkit_config['jailkit_chroot_app_programs'], $opts);
3561-
$this->app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
3561+
$app->log("Added app programs to jailkit chroot", LOGLEVEL_DEBUG);
35623562

35633563
$app->system->create_jailkit_programs($this->website['document_root'], $this->jailkit_config['jailkit_chroot_cron_programs'], $opts);
3564-
$this->app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
3564+
$app->log("Added cron programs to jailkit chroot", LOGLEVEL_DEBUG);
35653565
}
35663566

35673567
function _get_home_dir($username)
@@ -3589,7 +3589,7 @@ function _add_jailkit_user()
35893589
$app->system->chown($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_user']);
35903590
$app->system->chgrp($this->website['document_root'].$jailkit_chroot_userhome, $this->website['system_group']);
35913591

3592-
$this->app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
3592+
$app->log("Added created jailkit user home in : ".$this->website['document_root'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
35933593
}
35943594

35953595
private function _delete_jailkit_if_unused($parent_domain_id) {

server/plugins-available/shelluser_base_plugin.inc.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ function insert($event_name, $data) {
146146
// call the ssh-rsa update function
147147
$app->uses("getconf");
148148
$this->data = $data;
149-
$this->app = $app;
150149
$this->_setup_ssh_rsa();
151150

152151
//* Create .bash_history file
@@ -262,7 +261,6 @@ function update($event_name, $data) {
262261
// call the ssh-rsa update function
263262
$app->uses("getconf");
264263
$this->data = $data;
265-
$this->app = $app;
266264
$this->_setup_ssh_rsa();
267265

268266
//* Create .bash_history file
@@ -401,13 +399,13 @@ function delete($event_name, $data) {
401399

402400
private function _setup_ssh_rsa() {
403401
global $app;
404-
$this->app->log("ssh-rsa setup shelluser_base", LOGLEVEL_DEBUG);
402+
$app->log("ssh-rsa setup shelluser_base", LOGLEVEL_DEBUG);
405403
// Get the client ID, username, and the key
406-
$domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = ?', $this->data['new']['parent_domain_id']);
407-
$sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = ?', $domain_data['sys_groupid']);
404+
$domain_data = $app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = ?', $this->data['new']['parent_domain_id']);
405+
$sys_group_data = $app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = ?', $domain_data['sys_groupid']);
408406
$id = intval($sys_group_data['client_id']);
409407
$username= $sys_group_data['name'];
410-
$client_data = $this->app->db->queryOneRecord('SELECT * FROM client WHERE client.client_id = ?', $id);
408+
$client_data = $app->db->queryOneRecord('SELECT * FROM client WHERE client.client_id = ?', $id);
411409
$userkey = $client_data['ssh_rsa'];
412410
unset($domain_data);
413411
unset($client_data);
@@ -439,7 +437,7 @@ private function _setup_ssh_rsa() {
439437
//Generate ssh-rsa-keys
440438
$app->uses('functions');
441439
$app->functions->generate_ssh_key($id, $username);
442-
$this->app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
440+
$app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
443441
};
444442

445443
if (!file_exists($sshkeys)){
@@ -462,7 +460,7 @@ private function _setup_ssh_rsa() {
462460
// add the user's key
463461
$app->system->file_put_contents($sshkeys, $final_keys);
464462
$app->file->remove_blank_lines($sshkeys);
465-
$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
463+
$app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
466464
}
467465

468466
//* Get the keys
@@ -498,7 +496,7 @@ private function _setup_ssh_rsa() {
498496
// add the custom key
499497
$app->system->file_put_contents($sshkeys, $final_keys);
500498
$app->file->remove_blank_lines($sshkeys);
501-
$this->app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
499+
$app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
502500

503501
// set proper file permissions
504502
$app->system->exec_safe("chown -R ?:? ?", $this->data['new']['puser'], $this->data['new']['pgroup'], $sshdir);

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)