| | |
| | | $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'); |
| | | } |
| | |
| | | |
| | | //* 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); |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | $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.'; |
| | | ?> |
| | |
| | | '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' |
| | | ), |
| | |
| | | $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'); |
| | | } |
| | |
| | | * 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'])); |
| | |
| | | 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'); |
| | | |
| | | 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/hhvm_' . $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'); |
| | |
| | | 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']) || 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'); |
| | | } |
| | | } |
| | |
| | | $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'])); |
| | |
| | | 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'); |
| | | |
| | | 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/hhvm_' . $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'); |
| | |
| | | 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']) || 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'); |
| | | } |
| | | } |
| | |
| | | $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'])); |
| | |
| | | $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; |
| | |
| | | $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'; |
| | |
| | | |
| | | // 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']); |
| | |
| | | $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); |