- fixed deletion of created webserver-configs, misread the code-line in the first place, damn
- started implementing default errordocument feature
This commit is contained in:
@@ -560,6 +560,12 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
|
|||||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (129, 'system', 'awstats_path', '/usr/bin/');
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (129, 'system', 'awstats_path', '/usr/bin/');
|
||||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (130, 'system', 'awstats_conf', '/etc/awstats/');
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (130, 'system', 'awstats_conf', '/etc/awstats/');
|
||||||
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (131, 'system', 'defaultttl', '604800');
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (131, 'system', 'defaultttl', '604800');
|
||||||
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (132, 'defaultwebsrverrhandler', 'enabled', '0');
|
||||||
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (133, 'defaultwebsrverrhandler', 'err401', '');
|
||||||
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (134, 'defaultwebsrverrhandler', 'err403', '');
|
||||||
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (135, 'defaultwebsrverrhandler', 'err404', '');
|
||||||
|
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (136, 'defaultwebsrverrhandler', 'err500', '');
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ class apache
|
|||||||
$this->virtualhosts_data[$vhosts_filename] = '';
|
$this->virtualhosts_data[$vhosts_filename] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->virtualhosts_data[$vhosts_filename].= '# ' . basename($vhosts_filename) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . '# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.' . "\n" . "\n";
|
|
||||||
$this->virtualhosts_data[$vhosts_filename].= ' <Directory "' . $this->settings['system']['documentroot_prefix'] . '">' . "\n";
|
$this->virtualhosts_data[$vhosts_filename].= ' <Directory "' . $this->settings['system']['documentroot_prefix'] . '">' . "\n";
|
||||||
$this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n";
|
$this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n";
|
||||||
$this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n";
|
$this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n";
|
||||||
@@ -94,6 +93,47 @@ class apache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* define a default ErrorDocument-statement, bug #unknown-yet
|
||||||
|
*/
|
||||||
|
private function _createStandardErrorHandler()
|
||||||
|
{
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['enabled'] == '1'
|
||||||
|
&& ($this->settings['defaultwebsrverrhandler']['err401'] != ''
|
||||||
|
|| $this->settings['defaultwebsrverrhandler']['err403'] != ''
|
||||||
|
|| $this->settings['defaultwebsrverrhandler']['err404'] != ''
|
||||||
|
|| $this->settings['defaultwebsrverrhandler']['err500'] != '')
|
||||||
|
) {
|
||||||
|
$vhosts_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/05_froxlor_default_errorhandler.conf');
|
||||||
|
|
||||||
|
if(!isset($this->virtualhosts_data[$vhosts_filename]))
|
||||||
|
{
|
||||||
|
$this->virtualhosts_data[$vhosts_filename] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['err401'] != '')
|
||||||
|
{
|
||||||
|
$this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 401 ' . $this->settings['defaultwebsrverrhandler']['err401'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['err403'] != '')
|
||||||
|
{
|
||||||
|
$this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 403 ' . $this->settings['defaultwebsrverrhandler']['err403'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['err404'] != '')
|
||||||
|
{
|
||||||
|
$this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 404 ' . $this->settings['defaultwebsrverrhandler']['err404'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['err500'] != '')
|
||||||
|
{
|
||||||
|
$this->virtualhosts_data[$vhosts_filename].= 'ErrorDocument 500 ' . $this->settings['defaultwebsrverrhandler']['err500'] . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function createIpPort()
|
public function createIpPort()
|
||||||
{
|
{
|
||||||
$result_ipsandports = $this->db->query("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC");
|
$result_ipsandports = $this->db->query("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC");
|
||||||
@@ -209,6 +249,11 @@ class apache
|
|||||||
* bug #32
|
* bug #32
|
||||||
*/
|
*/
|
||||||
$this->_createStandardDirectoryEntry();
|
$this->_createStandardDirectoryEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bug #unknown-yet
|
||||||
|
*/
|
||||||
|
$this->_createStandardErrorHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -969,9 +1014,7 @@ class apache
|
|||||||
{
|
{
|
||||||
if($vhost_filename != '.'
|
if($vhost_filename != '.'
|
||||||
&& $vhost_filename != '..'
|
&& $vhost_filename != '..'
|
||||||
// this would lead to not delete config from
|
&& !in_array($vhost_filename, $this->known_vhostfilenames)
|
||||||
// maybe removed domains, etc. so comment it out, #102
|
|
||||||
//&& !in_array($vhost_filename, $this->known_vhostfilenames)
|
|
||||||
&& preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)
|
&& preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)
|
||||||
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename)))
|
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename)))
|
||||||
{
|
{
|
||||||
@@ -1000,9 +1043,7 @@ class apache
|
|||||||
{
|
{
|
||||||
if($diroptions_filename != '.'
|
if($diroptions_filename != '.'
|
||||||
&& $diroptions_filename != '..'
|
&& $diroptions_filename != '..'
|
||||||
// this would lead to not delete config from
|
&& !in_array($diroptions_filename, $this->known_diroptionsfilenames)
|
||||||
// maybe removed domains, etc. so comment it out, #102
|
|
||||||
//&& !in_array($diroptions_filename, $this->known_diroptionsfilenames)
|
|
||||||
&& preg_match('/^40_(froxlor|syscp)_diroption_(.+)\.conf$/', $diroptions_filename)
|
&& preg_match('/^40_(froxlor|syscp)_diroption_(.+)\.conf$/', $diroptions_filename)
|
||||||
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_diroptions'] . '/' . $diroptions_filename)))
|
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_diroptions'] . '/' . $diroptions_filename)))
|
||||||
{
|
{
|
||||||
@@ -1031,9 +1072,7 @@ class apache
|
|||||||
{
|
{
|
||||||
if($htpasswd_filename != '.'
|
if($htpasswd_filename != '.'
|
||||||
&& $htpasswd_filename != '..'
|
&& $htpasswd_filename != '..'
|
||||||
// this would lead to not delete config from
|
&& !in_array($htpasswd_filename, $this->known_htpasswdsfilenames)
|
||||||
// maybe removed domains, etc. so comment it out, #102
|
|
||||||
//&& !in_array($htpasswd_filename, $this->known_htpasswdsfilenames)
|
|
||||||
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $htpasswd_filename)))
|
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_htpasswddir'] . '/' . $htpasswd_filename)))
|
||||||
{
|
{
|
||||||
fwrite($this->debugHandler, ' apache::wipeOutOldHtpasswdConfigs: unlinking ' . $htpasswd_filename . "\n");
|
fwrite($this->debugHandler, ' apache::wipeOutOldHtpasswdConfigs: unlinking ' . $htpasswd_filename . "\n");
|
||||||
|
|||||||
@@ -151,6 +151,30 @@ class lighttpd
|
|||||||
|
|
||||||
$this->lighttpd_data[$vhost_filename].= '}' . "\n";
|
$this->lighttpd_data[$vhost_filename].= '}' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bug #unknown-yet
|
||||||
|
*/
|
||||||
|
$this->_createStandardErrorHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* define a default server.error-handler-404-statement, bug #unknown-yet
|
||||||
|
*/
|
||||||
|
private function _createStandardErrorHandler()
|
||||||
|
{
|
||||||
|
if($this->settings['defaultwebsrverrhandler']['enabled'] == '1'
|
||||||
|
&& $this->settings['defaultwebsrverrhandler']['err404'] != ''
|
||||||
|
) {
|
||||||
|
$vhosts_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/05_froxlor_default_errorhandler.conf');
|
||||||
|
|
||||||
|
if(!isset($this->lighttpd_data[$vhost_filename]))
|
||||||
|
{
|
||||||
|
$this->lighttpd_data[$vhost_filename] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->lighttpd_data[$vhost_filename] = 'server.error-handler-404 = "'.$this->settings['defaultwebsrverrhandler']['err404'].'"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function create_htaccess($domain)
|
protected function create_htaccess($domain)
|
||||||
@@ -815,9 +839,7 @@ class lighttpd
|
|||||||
{
|
{
|
||||||
if($vhost_filename != '.'
|
if($vhost_filename != '.'
|
||||||
&& $vhost_filename != '..'
|
&& $vhost_filename != '..'
|
||||||
// this would lead to not delete config from
|
&& !in_array($vhost_filename, $this->known_filenames)
|
||||||
// maybe removed domains, etc. so comment it out, #102
|
|
||||||
// && !in_array($vhost_filename, $this->known_filenames)
|
|
||||||
&& preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)
|
&& preg_match('/^(05|10|20|21|30|50|51)_(froxlor|syscp)_(dirfix|ipandport|normal_vhost|wildcard_vhost|ssl_vhost)_(.+)\.conf$/', $vhost_filename)
|
||||||
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename)))
|
&& file_exists(makeCorrectFile($this->settings['system']['apacheconf_vhost'] . '/' . $vhost_filename)))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user