Commit 02e7eaf2 authored by Marius Cramer's avatar Marius Cramer

- backported patches

parent c2419b0e
......@@ -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');
}
......
......@@ -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);
......
......@@ -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.';
?>
......@@ -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.';
?>
......@@ -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'
),
......
......@@ -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');
}
......
......@@ -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');
}
}
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment