Skip to content

Commit 3d84997

Browse files
committed
Fix formatting
1 parent a54517c commit 3d84997

File tree

2 files changed

+48
-48
lines changed

2 files changed

+48
-48
lines changed

server/plugins-available/cron_jailkit_plugin.inc.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,21 @@ function insert($event_name, $data) {
105105
*/
106106

107107

108-
if ($data['new']['type'] == "chrooted")
108+
if($data['new']['type'] == "chrooted")
109109
{
110110
// load the server configuration options
111111
$app->uses("getconf");
112112
$this->data = $data;
113113
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
114-
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
114+
foreach(array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
115115
// Replace and don't inherit the server's Jailkit config
116116
if (isset($parent_domain[$section]) && $parent_domain[$section] != '' ) {
117117
$this->jailkit_config[$section] = $parent_domain[$section];
118118
}
119119
// Add selected PHP version to the jailkit chroot
120-
if ($section == 'jailkit_chroot_app_sections') {
121-
if (isset($parent_domain['php_jk_section']) && $parent_domain['php_jk_section'] != '' ) {
122-
if (is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
120+
if($section == 'jailkit_chroot_app_sections') {
121+
if(isset($parent_domain['php_jk_section']) && $parent_domain['php_jk_section'] != '' ) {
122+
if(is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
123123
$this->jailkit_config['jailkit_chroot_app_sections'] = implode(' ', $this->jailkit_config['jailkit_chroot_app_sections']);
124124
}
125125
$this->jailkit_config['jailkit_chroot_app_sections'] = $this->jailkit_config['jailkit_chroot_app_sections'] . ' ' . $parent_domain['php_jk_section'];
@@ -189,7 +189,7 @@ function update($event_name, $data) {
189189
/**
190190
* Setup Jailkit Chroot System If Enabled
191191
*/
192-
if ($data['new']['type'] == "chrooted")
192+
if($data['new']['type'] == "chrooted")
193193
{
194194
$app->log("Jailkit Plugin (Cron) -> setting up jail", LOGLEVEL_DEBUG);
195195
// load the server configuration options
@@ -249,13 +249,13 @@ function delete($event_name, $data) {
249249

250250
$app->uses('system');
251251

252-
if ($data['old']['type'] == "chrooted")
252+
if($data['old']['type'] == "chrooted")
253253
{
254254
$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ?", $data['old']['parent_domain_id']);
255255

256256
// should copy some _delete_homedir() functionality from shelluser_jailkit_plugin ?
257257
258-
if (isset($parent_domain['delete_unused_jailkit']) && $parent_domain['delete_unused_jailkit'] == 'y') {
258+
if(isset($parent_domain['delete_unused_jailkit']) && $parent_domain['delete_unused_jailkit'] == 'y') {
259259
$app->system->web_folder_protection($parent_domain['document_root'], false);
260260
$this->_delete_jailkit_if_unused($parent_domain['domain_id']);
261261
$app->system->web_folder_protection($parent_domain['document_root'], true);
@@ -268,10 +268,10 @@ function _setup_jailkit_chroot()
268268
global $app, $conf;
269269

270270

271-
if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
272-
if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
271+
if(isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
272+
if($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
273273
$options = array('hardlink');
274-
} elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') {
274+
} elseif($this->jailkit_config['jailkit_hardlinks'] == 'no') {
275275
$options = array();
276276
}
277277
} else {
@@ -288,7 +288,7 @@ function _setup_jailkit_chroot()
288288
// should move return here if $update_hash == $parent_domain['last_jailkit_hash'] ?
289289
290290
// check if the chroot environment is created yet if not create it with a list of program sections from the config
291-
if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
291+
if(!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
292292
{
293293

294294
$app->load('tpl');
@@ -314,12 +314,12 @@ function _setup_jailkit_chroot()
314314
$programs = $this->jailkit_config['jailkit_chroot_app_programs'] . ' '
315315
. $this->jailkit_config['jailkit_chroot_cron_programs'];
316316

317-
if ($update_hash == $this->parent_domain['last_jailkit_hash']) {
317+
if($update_hash == $this->parent_domain['last_jailkit_hash']) {
318318
return;
319319
}
320320

321321
$records = $app->db->queryAllRecords('SELECT web_folder FROM `web_domain` WHERE `parent_domain_id` = ? AND `document_root` = ? AND web_folder != \'\' AND web_folder IS NOT NULL AND `server_id` = ?', $this->parent_domain['domain_id'], $this->parent_domain['document_root'], $conf['server_id']);
322-
foreach ($records as $record) {
322+
foreach($records as $record) {
323323
$options[] = 'skip='.$record['web_folder'];
324324
}
325325

@@ -400,12 +400,12 @@ private function _delete_jailkit_if_unused($parent_domain_id) {
400400

401401
// get jail directory
402402
$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ? OR `parent_domain_id` = ? AND `document_root` IS NOT NULL", $parent_domain_id, $parent_domain_id);
403-
if (!is_dir($parent_domain['document_root'])) {
403+
if(!is_dir($parent_domain['document_root'])) {
404404
return;
405405
}
406406

407407
// chroot is used by php-fpm
408-
if (isset($parent_domain['php_fpm_chroot']) && $parent_domain['php_fpm_chroot'] == 'y') {
408+
if(isset($parent_domain['php_fpm_chroot']) && $parent_domain['php_fpm_chroot'] == 'y') {
409409
return;
410410
}
411411

@@ -423,7 +423,7 @@ private function _delete_jailkit_if_unused($parent_domain_id) {
423423

424424
$options = array();
425425
$records = $app->db->queryAllRecords('SELECT web_folder FROM `web_domain` WHERE `parent_domain_id` = ? AND `document_root` = ? AND web_folder != \'\' AND web_folder IS NOT NULL AND `server_id` = ?', $parent_domain_id, $parent_domain['document_root'], $conf['server_id']);
426-
foreach ($records as $record) {
426+
foreach($records as $record) {
427427
$options[] = 'skip='.$record['web_folder'];
428428
}
429429

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ function insert($event_name, $data) {
118118
* Setup Jailkit Chroot System If Enabled
119119
*/
120120

121-
if ($data['new']['chroot'] == "jailkit")
121+
if($data['new']['chroot'] == "jailkit")
122122
{
123123

124124
// load the server configuration options
125125
$app->uses("getconf");
126126
$this->data = $data;
127127
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
128128

129-
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
129+
foreach(array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
130130
// Replace and don't inherit the server's Jailkit config
131-
if (isset($web[$section]) && $web[$section] != '' ) {
131+
if(isset($web[$section]) && $web[$section] != '' ) {
132132
$this->jailkit_config[$section] = $web[$section];
133133
}
134134
// Add selected PHP version to the jailkit chroot
135-
if ($section == 'jailkit_chroot_app_sections') {
136-
if (isset($web['php_jk_section']) && $web['php_jk_section'] != '' ) {
135+
if($section == 'jailkit_chroot_app_sections') {
136+
if(isset($web['php_jk_section']) && $web['php_jk_section'] != '' ) {
137137
if(is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
138138
$this->jailkit_config['jailkit_chroot_app_sections'] = implode(' ', $this->jailkit_config['jailkit_chroot_app_sections']);
139139
}
@@ -232,26 +232,26 @@ function update($event_name, $data) {
232232
/**
233233
* Setup Jailkit Chroot System If Enabled
234234
*/
235-
if ($data['new']['chroot'] == "jailkit")
235+
if($data['new']['chroot'] == "jailkit")
236236
{
237237

238238
// load the server configuration options
239239
$app->uses("getconf");
240240
$this->data = $data;
241241
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
242242

243-
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
243+
foreach(array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs') as $section) {
244244
// Replace and don't inherit the server's Jailkit config
245-
if (isset($web[$section]) && $web[$section] != '' ) {
245+
if(isset($web[$section]) && $web[$section] != '' ) {
246246
$this->jailkit_config[$section] = $web[$section];
247247
}
248-
if (is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
248+
if(is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
249249
$this->jailkit_config['jailkit_chroot_app_sections'] = implode(' ', $this->jailkit_config['jailkit_chroot_app_sections']);
250250
}
251251
// Add selected PHP version to the jailkit chroot
252-
if ($section == 'jailkit_chroot_app_sections') {
253-
if (isset($web['php_jk_section']) && $web['php_jk_section'] != '' ) {
254-
if (is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
252+
if($section == 'jailkit_chroot_app_sections') {
253+
if(isset($web['php_jk_section']) && $web['php_jk_section'] != '' ) {
254+
if(is_array($this->jailkit_config['jailkit_chroot_app_sections'])) {
255255
$this->jailkit_config['jailkit_chroot_app_sections'] = implode(' ', $this->jailkit_config['jailkit_chroot_app_sections']);
256256
}
257257

@@ -320,15 +320,15 @@ function delete($event_name, $data) {
320320
return false;
321321
}
322322

323-
if ($data['old']['chroot'] == "jailkit")
323+
if($data['old']['chroot'] == "jailkit")
324324
{
325325
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $data['old']['parent_domain_id']);
326326

327327
$app->uses("getconf");
328328
$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
329329

330-
foreach (array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs', 'jailkit_do_not_remove_paths') as $section) {
331-
if (isset($web[$section]) && $web[$section] != '' ) {
330+
foreach(array('jailkit_chroot_app_sections', 'jailkit_chroot_app_programs', 'jailkit_do_not_remove_paths') as $section) {
331+
if(isset($web[$section]) && $web[$section] != '' ) {
332332
$this->jailkit_config[$section] = $web[$section];
333333
}
334334
}
@@ -352,7 +352,7 @@ function delete($event_name, $data) {
352352
$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
353353
}
354354

355-
if (isset($web['delete_unused_jailkit']) && $web['delete_unused_jailkit'] == 'y') {
355+
if(isset($web['delete_unused_jailkit']) && $web['delete_unused_jailkit'] == 'y') {
356356
$this->_delete_jailkit_if_unused($web['domain_id']);
357357
}
358358

@@ -368,10 +368,10 @@ function _setup_jailkit_chroot()
368368
{
369369
global $app, $conf;
370370

371-
if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
372-
if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
371+
if(isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
372+
if($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
373373
$options = array('hardlink');
374-
} elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') {
374+
} elseif($this->jailkit_config['jailkit_hardlinks'] == 'no') {
375375
$options = array();
376376
} else {
377377
$options = array();
@@ -395,7 +395,7 @@ function _setup_jailkit_chroot()
395395
// should move return here if $update_hash == $web['last_jailkit_hash'] ?
396396
397397
// check if the chroot environment is created yet if not create it with a list of program sections from the config
398-
if (!is_dir($this->data['new']['dir'].'/etc/jailkit'))
398+
if(!is_dir($this->data['new']['dir'].'/etc/jailkit'))
399399
{
400400

401401
$app->load('tpl');
@@ -424,12 +424,12 @@ function _setup_jailkit_chroot()
424424
. $this->jailkit_config['jailkit_chroot_cron_programs'];
425425

426426

427-
if ($update_hash == $web['last_jailkit_hash']) {
427+
if($update_hash == $web['last_jailkit_hash']) {
428428
return;
429429
}
430430

431431
$records = $app->db->queryAllRecords('SELECT web_folder FROM `web_domain` WHERE `parent_domain_id` = ? AND `document_root` = ? AND web_folder != \'\' AND web_folder IS NOT NULL AND `server_id` = ?', $this->data['new']['parent_domain_id'], $this->data['new']['dir'], $conf['server_id']);
432-
foreach ($records as $record) {
432+
foreach($records as $record) {
433433
$options[] = 'skip='.$record['web_folder'];
434434
}
435435

@@ -578,14 +578,14 @@ private function _setup_ssh_rsa() {
578578
$sshrsa = $app->file->remove_blank_lines($sshrsa, 0);
579579

580580
// If this user has no key yet, generate a pair
581-
if ($userkey == '' && $id > 0){
581+
if($userkey == '' && $id > 0){
582582
//Generate ssh-rsa-keys
583583
$app->uses('functions');
584584
$app->functions->generate_ssh_key($id, $username);
585585
$app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
586586
};
587587

588-
if (!file_exists($sshkeys)){
588+
if(!file_exists($sshkeys)){
589589
// add root's key
590590
$app->file->mkdirs($sshdir, '0700');
591591
$authorized_keys_template = $this->jailkit_config['jailkit_chroot_authorized_keys_template'];
@@ -625,7 +625,7 @@ private function _setup_ssh_rsa() {
625625
if(is_array($old_keys)) {
626626
foreach($old_keys as $key => $val) {
627627
$k = array_search(trim($val), $existing_keys);
628-
if ($k !== false) {
628+
if($k !== false) {
629629
unset($existing_keys[$k]);
630630
}
631631
}
@@ -704,12 +704,12 @@ private function _delete_jailkit_if_unused($parent_domain_id) {
704704

705705
// get jail directory
706706
$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ? OR `parent_domain_id` = ? AND `document_root` IS NOT NULL", $parent_domain_id, $parent_domain_id);
707-
if (!is_dir($parent_domain['document_root'])) {
707+
if(!is_dir($parent_domain['document_root'])) {
708708
return;
709709
}
710710

711711
// chroot is used by php-fpm
712-
if (isset($parent_domain['php_fpm_chroot']) && $parent_domain['php_fpm_chroot'] == 'y') {
712+
if(isset($parent_domain['php_fpm_chroot']) && $parent_domain['php_fpm_chroot'] == 'y') {
713713
return;
714714
}
715715

@@ -727,7 +727,7 @@ private function _delete_jailkit_if_unused($parent_domain_id) {
727727

728728
$options = array();
729729
$records = $app->db->queryAllRecords('SELECT web_folder FROM `web_domain` WHERE `parent_domain_id` = ? AND `document_root` = ? AND web_folder != \'\' AND web_folder IS NOT NULL AND `server_id` = ?', $parent_domain_id, $parent_domain['document_root'], $conf['server_id']);
730-
foreach ($records as $record) {
730+
foreach($records as $record) {
731731
$options[] = 'skip='.$record['web_folder'];
732732
}
733733

@@ -757,7 +757,7 @@ function _setup_shell_php() {
757757
$tpl->newTemplate("bashrc_user_deb.master");
758758
$php_alternatives = $web_docroot . '/etc/alternatives/php';
759759
$home_php = $php_alternatives;
760-
} elseif ($used_os_type == "redhat") {
760+
} elseif($used_os_type == "redhat") {
761761
$tpl->newTemplate("bashrc_user_redhat.master");
762762
$home_php = $web_docroot . '/home/' . $this->data['new']['username'] . '/.local/bin/php';
763763
} else {
@@ -776,7 +776,7 @@ function _setup_shell_php() {
776776

777777
$bashrc = $this->web['document_root'] . '/home/' . $this->data['new']['username'] . '/.bashrc';
778778

779-
if (@is_file($bashrc) || @is_link($bashrc)) {
779+
if(@is_file($bashrc) || @is_link($bashrc)) {
780780
unlink($bashrc);
781781
}
782782
file_put_contents($bashrc, $tpl->grab());
@@ -810,7 +810,7 @@ function _setup_shell_php() {
810810
// Check if any PHP binary is available in the jail and use the most recent version as fallback
811811
$fallback_php = $app->system->get_newest_php_bin($web_docroot . $php_bin_dir);
812812

813-
if (!empty($fallback_php)) {
813+
if(!empty($fallback_php)) {
814814
$fallback_php_bin = str_replace($web_docroot, '', $fallback_php);
815815

816816
if(file_exists($fallback_php_bin)) {

0 commit comments

Comments
 (0)