Skip to content

Commit 52983de

Browse files
committed
Merge branch 'stable-3.0.5' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.0.5
2 parents aede496 + 3de838d commit 52983de

File tree

83 files changed

+2591
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2591
-152
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,12 @@ public function configure_apache()
645645
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
646646
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
647647

648-
// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
649-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
648+
$tpl = new tpl('apache_ispconfig.conf.master');
649+
$tpl->setVar('apache_version',getapacheversion());
650+
650651
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
651-
652+
$ip_addresses = array();
653+
652654
if(is_array($records) && count($records) > 0) {
653655
foreach($records as $rec) {
654656
if($rec['ip_type'] == 'IPv6') {
@@ -661,15 +663,17 @@ public function configure_apache()
661663
foreach($ports as $port) {
662664
$port = intval($port);
663665
if($port > 0 && $port < 65536 && $ip_address != '') {
664-
$content .= 'NameVirtualHost '.$ip_address.":".$port."\n";
666+
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
665667
}
666668
}
667669
}
668670
}
669671
}
672+
673+
if(count($ip_addresses) > 0) $tpl->setLoop('ip_adresses',$ip_addresses);
670674

671-
$content .= "\n";
672-
wf($vhost_conf_dir.'/ispconfig.conf', $content);
675+
wf($vhost_conf_dir.'/ispconfig.conf', $tpl->grab());
676+
unset($tpl);
673677

674678
if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
675679
exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
@@ -1033,28 +1037,30 @@ public function install_ispconfig()
10331037

10341038

10351039
// Dont just copy over the virtualhost template but add some custom settings
1036-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
1037-
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
1040+
$tpl = new tpl('apache_ispconfig.vhost.master');
1041+
$tpl->setVar('vhost_port',$conf['apache']['vhost_port']);
10381042

10391043
// comment out the listen directive if port is 80 or 443
10401044
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
1041-
$content = str_replace('{vhost_port_listen}', '#', $content);
1045+
$tpl->setVar('vhost_port_listen','#');
10421046
} else {
1043-
$content = str_replace('{vhost_port_listen}', '', $content);
1047+
$tpl->setVar('vhost_port_listen','');
10441048
}
10451049

1046-
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
1047-
$content = str_replace('{ssl_comment}', '', $content);
1050+
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
1051+
$tpl->setVar('ssl_comment','');
10481052
} else {
1049-
$content = str_replace('{ssl_comment}', '#', $content);
1053+
$tpl->setVar('ssl_comment','#');
10501054
}
10511055
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
1052-
$content = str_replace('{ssl_bundle_comment}', '', $content);
1056+
$tpl->setVar('ssl_bundle_comment','');
10531057
} else {
1054-
$content = str_replace('{ssl_bundle_comment}', '#', $content);
1058+
$tpl->setVar('ssl_bundle_comment','#');
10551059
}
1060+
1061+
$tpl->setVar('apache_version',getapacheversion());
10561062

1057-
wf("$vhost_conf_dir/ispconfig.vhost", $content);
1063+
wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab());
10581064

10591065
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
10601066
//* and create the symlink

install/dist/lib/gentoo.lib.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ public function configure_apache()
495495

496496

497497
//* Copy the ISPConfig configuration include
498+
/*
498499
$content = $this->get_template_file('apache_ispconfig.conf', true);
499500
500501
$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
@@ -507,6 +508,37 @@ public function configure_apache()
507508
}
508509
509510
$this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
511+
*/
512+
513+
$tpl = new tpl('apache_ispconfig.conf.master');
514+
$tpl->setVar('apache_version',getapacheversion());
515+
516+
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
517+
$ip_addresses = array();
518+
519+
if(is_array($records) && count($records) > 0) {
520+
foreach($records as $rec) {
521+
if($rec['ip_type'] == 'IPv6') {
522+
$ip_address = '['.$rec['ip_address'].']';
523+
} else {
524+
$ip_address = $rec['ip_address'];
525+
}
526+
$ports = explode(',', $rec['virtualhost_port']);
527+
if(is_array($ports)) {
528+
foreach($ports as $port) {
529+
$port = intval($port);
530+
if($port > 0 && $port < 65536 && $ip_address != '') {
531+
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
532+
}
533+
}
534+
}
535+
}
536+
}
537+
538+
if(count($ip_addresses) > 0) $tpl->setLoop('ip_adresses',$ip_addresses);
539+
540+
wf($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $tpl->grab());
541+
unset($tpl);
510542

