use correct makeCorrect(Dir/File) everywhere
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -105,13 +105,13 @@ class Apache extends HttpConfigBase
|
||||
}
|
||||
$this->virtualhosts_data[$vhosts_filename] .= ' </Directory>' . "\n";
|
||||
|
||||
$ocsp_cache_filename = makeCorrectFile($vhosts_folder . '/03_froxlor_ocsp_cache.conf');
|
||||
$ocsp_cache_filename = \Froxlor\FileDir::makeCorrectFile($vhosts_folder . '/03_froxlor_ocsp_cache.conf');
|
||||
if (Settings::Get('system.use_ssl') == '1' && Settings::Get('system.apache24') == 1) {
|
||||
$this->virtualhosts_data[$ocsp_cache_filename] = 'SSLStaplingCache ' . Settings::Get('system.apache24_ocsp_cache_path') . "\n";
|
||||
} else {
|
||||
if (file_exists($ocsp_cache_filename)) {
|
||||
\Froxlor\FroxlorLogger::getInstance()->logAction(CRON_ACTION, LOG_NOTICE, 'apache::_createStandardDirectoryEntry: unlinking ' . basename($ocsp_cache_filename));
|
||||
unlink(makeCorrectFile($ocsp_cache_filename));
|
||||
unlink(\Froxlor\FileDir::makeCorrectFile($ocsp_cache_filename));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ class ConfigIO
|
||||
// now get rid of old stuff
|
||||
// (but append /*.conf so we don't delete the directory)
|
||||
$configdir .= '/*.conf';
|
||||
\Froxlor\FileDir::safe_exec('rm -f ' . makeCorrectFile($configdir));
|
||||
\Froxlor\FileDir::safe_exec('rm -f ' . \Froxlor\FileDir::makeCorrectFile($configdir));
|
||||
} else {
|
||||
\Froxlor\FileDir::safe_exec('mkdir -p ' . $configdir);
|
||||
}
|
||||
|
||||
@@ -63,15 +63,15 @@ class DomainSSL
|
||||
// check if it's an array and if the most important field is set
|
||||
if (is_array($dom_certs) && isset($dom_certs['ssl_cert_file']) && $dom_certs['ssl_cert_file'] != '') {
|
||||
// get destination path
|
||||
$sslcertpath = makeCorrectDir(Settings::Get('system.customer_ssl_path'));
|
||||
$sslcertpath = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.customer_ssl_path'));
|
||||
// create path if it does not exist
|
||||
if (! file_exists($sslcertpath)) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($sslcertpath));
|
||||
}
|
||||
// make correct files for the certificates
|
||||
$ssl_files = array(
|
||||
'ssl_cert_file' => makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.crt'),
|
||||
'ssl_key_file' => makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.key')
|
||||
'ssl_cert_file' => \Froxlor\FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.crt'),
|
||||
'ssl_key_file' => \Froxlor\FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '.key')
|
||||
);
|
||||
|
||||
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||
@@ -85,19 +85,19 @@ class DomainSSL
|
||||
$ssl_files['ssl_cert_chainfile'] = '';
|
||||
// set them if they are != empty
|
||||
if ($dom_certs['ssl_ca_file'] != '') {
|
||||
$ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_CA.pem');
|
||||
$ssl_files['ssl_ca_file'] = \Froxlor\FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_CA.pem');
|
||||
}
|
||||
if ($dom_certs['ssl_cert_chainfile'] != '') {
|
||||
if (Settings::Get('system.webserver') == 'nginx') {
|
||||
// put ca.crt in my.crt, as nginx does not support a separate chain file.
|
||||
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file']) . "\n" . trim($dom_certs['ssl_cert_chainfile']) . "\n";
|
||||
} else {
|
||||
$ssl_files['ssl_cert_chainfile'] = makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_chain.pem');
|
||||
$ssl_files['ssl_cert_chainfile'] = \Froxlor\FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_chain.pem');
|
||||
}
|
||||
}
|
||||
// will only be generated to be used externally, froxlor does not need this
|
||||
if ($dom_certs['ssl_fullchain_file'] != '') {
|
||||
$ssl_files['ssl_fullchain_file'] = makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_fullchain.pem');
|
||||
$ssl_files['ssl_fullchain_file'] = \Froxlor\FileDir::makeCorrectFile($sslcertpath . '/' . $domain['domain'] . '_fullchain.pem');
|
||||
}
|
||||
// create them on the filesystem
|
||||
foreach ($ssl_files as $type => $filename) {
|
||||
|
||||
@@ -61,13 +61,13 @@ class HttpConfigBase
|
||||
{
|
||||
if (! empty($ip_port) && $ip_port['docroot'] == '') {
|
||||
if (Settings::Get('system.froxlordirectlyviahostname')) {
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__))));
|
||||
} else {
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
|
||||
}
|
||||
} else {
|
||||
// user-defined docroot, #417
|
||||
$mypath = makeCorrectDir($ip_port['docroot']);
|
||||
$mypath = \Froxlor\FileDir::makeCorrectDir($ip_port['docroot']);
|
||||
}
|
||||
return $mypath;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Lighttpd extends HttpConfigBase
|
||||
foreach ($restart_cmds as $restart_cmd) {
|
||||
// check whether the config dir is empty (no domains uses this daemon)
|
||||
// so we need to create a dummy
|
||||
$_conffiles = glob(makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
||||
$_conffiles = glob(\Froxlor\FileDir::makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
||||
if ($_conffiles === false || empty($_conffiles)) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'lighttpd::reload: fpm config directory "' . $restart_cmd['config_dir'] . '" is empty. Creating dummy.');
|
||||
Fpm::createDummyPool($restart_cmd['config_dir']);
|
||||
@@ -86,7 +86,7 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'lighttpd::createIpPort: creating ip/port settings for ' . $ip . ":" . $port);
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
||||
|
||||
if (! isset($this->lighttpd_data[$vhost_filename])) {
|
||||
$this->lighttpd_data[$vhost_filename] = '';
|
||||
@@ -254,7 +254,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.engine = "enable"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.use-compression = "disable"' . "\n";
|
||||
if (!empty(Settings::Get('system.dhparams_file'))) {
|
||||
$dhparams = makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
$dhparams = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
if (!file_exists($dhparams)) {
|
||||
safe_exec('openssl dhparam -out '.escapeshellarg($dhparams).' 4096');
|
||||
}
|
||||
@@ -265,7 +265,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.use-sslv3 = "disable"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.cipher-list = "' . Settings::Get('system.ssl_cipher_list') . '"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.honor-cipher-order = "enable"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.pemfile = "' . makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.pemfile = "' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";
|
||||
|
||||
if ($domain['ssl_ca_file'] != '') {
|
||||
// check for existence, #1485
|
||||
@@ -273,7 +273,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$this->logger->logAction(CRON_ACTION, LOG_ERR, $ip . ':' . $port . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! Cannot create ssl-directives');
|
||||
echo $ip . ':' . port . ' :: certificate CA file "' . $domain['ssl_ca_file'] . '" does not exist! SSL-directives might not be working' . "\n";
|
||||
} else {
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.ca-file = "' . makeCorrectFile($domain['ssl_ca_file']) . '"' . "\n";
|
||||
$this->lighttpd_data[$vhost_filename] .= 'ssl.ca-file = "' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_ca_file']) . '"' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ class Lighttpd extends HttpConfigBase
|
||||
private function _createStandardErrorHandler()
|
||||
{
|
||||
if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && Settings::Get('defaultwebsrverrhandler.err404') != '') {
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/05_froxlor_default_errorhandler.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/05_froxlor_default_errorhandler.conf');
|
||||
|
||||
if (! isset($this->lighttpd_data[$vhost_filename])) {
|
||||
$this->lighttpd_data[$vhost_filename] = '';
|
||||
@@ -318,7 +318,7 @@ class Lighttpd extends HttpConfigBase
|
||||
|
||||
$defhandler = Settings::Get('defaultwebsrverrhandler.err404');
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$this->lighttpd_data[$vhost_filename] = 'server.error-handler-404 = "' . $defhandler . '"';
|
||||
}
|
||||
@@ -337,7 +337,7 @@ class Lighttpd extends HttpConfigBase
|
||||
|
||||
$htaccess_text = '';
|
||||
while ($row_htpasswds = $result_htpasswds_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$row_htpasswds['path'] = makeCorrectDir($row_htpasswds['path']);
|
||||
$row_htpasswds['path'] = \Froxlor\FileDir::makeCorrectDir($row_htpasswds['path']);
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row_htpasswds['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
$filename = $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd';
|
||||
@@ -352,11 +352,11 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
|
||||
$htaccess_path = substr($row_htpasswds['path'], strlen($domain['documentroot']) - 1);
|
||||
$htaccess_path = makeCorrectDir($htaccess_path);
|
||||
$htaccess_path = \Froxlor\FileDir::makeCorrectDir($htaccess_path);
|
||||
|
||||
$htaccess_text .= ' $HTTP["url"] =~ "^' . $htaccess_path . '" {' . "\n";
|
||||
$htaccess_text .= ' auth.backend = "htpasswd"' . "\n";
|
||||
$htaccess_text .= ' auth.backend.htpasswd.userfile = "' . makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$htaccess_text .= ' auth.backend.htpasswd.userfile = "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$htaccess_text .= ' auth.require = ( ' . "\n";
|
||||
$htaccess_text .= ' "' . $htaccess_path . '" =>' . "\n";
|
||||
$htaccess_text .= ' (' . "\n";
|
||||
@@ -392,12 +392,12 @@ class Lighttpd extends HttpConfigBase
|
||||
foreach ($domains as $domain) {
|
||||
|
||||
if (is_dir(Settings::Get('system.apacheconf_vhost'))) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost') . '/vhosts/')));
|
||||
safe_exec('mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost') . '/vhosts/')));
|
||||
|
||||
// determine correct include-path:
|
||||
// e.g. '/etc/lighttpd/conf-enabled/vhosts/ has to become'
|
||||
// 'conf-enabled/vhosts/' (damn debian, but luckily works too on other distros)
|
||||
$_tmp_path = substr(makeCorrectDir(Settings::Get('system.apacheconf_vhost')), 0, - 1);
|
||||
$_tmp_path = substr(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost')), 0, - 1);
|
||||
$_pos = strrpos($_tmp_path, '/');
|
||||
$_inc_path = substr($_tmp_path, $_pos + 1);
|
||||
|
||||
@@ -417,7 +417,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$vhost_no = (int) $vhost_no += 10;
|
||||
}
|
||||
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/vhosts/' . $vhost_no . '_' . $domain['domain'] . '.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/vhosts/' . $vhost_no . '_' . $domain['domain'] . '.conf');
|
||||
$included_vhosts[] = $_inc_path . '/vhosts/' . $vhost_no . '_' . $domain['domain'] . '.conf';
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ class Lighttpd extends HttpConfigBase
|
||||
//$ssl_settings .= 'ssl.engine = "enable"' . "\n";
|
||||
$ssl_settings .= 'ssl.use-compression = "disable"' . "\n";
|
||||
if (!empty(Settings::Get('system.dhparams_file'))) {
|
||||
$dhparams = makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
$dhparams = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
if (!file_exists($dhparams)) {
|
||||
safe_exec('openssl dhparam -out '.escapeshellarg($dhparams).' 4096');
|
||||
}
|
||||
@@ -587,10 +587,10 @@ class Lighttpd extends HttpConfigBase
|
||||
$ssl_settings .= 'ssl.use-sslv3 = "disable"' . "\n";
|
||||
$ssl_settings .= 'ssl.cipher-list = "' . Settings::Get('system.ssl_cipher_list') . '"' . "\n";
|
||||
$ssl_settings .= 'ssl.honor-cipher-order = "enable"' . "\n";
|
||||
$ssl_settings .= 'ssl.pemfile = "' . makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";
|
||||
$ssl_settings .= 'ssl.pemfile = "' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_cert_file']) . '"' . "\n";
|
||||
|
||||
if ($domain['ssl_ca_file'] != '') {
|
||||
$ssl_settings .= 'ssl.ca-file = "' . makeCorrectFile($domain['ssl_ca_file']) . '"' . "\n";
|
||||
$ssl_settings .= 'ssl.ca-file = "' . \Froxlor\FileDir::makeCorrectFile($domain['ssl_ca_file']) . '"' . "\n";
|
||||
}
|
||||
|
||||
if ($domain['hsts'] >= 0) {
|
||||
@@ -626,7 +626,7 @@ class Lighttpd extends HttpConfigBase
|
||||
// error log cannot be set conditionally see
|
||||
// https://redmine.lighttpd.net/issues/665
|
||||
if ($domain['writeaccesslog']) {
|
||||
$access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
$access_log = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
// Create the logfile if it does not exist (fixes #46)
|
||||
touch($access_log);
|
||||
chown($access_log, Settings::Get('system.httpuser'));
|
||||
@@ -703,7 +703,7 @@ class Lighttpd extends HttpConfigBase
|
||||
if (! empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($domain['documentroot'] . '/' . $defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($domain['documentroot'] . '/' . $defhandler);
|
||||
}
|
||||
$error_string .= ' server.error-handler-404 = "' . $defhandler . '"' . "\n\n";
|
||||
}
|
||||
@@ -715,7 +715,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$error_string = '';
|
||||
}
|
||||
|
||||
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||
@@ -730,7 +730,7 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
|
||||
if (customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
||||
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||
@@ -739,8 +739,8 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
$path_options .= ' $HTTP["url"] =~ "^' . $path . '($|/)" {' . "\n";
|
||||
$path_options .= "\t" . 'cgi.assign = (' . "\n";
|
||||
$path_options .= "\t\t" . '".pl" => "' . makeCorrectFile(Settings::Get('system.perl_path')) . '",' . "\n";
|
||||
$path_options .= "\t\t" . '".cgi" => "' . makeCorrectFile(Settings::Get('system.perl_path')) . '"' . "\n";
|
||||
$path_options .= "\t\t" . '".pl" => "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.perl_path')) . '",' . "\n";
|
||||
$path_options .= "\t\t" . '".cgi" => "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.perl_path')) . '"' . "\n";
|
||||
$path_options .= "\t" . ')' . "\n";
|
||||
$path_options .= ' }' . "\n\n";
|
||||
}
|
||||
@@ -766,21 +766,21 @@ class Lighttpd extends HttpConfigBase
|
||||
if ($this->auth_backend_loaded[$domain['ipandport']] != 'yes') {
|
||||
$auth_backend_loaded[$domain['ipandport']] = 'yes';
|
||||
$diroption_text .= 'auth.backend = "htpasswd"' . "\n";
|
||||
$diroption_text .= 'auth.backend.htpasswd.userfile = "' . makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$diroption_text .= 'auth.backend.htpasswd.userfile = "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$this->needed_htpasswds[$filename] = $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
|
||||
$diroption_text .= 'auth.require = ( ' . "\n";
|
||||
$previous_domain_id = '1';
|
||||
} elseif ($this->auth_backend_loaded[$domain['ssl_ipandport']] != 'yes') {
|
||||
$auth_backend_loaded[$domain['ssl_ipandport']] = 'yes';
|
||||
$diroption_text .= 'auth.backend= "htpasswd"' . "\n";
|
||||
$diroption_text .= 'auth.backend.htpasswd.userfile = "' . makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$diroption_text .= 'auth.backend.htpasswd.userfile = "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
$this->needed_htpasswds[$filename] = $row_htpasswds['username'] . ':' . $row_htpasswds['password'] . "\n";
|
||||
$diroption_text .= 'auth.require = ( ' . "\n";
|
||||
$previous_domain_id = '1';
|
||||
}
|
||||
}
|
||||
|
||||
$diroption_text .= '"' . makeCorrectDir($row_htpasswds['path']) . '" =>' . "\n";
|
||||
$diroption_text .= '"' . \Froxlor\FileDir::makeCorrectDir($row_htpasswds['path']) . '" =>' . "\n";
|
||||
$diroption_text .= '(' . "\n";
|
||||
$diroption_text .= ' "method" => "basic",' . "\n";
|
||||
$diroption_text .= ' "realm" => "' . $row_htpasswds['authname'] . '",' . "\n";
|
||||
@@ -796,7 +796,7 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
}
|
||||
|
||||
return ' auth.backend.htpasswd.userfile = "' . makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
return ' auth.backend.htpasswd.userfile = "' . \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $filename) . '"' . "\n";
|
||||
}
|
||||
|
||||
protected function getServerNames($domain)
|
||||
@@ -870,7 +870,7 @@ class Lighttpd extends HttpConfigBase
|
||||
|
||||
if ($domain['deactivated'] == '1' && Settings::Get('system.deactivateddocroot') != '') {
|
||||
$webroot_text .= ' # Using docroot for deactivated users...' . "\n";
|
||||
$webroot_text .= ' server.document-root = "' . makeCorrectDir(Settings::Get('system.deactivateddocroot')) . "\"\n";
|
||||
$webroot_text .= ' server.document-root = "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.deactivateddocroot')) . "\"\n";
|
||||
$this->_deactivated = true;
|
||||
} else {
|
||||
if ($ssl === false && $domain['ssl_redirect'] == '1') {
|
||||
@@ -888,7 +888,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$webroot_text .= "\t" . '"/" => "' . $redirect_domain . '"' . "\n";
|
||||
$webroot_text .= ' )' . "\n";
|
||||
} else {
|
||||
$webroot_text .= ' server.document-root = "' . makeCorrectDir($domain['documentroot']) . "\"\n";
|
||||
$webroot_text .= ' server.document-root = "' . \Froxlor\FileDir::makeCorrectDir($domain['documentroot']) . "\"\n";
|
||||
}
|
||||
$this->_deactivated = false;
|
||||
}
|
||||
@@ -906,34 +906,34 @@ class Lighttpd extends HttpConfigBase
|
||||
if ($domain['speciallogfile'] == '1') {
|
||||
if ($domain['parentdomainid'] == '0') {
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
} else {
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '/" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '/" )' . "\n";
|
||||
}
|
||||
} else {
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
} else {
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']) . '/" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']) . '/" )' . "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($domain['customerroot'] != $domain['documentroot']) {
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
} else {
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . makeCorrectFile($domain['customerroot'] . '/webalizer/') . '" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/webalizer/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer/') . '" )' . "\n";
|
||||
}
|
||||
} // if the docroots are equal, we still have to set an alias for awstats
|
||||
// because the stats are in /awstats/[domain], not just /awstats/
|
||||
// also, the awstats-icons are someplace else too!
|
||||
// -> webalizer does not need this!
|
||||
elseif (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url = ( "/awstats/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n";
|
||||
$stats_text .= ' alias.url += ( "/awstats-icon" => "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,8 +969,8 @@ class Lighttpd extends HttpConfigBase
|
||||
fclose($vhosts_file_handler);
|
||||
} else {
|
||||
if (! file_exists(Settings::Get('system.apacheconf_vhost'))) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'lighttpd::writeConfigs: mkdir ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
safe_exec('mkdir ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'lighttpd::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
safe_exec('mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
}
|
||||
|
||||
// Write a single file for every vhost
|
||||
@@ -993,10 +993,10 @@ class Lighttpd extends HttpConfigBase
|
||||
if ($htpasswdDir->isConfigDir()) {
|
||||
foreach ($this->needed_htpasswds as $key => $data) {
|
||||
if (! is_dir(Settings::Get('system.apacheconf_htpasswddir'))) {
|
||||
mkdir(makeCorrectDir(Settings::Get('system.apacheconf_htpasswddir')));
|
||||
mkdir(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_htpasswddir')));
|
||||
}
|
||||
|
||||
$filename = makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $key);
|
||||
$filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $key);
|
||||
$htpasswd_handler = fopen($filename, 'w');
|
||||
fwrite($htpasswd_handler, $data);
|
||||
fclose($htpasswd_handler);
|
||||
|
||||
@@ -94,7 +94,7 @@ class LighttpdFcgi extends Lighttpd
|
||||
public function createOwnVhostStarter()
|
||||
{
|
||||
if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
|
||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
|
||||
|
||||
$user = Settings::Get('phpfpm.vhost_httpuser');
|
||||
$group = Settings::Get('phpfpm.vhost_httpgroup');
|
||||
|
||||
@@ -66,7 +66,7 @@ class Nginx extends HttpConfigBase
|
||||
foreach ($restart_cmds as $restart_cmd) {
|
||||
// check whether the config dir is empty (no domains uses this daemon)
|
||||
// so we need to create a dummy
|
||||
$_conffiles = glob(makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
||||
$_conffiles = glob(\Froxlor\FileDir::makeCorrectFile($restart_cmd['config_dir'] . "/*.conf"));
|
||||
if ($_conffiles === false || empty($_conffiles)) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'nginx::reload: fpm config directory "' . $restart_cmd['config_dir'] . '" is empty. Creating dummy.');
|
||||
Fpm::createDummyPool($restart_cmd['config_dir']);
|
||||
@@ -96,12 +96,12 @@ class Nginx extends HttpConfigBase
|
||||
if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && (Settings::Get('defaultwebsrverrhandler.err401') != '' || Settings::Get('defaultwebsrverrhandler.err403') != '' || Settings::Get('defaultwebsrverrhandler.err404') != '' || Settings::Get('defaultwebsrverrhandler.err500') != '')) {
|
||||
$vhosts_folder = '';
|
||||
if (is_dir(Settings::Get('system.apacheconf_vhost'))) {
|
||||
$vhosts_folder = makeCorrectDir(Settings::Get('system.apacheconf_vhost'));
|
||||
$vhosts_folder = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'));
|
||||
} else {
|
||||
$vhosts_folder = makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost')));
|
||||
$vhosts_folder = \Froxlor\FileDir::makeCorrectDir(dirname(Settings::Get('system.apacheconf_vhost')));
|
||||
}
|
||||
|
||||
$vhosts_filename = makeCorrectFile($vhosts_folder . '/05_froxlor_default_errorhandler.conf');
|
||||
$vhosts_filename = \Froxlor\FileDir::makeCorrectFile($vhosts_folder . '/05_froxlor_default_errorhandler.conf');
|
||||
|
||||
if (! isset($this->nginx_data[$vhosts_filename])) {
|
||||
$this->nginx_data[$vhosts_filename] = '';
|
||||
@@ -117,7 +117,7 @@ class Nginx extends HttpConfigBase
|
||||
if (Settings::Get('defaultwebsrverrhandler.err' . $statusCode) != '') {
|
||||
$defhandler = Settings::Get('defaultwebsrverrhandler.err' . $statusCode);
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$this->nginx_data[$vhosts_filename] .= 'error_page ' . $statusCode . ' ' . $defhandler . ';' . "\n";
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class Nginx extends HttpConfigBase
|
||||
$port = $row_ipsandports['port'];
|
||||
|
||||
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'nginx::createIpPort: creating ip/port settings for ' . $ip . ":" . $port);
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/10_froxlor_ipandport_' . trim(str_replace(':', '.', $row_ipsandports['ip']), '.') . '.' . $row_ipsandports['port'] . '.conf');
|
||||
|
||||
if (! isset($this->nginx_data[$vhost_filename])) {
|
||||
$this->nginx_data[$vhost_filename] = '';
|
||||
@@ -339,7 +339,7 @@ class Nginx extends HttpConfigBase
|
||||
foreach ($domains as $domain) {
|
||||
|
||||
if (is_dir(Settings::Get('system.apacheconf_vhost'))) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
safe_exec('mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
}
|
||||
|
||||
$vhost_filename = $this->getVhostFilename($domain);
|
||||
@@ -377,9 +377,9 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
|
||||
if ($ssl_vhost === true) {
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_ssl_vhost_' . $domain['domain'] . '.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_ssl_vhost_' . $domain['domain'] . '.conf');
|
||||
} else {
|
||||
$vhost_filename = makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_normal_vhost_' . $domain['domain'] . '.conf');
|
||||
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/' . $vhost_no . '_froxlor_normal_vhost_' . $domain['domain'] . '.conf');
|
||||
}
|
||||
|
||||
return $vhost_filename;
|
||||
@@ -645,7 +645,7 @@ class Nginx extends HttpConfigBase
|
||||
$sslsettings .= "\t" . 'ssl_protocols ' . str_replace(",", " ", Settings::Get('system.ssl_protocols')) . ';' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_ciphers ' . Settings::Get('system.ssl_cipher_list') . ';' . "\n";
|
||||
if (! empty(Settings::Get('system.dhparams_file'))) {
|
||||
$dhparams = makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
$dhparams = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.dhparams_file'));
|
||||
if (! file_exists($dhparams)) {
|
||||
safe_exec('openssl dhparam -out ' . escapeshellarg($dhparams) . ' 4096');
|
||||
}
|
||||
@@ -653,14 +653,14 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
$sslsettings .= "\t" . 'ssl_ecdh_curve secp384r1;' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_prefer_server_ciphers on;' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_certificate ' . makeCorrectFile($domain_or_ip['ssl_cert_file']) . ';' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_certificate ' . \Froxlor\FileDir::makeCorrectFile($domain_or_ip['ssl_cert_file']) . ';' . "\n";
|
||||
|
||||
if ($domain_or_ip['ssl_key_file'] != '') {
|
||||
// check for existence, #1485
|
||||
if (! file_exists($domain_or_ip['ssl_key_file'])) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_ERR, $domain_or_ip['domain'] . ' :: certificate key file "' . $domain_or_ip['ssl_key_file'] . '" does not exist! Cannot create ssl-directives');
|
||||
} else {
|
||||
$sslsettings .= "\t" . 'ssl_certificate_key ' . makeCorrectFile($domain_or_ip['ssl_key_file']) . ';' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_certificate_key ' . \Froxlor\FileDir::makeCorrectFile($domain_or_ip['ssl_key_file']) . ';' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ class Nginx extends HttpConfigBase
|
||||
if ((isset($domain_or_ip['ocsp_stapling']) && $domain_or_ip['ocsp_stapling'] == "1") || (isset($domain_or_ip['letsencrypt']) && $domain_or_ip['letsencrypt'] == "1")) {
|
||||
$sslsettings .= "\t" . 'ssl_stapling on;' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_stapling_verify on;' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_trusted_certificate ' . makeCorrectFile($domain_or_ip['ssl_cert_file']) . ';' . "\n";
|
||||
$sslsettings .= "\t" . 'ssl_trusted_certificate ' . \Froxlor\FileDir::makeCorrectFile($domain_or_ip['ssl_cert_file']) . ';' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -704,7 +704,7 @@ class Nginx extends HttpConfigBase
|
||||
if (! empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 404 ' . $defhandler . ';' . "\n";
|
||||
}
|
||||
@@ -712,7 +712,7 @@ class Nginx extends HttpConfigBase
|
||||
if (! empty($row['error403path'])) {
|
||||
$defhandler = $row['error403path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 403 ' . $defhandler . ';' . "\n";
|
||||
}
|
||||
@@ -720,13 +720,13 @@ class Nginx extends HttpConfigBase
|
||||
if (! empty($row['error500path'])) {
|
||||
$defhandler = $row['error500path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
$defhandler = makeCorrectFile($defhandler);
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 500 502 503 504 ' . $defhandler . ';' . "\n";
|
||||
}
|
||||
|
||||
// if ($row['options_indexes'] != '0') {
|
||||
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
@@ -754,7 +754,7 @@ class Nginx extends HttpConfigBase
|
||||
default:
|
||||
if ($single['path'] == '/') {
|
||||
$path_options .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
|
||||
$path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
$path_options .= "\t\t" . 'auth_basic_user_file ' . \Froxlor\FileDir::makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
$path_options .= "\t\t" . 'index index.php index.html index.htm;' . "\n";
|
||||
} else {
|
||||
@@ -787,7 +787,7 @@ class Nginx extends HttpConfigBase
|
||||
* required the fastCGI wrapper to be running to receive the CGI requests.
|
||||
*/
|
||||
if (customerHasPerlEnabled($domain['customerid']) && $row['options_cgi'] != '0') {
|
||||
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
|
||||
mkDirWithCorrectOwnership($domain['documentroot'], $row['path'], $domain['guid'], $domain['guid']);
|
||||
|
||||
// We need to remove the last slash, otherwise the regex wouldn't work
|
||||
@@ -814,9 +814,9 @@ class Nginx extends HttpConfigBase
|
||||
unset($htpasswds[$idx]);
|
||||
break;
|
||||
default:
|
||||
$path_options .= "\t" . 'location ' . makeCorrectDir($single['path']) . ' {' . "\n";
|
||||
$path_options .= "\t" . 'location ' . \Froxlor\FileDir::makeCorrectDir($single['path']) . ' {' . "\n";
|
||||
$path_options .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
|
||||
$path_options .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
$path_options .= "\t\t" . 'auth_basic_user_file ' . \Froxlor\FileDir::makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
$path_options .= "\t\t" . 'index index.php index.html index.htm;' . "\n";
|
||||
} else {
|
||||
@@ -852,7 +852,7 @@ class Nginx extends HttpConfigBase
|
||||
$x = 0;
|
||||
while ($row_htpasswds = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (count($row_htpasswds) > 0) {
|
||||
$htpasswd_filename = makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd');
|
||||
$htpasswd_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_htpasswddir') . '/' . $row_htpasswds['customerid'] . '-' . md5($row_htpasswds['path']) . '.htpasswd');
|
||||
|
||||
// ensure we can write to the array with index $htpasswd_filename
|
||||
if (! isset($this->htpasswds_data[$htpasswd_filename])) {
|
||||
@@ -865,15 +865,15 @@ class Nginx extends HttpConfigBase
|
||||
// the nginx user, we have to evaluate the right path which is to protect
|
||||
if (stripos($row_htpasswds['path'], $domain['documentroot']) !== false) {
|
||||
// if the website contents is located in the user directory
|
||||
$path = makeCorrectDir(substr($row_htpasswds['path'], strlen($domain['documentroot']) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row_htpasswds['path'], strlen($domain['documentroot']) - 1));
|
||||
} else {
|
||||
// if the website contents is located in a subdirectory of the user
|
||||
preg_match('/^([\/[:print:]]*\/)([[:print:]\/]+){1}$/i', $row_htpasswds['path'], $matches);
|
||||
$path = makeCorrectDir(substr($row_htpasswds['path'], strlen($matches[1]) - 1));
|
||||
$path = \Froxlor\FileDir::makeCorrectDir(substr($row_htpasswds['path'], strlen($matches[1]) - 1));
|
||||
}
|
||||
|
||||
$returnval[$x]['path'] = $path;
|
||||
$returnval[$x]['root'] = makeCorrectDir($domain['documentroot']);
|
||||
$returnval[$x]['root'] = \Froxlor\FileDir::makeCorrectDir($domain['documentroot']);
|
||||
|
||||
// Ensure there is only one auth name per password block, otherwise
|
||||
// the directives are inserted multiple times -> invalid config
|
||||
@@ -927,10 +927,10 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
if ($domain['deactivated'] == '1' && Settings::Get('system.deactivateddocroot') != '') {
|
||||
$webroot_text .= "\t" . '# Using docroot for deactivated users...' . "\n";
|
||||
$webroot_text .= "\t" . 'root ' . makeCorrectDir(Settings::Get('system.deactivateddocroot')) . ';' . "\n";
|
||||
$webroot_text .= "\t" . 'root ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.deactivateddocroot')) . ';' . "\n";
|
||||
$this->_deactivated = true;
|
||||
} else {
|
||||
$webroot_text .= "\t" . 'root ' . makeCorrectDir($domain['documentroot']) . ';' . "\n";
|
||||
$webroot_text .= "\t" . 'root ' . \Froxlor\FileDir::makeCorrectDir($domain['documentroot']) . ';' . "\n";
|
||||
$this->_deactivated = false;
|
||||
}
|
||||
|
||||
@@ -966,16 +966,16 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
// define basic path to the stats
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$alias_dir = makeCorrectFile($domain['customerroot'] . '/awstats/');
|
||||
$alias_dir = \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/awstats/');
|
||||
} else {
|
||||
$alias_dir = makeCorrectFile($domain['customerroot'] . '/webalizer/');
|
||||
$alias_dir = \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer/');
|
||||
}
|
||||
|
||||
// if this is a parentdomain, we use this domain-name
|
||||
if ($domain['parentdomainid'] == '0') {
|
||||
$alias_dir = makeCorrectDir($alias_dir . '/' . $domain['domain']);
|
||||
$alias_dir = \Froxlor\FileDir::makeCorrectDir($alias_dir . '/' . $domain['domain']);
|
||||
} else {
|
||||
$alias_dir = makeCorrectDir($alias_dir . '/' . $domain['parentdomain']);
|
||||
$alias_dir = \Froxlor\FileDir::makeCorrectDir($alias_dir . '/' . $domain['parentdomain']);
|
||||
}
|
||||
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
@@ -988,13 +988,13 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
$stats_text .= "\t\t" . 'alias ' . $alias_dir . ';' . "\n";
|
||||
$stats_text .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n";
|
||||
$stats_text .= "\t\t" . 'auth_basic_user_file ' . makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
$stats_text .= "\t\t" . 'auth_basic_user_file ' . \Froxlor\FileDir::makeCorrectFile($single['usrf']) . ';' . "\n";
|
||||
$stats_text .= "\t" . '}' . "\n\n";
|
||||
|
||||
// awstats icons
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$stats_text .= "\t" . 'location ~ ^/awstats-icon/(.*)$ {' . "\n";
|
||||
$stats_text .= "\t\t" . 'alias ' . makeCorrectDir(Settings::Get('system.awstats_icons')) . '$1;' . "\n";
|
||||
$stats_text .= "\t\t" . 'alias ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '$1;' . "\n";
|
||||
$stats_text .= "\t" . '}' . "\n\n";
|
||||
}
|
||||
|
||||
@@ -1016,7 +1016,7 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
if ($domain['writeerrorlog']) {
|
||||
// The normal access/error - logging is enabled
|
||||
$error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log');
|
||||
$error_log = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log');
|
||||
// Create the logfile if it does not exist (fixes #46)
|
||||
touch($error_log);
|
||||
chown($error_log, Settings::Get('system.httpuser'));
|
||||
@@ -1026,7 +1026,7 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
|
||||
if ($domain['writeaccesslog']) {
|
||||
$access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
$access_log = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log');
|
||||
// Create the logfile if it does not exist (fixes #46)
|
||||
touch($access_log);
|
||||
chown($access_log, Settings::Get('system.httpuser'));
|
||||
@@ -1158,8 +1158,8 @@ class Nginx extends HttpConfigBase
|
||||
fclose($vhosts_file_handler);
|
||||
} else {
|
||||
if (! file_exists(Settings::Get('system.apacheconf_vhost'))) {
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'nginx::writeConfigs: mkdir ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
safe_exec('mkdir -p ' . escapeshellarg(makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
$this->logger->logAction(CRON_ACTION, LOG_NOTICE, 'nginx::writeConfigs: mkdir ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
safe_exec('mkdir -p ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir(Settings::Get('system.apacheconf_vhost'))));
|
||||
}
|
||||
|
||||
// Write a single file for every vhost
|
||||
|
||||
@@ -63,7 +63,7 @@ class NginxFcgi extends Nginx
|
||||
public function createOwnVhostStarter()
|
||||
{
|
||||
if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
|
||||
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
|
||||
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
|
||||
|
||||
$user = Settings::Get('phpfpm.vhost_httpuser');
|
||||
$group = Settings::Get('phpfpm.vhost_httpgroup');
|
||||
|
||||
@@ -158,8 +158,8 @@ class Fcgid
|
||||
'OPEN_BASEDIR' => $openbasedir,
|
||||
'OPEN_BASEDIR_C' => $openbasedirc,
|
||||
'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.phpappendopenbasedir'),
|
||||
'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']),
|
||||
'CUSTOMER_HOMEDIR' => makeCorrectDir($this->_domain['customerroot'])
|
||||
'DOCUMENT_ROOT' => \Froxlor\FileDir::makeCorrectDir($this->_domain['documentroot']),
|
||||
'CUSTOMER_HOMEDIR' => \Froxlor\FileDir::makeCorrectDir($this->_domain['customerroot'])
|
||||
);
|
||||
|
||||
// insert a small header for the file
|
||||
@@ -187,7 +187,7 @@ class Fcgid
|
||||
*/
|
||||
public function getConfigDir($createifnotexists = true)
|
||||
{
|
||||
$configdir = makeCorrectDir(Settings::Get('system.mod_fcgid_configdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||
$configdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.mod_fcgid_configdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||
|
||||
if (! is_dir($configdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
@@ -207,7 +207,7 @@ class Fcgid
|
||||
*/
|
||||
public function getTempDir($createifnotexists = true)
|
||||
{
|
||||
$tmpdir = makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
$tmpdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
|
||||
if (! is_dir($tmpdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||
@@ -225,7 +225,7 @@ class Fcgid
|
||||
*/
|
||||
public function getStarterFile()
|
||||
{
|
||||
$starter_filename = makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
|
||||
$starter_filename = \Froxlor\FileDir::makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
|
||||
return $starter_filename;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class Fcgid
|
||||
*/
|
||||
public function getIniFile()
|
||||
{
|
||||
$phpini_filename = makeCorrectFile($this->getConfigDir() . '/php.ini');
|
||||
$phpini_filename = \Froxlor\FileDir::makeCorrectFile($this->getConfigDir() . '/php.ini');
|
||||
return $phpini_filename;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,15 +172,15 @@ class Fpm
|
||||
if ($phpconfig['fpm_slowlog'] == '1') {
|
||||
$fpm_config .= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n";
|
||||
$fpm_config .= 'request_slowlog_timeout = ' . $phpconfig['fpm_reqslow'] . "\n";
|
||||
$slowlog = makeCorrectFile(Settings::Get('system.logfiles_directory') . '/' . $this->_domain['loginname'] . '-php-slow.log');
|
||||
$slowlog = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.logfiles_directory') . '/' . $this->_domain['loginname'] . '-php-slow.log');
|
||||
$fpm_config .= 'slowlog = ' . $slowlog . "\n";
|
||||
$fpm_config .= 'catch_workers_output = yes' . "\n";
|
||||
}
|
||||
|
||||
$fpm_config .= ';chroot = ' . makeCorrectDir($this->_domain['documentroot']) . "\n";
|
||||
$fpm_config .= ';chroot = ' . \Froxlor\FileDir::makeCorrectDir($this->_domain['documentroot']) . "\n";
|
||||
$fpm_config .= 'security.limit_extensions = ' . $fpm_limit_extensions . "\n";
|
||||
|
||||
$tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
$tmpdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
if (! is_dir($tmpdir)) {
|
||||
$this->getTempDir();
|
||||
}
|
||||
@@ -217,8 +217,8 @@ class Fpm
|
||||
$openbasedir .= $_phpappendopenbasedir;
|
||||
}
|
||||
}
|
||||
$fpm_config .= 'php_admin_value[session.save_path] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config .= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config .= 'php_admin_value[session.save_path] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
$fpm_config .= 'php_admin_value[upload_tmp_dir] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
|
||||
|
||||
$admin = $this->_getAdminData($this->_domain['adminid']);
|
||||
$php_ini_variables = array(
|
||||
@@ -233,8 +233,8 @@ class Fpm
|
||||
'OPEN_BASEDIR' => $openbasedir,
|
||||
'OPEN_BASEDIR_C' => '',
|
||||
'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.phpappendopenbasedir'),
|
||||
'DOCUMENT_ROOT' => makeCorrectDir($this->_domain['documentroot']),
|
||||
'CUSTOMER_HOMEDIR' => makeCorrectDir($this->_domain['customerroot'])
|
||||
'DOCUMENT_ROOT' => \Froxlor\FileDir::makeCorrectDir($this->_domain['documentroot']),
|
||||
'CUSTOMER_HOMEDIR' => \Froxlor\FileDir::makeCorrectDir($this->_domain['customerroot'])
|
||||
);
|
||||
|
||||
$phpini = replace_variables($phpconfig['phpsettings'], $php_ini_variables);
|
||||
@@ -287,7 +287,7 @@ class Fpm
|
||||
public function getConfigFile($createifnotexists = true)
|
||||
{
|
||||
$configdir = $this->_fpm_cfg['config_dir'];
|
||||
$config = makeCorrectFile($configdir . '/' . $this->_domain['domain'] . '.conf');
|
||||
$config = \Froxlor\FileDir::makeCorrectFile($configdir . '/' . $this->_domain['domain'] . '.conf');
|
||||
|
||||
if (! is_dir($configdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
@@ -306,9 +306,9 @@ class Fpm
|
||||
*/
|
||||
public function getSocketFile($createifnotexists = true)
|
||||
{
|
||||
$socketdir = makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir'));
|
||||
$socketdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir'));
|
||||
// add fpm-config-id to filename so it's unique for the fpm-daemon and doesn't interfere with running configs when reuilding
|
||||
$socket = strtolower(makeCorrectFile($socketdir . '/' . $this->_domain['fpm_config_id'] . '-' . $this->_domain['loginname'] . '-' . $this->_domain['domain'] . '-php-fpm.socket'));
|
||||
$socket = strtolower(\Froxlor\FileDir::makeCorrectFile($socketdir . '/' . $this->_domain['fpm_config_id'] . '-' . $this->_domain['loginname'] . '-' . $this->_domain['domain'] . '-php-fpm.socket'));
|
||||
|
||||
if (! is_dir($socketdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($socketdir));
|
||||
@@ -328,7 +328,7 @@ class Fpm
|
||||
*/
|
||||
public function getTempDir($createifnotexists = true)
|
||||
{
|
||||
$tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
$tmpdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/');
|
||||
|
||||
if (! is_dir($tmpdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||
@@ -355,7 +355,7 @@ class Fpm
|
||||
Settings::Set('phpfpm.aliasconfigdir', '/var/www/php-fpm');
|
||||
}
|
||||
|
||||
$configdir = makeCorrectDir(Settings::Get('phpfpm.aliasconfigdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||
$configdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.aliasconfigdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
|
||||
if (! is_dir($configdir) && $createifnotexists) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
||||
@@ -375,7 +375,7 @@ class Fpm
|
||||
if (! is_dir($configdir)) {
|
||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||
}
|
||||
$config = makeCorrectFile($configdir . '/dummy.conf');
|
||||
$config = \Froxlor\FileDir::makeCorrectFile($configdir . '/dummy.conf');
|
||||
$dummy = "[dummy]
|
||||
user = " . Settings::Get('system.httpuser') . "
|
||||
listen = /run/" . md5($configdir) . "-fpm.sock
|
||||
|
||||
Reference in New Issue
Block a user