diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php index 9fbb22786314713d28eb6a1dd7a2436b125d2713..edd1f7ae96d76714bb463048873ef1bfc43d1a2a 100644 --- a/interface/lib/classes/db_mysql.inc.php +++ b/interface/lib/classes/db_mysql.inc.php @@ -483,7 +483,7 @@ class db extends mysqli $cur_encoding = mb_detect_encoding($sString); if($cur_encoding != "UTF-8") { if($cur_encoding != 'ASCII') { - $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO); + if(is_object($app) && method_exists($app, 'log')) $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO); if($cur_encoding) $sString = mb_convert_encoding($sString, 'UTF-8', $cur_encoding); else $sString = mb_convert_encoding($sString, 'UTF-8'); } diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php index 634a91d188961c37bf66b3ef34fe05cfaed5dcbf..d6a20df74947d2519c9d68ba6affcbe62d5af0bb 100644 --- a/interface/web/dns/dns_soa_edit.php +++ b/interface/web/dns/dns_soa_edit.php @@ -273,16 +273,14 @@ function onBeforeUpdate () { //* Check if the server has been changed // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway - if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { + if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord['origin'])) { //* We do not allow users to change a domain which has been created by the admin $rec = $app->db->queryOneRecord("SELECT origin from dns_soa WHERE id = ?", $this->id); - $drOrigin = (isset($this->dataRecord['origin'])) - ? $app->functions->idn_encode($this->dataRecord['origin']) - : false; + $drOrigin = $app->functions->idn_encode($this->dataRecord['origin']); if($rec['origin'] !== $drOrigin && $app->tform->checkPerm($this->id, 'u')) { //* Add a error message and switch back to old server - $app->tform->errorMessage .= $app->lng('The Zone (soa) can not be changed. Please ask your Administrator if you want to change the Zone name.'); + $app->tform->errorMessage .= $app->tform->wordbook["soa_cannot_be_changed_txt"]; $this->dataRecord["origin"] = $rec['origin']; } unset($rec); diff --git a/interface/web/dns/lib/lang/de_dns_soa.lng b/interface/web/dns/lib/lang/de_dns_soa.lng index 4a017e6fe8612b28523c9e0efc7da0eaa3f42d4a..efd6e905515e3b6a16d081e54af5e2397d14c43c 100644 --- a/interface/web/dns/lib/lang/de_dns_soa.lng +++ b/interface/web/dns/lib/lang/de_dns_soa.lng @@ -35,4 +35,5 @@ $wb['expire_range_error'] = 'Min. Expire ist 60 Sekunden.'; $wb['minimum_range_error'] = 'Min. Minimum ist 60 Sekunden.'; $wb['ttl_range_error'] = 'Min. TTL ist 60 Sekunden.'; $wb['xfer_error_regex'] = 'Zonentransfer: Verwenden Sie eine oder mehrere durch Komma getrennte IP Adressen oder das Wort: any.'; +$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.'; ?> diff --git a/interface/web/dns/lib/lang/en_dns_soa.lng b/interface/web/dns/lib/lang/en_dns_soa.lng index 50ee65b6fdd960c7e377e565a1429dfc385ac435..433530c02daf50067a71f9302145303c2f936de5 100644 --- a/interface/web/dns/lib/lang/en_dns_soa.lng +++ b/interface/web/dns/lib/lang/en_dns_soa.lng @@ -36,4 +36,5 @@ $wb['expire_range_error'] = 'Min. Expire time is 60 seconds.'; $wb['minimum_range_error'] = 'Min. Minimum time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['error_not_allowed_server_id'] = 'The selected server is not allowed for this account.'; +$wb['soa_cannot_be_changed_txt'] = 'Die Zone (SOA) kann nicht verändert werden. Bitte kontaktieren Sie ihren Administrator, um die Zone zu ändern.'; ?> diff --git a/interface/web/mail/form/mail_relay_recipient.tform.php b/interface/web/mail/form/mail_relay_recipient.tform.php index 210f5194b2728b552069b1f18d6de53a95fc07bf..4c5b2b1db1656d4fcad9531f45f216733bf997f7 100644 --- a/interface/web/mail/form/mail_relay_recipient.tform.php +++ b/interface/web/mail/form/mail_relay_recipient.tform.php @@ -63,7 +63,7 @@ $form["tabs"]['relay_recipient'] = array ( 'formtype' => 'SELECT', 'default' => '', 'datasource' => array ( 'type' => 'SQL', - 'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_servr_id = 0 AND {AUTHSQL} ORDER BY server_name', + 'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name', 'keyfield'=> 'server_id', 'valuefield'=> 'server_name' ), diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index 2d728f1cf50ac9a78e87472aef70211c4a9f834c..f11b8a2dbc9ad46719a9f341d3252e0ba8a43806 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -447,7 +447,7 @@ class db extends mysqli $cur_encoding = mb_detect_encoding($sString); if($cur_encoding != "UTF-8") { if($cur_encoding != 'ASCII') { - $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO); + if(is_object($app) && method_exists($app, 'log')) $app->log('String ' . substr($sString, 0, 25) . '... is ' . $cur_encoding . '.', LOGLEVEL_INFO); if($cur_encoding) $sString = mb_convert_encoding($sString, 'UTF-8', $cur_encoding); else $sString = mb_convert_encoding($sString, 'UTF-8'); } diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 4bacf07e762a55ede48716cc3297a35c30c610bd..6eabdd8112556c5c76abad94c9c099735e8a0498 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1405,7 +1405,7 @@ class apache2_plugin { * PHP-FPM */ // Support for multiple PHP versions - if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ + if($data['new']['php'] == 'php-fpm'){ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_php_fpm = false; list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); @@ -2855,11 +2855,14 @@ class apache2_plugin { file_put_contents('/etc/init.d/hhvm_' . $data['new']['system_user'], $content); exec('chmod +x /etc/init.d/hhvm_' . $data['new']['system_user'] . ' >/dev/null 2>&1'); exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); - exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' start >/dev/null 2>&1'); + exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); - $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); - file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content); - exec('/etc/init.d/monit restart >/dev/null 2>&1'); + if(is_dir('/etc/monit/conf.d')){ + $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); + file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + exec('/etc/init.d/monit restart >/dev/null 2>&1'); + } } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); @@ -2867,8 +2870,13 @@ class apache2_plugin { unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ - unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + } + if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user']); + } exec('/etc/init.d/monit restart >/dev/null 2>&1'); } } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 9ce9de83f015d1e731206eec0510caaf122c704e..d3eb7064085249050f5663643383da5dba03289d 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -950,7 +950,7 @@ class nginx_plugin { $default_php_fpm = true; } */ - if($data['new']['php'] != 'no'){ + if($data['new']['php'] == 'php-fpm'){ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_php_fpm = false; list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); @@ -2424,9 +2424,12 @@ class nginx_plugin { exec('/usr/sbin/update-rc.d hhvm_' . $data['new']['system_user'] . ' defaults >/dev/null 2>&1'); exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); - $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); - file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content); - exec('/etc/init.d/monit restart >/dev/null 2>&1'); + if(is_dir('/etc/monit/conf.d')){ + $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); + file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + exec('/etc/init.d/monit restart >/dev/null 2>&1'); + } } elseif($data['new']['php'] != 'hhvm' && $data['old']['php'] == 'hhvm') { exec('/etc/init.d/hhvm_' . $data['old']['system_user'] . ' stop >/dev/null 2>&1'); @@ -2434,8 +2437,13 @@ class nginx_plugin { unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); - if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ - unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); + } + if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ + unlink('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user']); + } exec('/etc/init.d/monit restart >/dev/null 2>&1'); } } @@ -2454,7 +2462,7 @@ class nginx_plugin { $default_php_fpm = true; } */ - if($data['new']['php'] != 'no'){ + if($data['new']['php'] == 'php-fpm'){ if(trim($data['new']['fastcgi_php_version']) != ''){ $default_php_fpm = false; list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); @@ -2475,7 +2483,7 @@ class nginx_plugin { $app->uses("getconf"); $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); - if($data['new']['php'] == 'no'){ + if($data['new']['php'] != 'php-fpm'){ if(@is_file($pool_dir.$pool_name.'.conf')){ $app->system->unlink($pool_dir.$pool_name.'.conf'); //$reload = true; diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index d66428b78195c15b246310cecfac2e8b87013b03..8a51b1071a0a4133184bc9f9b86259d3c7f7c428 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -149,6 +149,12 @@ class shelluser_base_plugin { $app->system->chown(escapeshellcmd($homedir).'/.bash_history', $data['new']['username']); $app->system->chgrp(escapeshellcmd($homedir).'/.bash_history', $data['new']['pgroup']); + //* Create .profile file + $app->system->touch(escapeshellcmd($homedir).'/.profile'); + $app->system->chmod(escapeshellcmd($homedir).'/.profile', 0644); + $app->system->chown(escapeshellcmd($homedir).'/.profile', $data['new']['username']); + $app->system->chgrp(escapeshellcmd($homedir).'/.profile', $data['new']['pgroup']); + //* Disable shell user temporarily if we use jailkit if($data['new']['chroot'] == 'jailkit') { $command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']).' 2>/dev/null'; @@ -214,6 +220,9 @@ class shelluser_base_plugin { // Check if the user that we want to update exists, if not, we insert it if($app->system->is_user($data['old']['username'])) { + //* Remove webfolder protection + $app->system->web_folder_protection($web['document_root'], false); + /* $command = 'usermod'; $command .= ' --home '.escapeshellcmd($data['new']['dir']); @@ -270,7 +279,17 @@ class shelluser_base_plugin { $app->system->chown(escapeshellcmd($homedir).'/.bash_history', escapeshellcmd($data['new']['username'])); $app->system->chgrp(escapeshellcmd($homedir).'/.bash_history', escapeshellcmd($data['new']['pgroup'])); } + + //* Create .profile file + if(!is_file($data['new']['dir']).'/.profile') { + $app->system->touch(escapeshellcmd($homedir).'/.profile'); + $app->system->chmod(escapeshellcmd($homedir).'/.profile', 0644); + $app->system->chown(escapeshellcmd($homedir).'/.profile', escapeshellcmd($data['new']['username'])); + $app->system->chgrp(escapeshellcmd($homedir).'/.profile', escapeshellcmd($data['new']['pgroup'])); + } + //* Add webfolder protection again + $app->system->web_folder_protection($web['document_root'], true); } else { // The user does not exist, so we insert it now $this->insert($event_name, $data);