511543
//* Gentoo by default does not include .vhost files. Add include line to config file.
512544
$content = rf($conf['apache']['config_file']);

install/dist/lib/opensuse.lib.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,12 @@ public function configure_apache()
660660
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
661661
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
662662

663-
//copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
664-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
663+
$tpl = new tpl('apache_ispconfig.conf.master');
664+
$tpl->setVar('apache_version',getapacheversion());
665+
665666
$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
666-
667+
$ip_addresses = array();
668+
667669
if(is_array($records) && count($records) > 0) {
668670
foreach($records as $rec) {
669671
if($rec['ip_type'] == 'IPv6') {
@@ -676,15 +678,17 @@ public function configure_apache()
676678
foreach($ports as $port) {
677679
$port = intval($port);
678680
if($port > 0 && $port < 65536 && $ip_address != '') {
679-
$content .= 'NameVirtualHost '.$ip_address.":".$port."\n";
681+
$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
680682
}
681683
}
682684
}
683685
}
684686
}
685-
686-
$content .= "\n";
687-
wf($vhost_conf_dir.'/ispconfig.conf', $content);
687+
688+
if(count($ip_addresses) > 0) $tpl->setLoop('ip_adresses',$ip_addresses);
689+
690+
wf($vhost_conf_dir.'/ispconfig.conf', $tpl->grab());
691+
unset($tpl);
688692

689693
if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
690694
exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
@@ -1089,31 +1093,30 @@ public function install_ispconfig()
10891093

10901094

10911095
// Dont just copy over the virtualhost template but add some custom settings
1092-
1093-
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
1094-
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
1096+
$tpl = new tpl('apache_ispconfig.vhost.master');
1097+
$tpl->setVar('vhost_port',$conf['apache']['vhost_port']);
10951098

10961099
// comment out the listen directive if port is 80 or 443
10971100
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
1098-
$content = str_replace('{vhost_port_listen}', '#', $content);
1101+
$tpl->setVar('vhost_port_listen','#');
10991102
} else {
1100-
$content = str_replace('{vhost_port_listen}', '', $content);
1103+
$tpl->setVar('vhost_port_listen','');
11011104
}
11021105

1103-
if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
1104-
$content = str_replace('{ssl_comment}', '', $content);
1106+
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
1107+
$tpl->setVar('ssl_comment','');
11051108
} else {
1106-
$content = str_replace('{ssl_comment}', '#', $content);
1109+
$tpl->setVar('ssl_comment','#');
11071110
}
11081111
if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key') && is_file($install_dir.'/interface/ssl/ispserver.bundle')) {
1109-
$content = str_replace('{ssl_bundle_comment}', '', $content);
1112+
$tpl->setVar('ssl_bundle_comment','');
11101113
} else {
1111-
$content = str_replace('{ssl_bundle_comment}', '#', $content);
1114+
$tpl->setVar('ssl_bundle_comment','#');
11121115
}
1116+
1117+
$tpl->setVar('apache_version',getapacheversion());
11131118

1114-
$content = str_replace('/var/www/', '/srv/www/', $content);
1115-
1116-
wf("$vhost_conf_dir/ispconfig.vhost", $content);
1119+
wf($vhost_conf_dir.'/ispconfig.vhost', $tpl->grab());
11171120

11181121
//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
11191122
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');

install/install.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
6666
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));
6767

68+
//** Include the templating lib
69+
require_once 'lib/classes/tpl.inc.php';
70+
6871
//** Check for existing installation
6972
/*if(is_dir("/usr/local/ispconfig")) {
7073
die('We will stop here. There is already a ISPConfig installation, use the update script to update this installation.');

0 commit comments

Comments
 (0)