Marius Cramer
2015-06-15 02e7eaf2860f6f892eb32639940e97c76b65baad
- backported patches
9 files modified
81 ■■■■ changed files
interface/lib/classes/db_mysql.inc.php 2 ●●● patch | view | raw | blame | history
interface/web/dns/dns_soa_edit.php 8 ●●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/de_dns_soa.lng 1 ●●●● patch | view | raw | blame | history
interface/web/dns/lib/lang/en_dns_soa.lng 1 ●●●● patch | view | raw | blame | history
interface/web/mail/form/mail_relay_recipient.tform.php 2 ●●● patch | view | raw | blame | history
server/lib/classes/db_mysql.inc.php 2 ●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 22 ●●●●● patch | view | raw | blame | history
server/plugins-available/nginx_plugin.inc.php 24 ●●●●● patch | view | raw | blame | history
server/plugins-available/shelluser_base_plugin.inc.php 19 ●●●●● patch | view | raw | blame | history
interface/lib/classes/db_mysql.inc.php
@@ -483,7 +483,7 @@
        $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');
            }
interface/web/dns/dns_soa_edit.php
@@ -273,16 +273,14 @@
    //* 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);
interface/web/dns/lib/lang/de_dns_soa.lng
@@ -35,4 +35,5 @@
$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.';
?>
interface/web/dns/lib/lang/en_dns_soa.lng
@@ -36,4 +36,5 @@
$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.';
?>
interface/web/mail/form/mail_relay_recipient.tform.php
@@ -63,7 +63,7 @@
            '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'
            ),
server/lib/classes/db_mysql.inc.php
@@ -447,7 +447,7 @@
        $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');
            }
server/plugins-available/apache2_plugin.inc.php
@@ -1405,7 +1405,7 @@
         * 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 @@
            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 @@
            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');
            }
        }
server/plugins-available/nginx_plugin.inc.php
@@ -950,7 +950,7 @@
            $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 @@
            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 @@
            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 @@
            $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 @@
        $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;
server/plugins-available/shelluser_base_plugin.inc.php
@@ -149,6 +149,12 @@
                $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 @@
                
                // 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 @@
                        $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);