From a2156eb5923b4065d29ad164baa038238091cd49 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Wed, 21 Sep 2011 08:28:18 -0400 Subject: [PATCH] Added new namevirtualhost port functions to the installer and apache plugin. --- server/plugins-available/apache2_plugin.inc.php | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 092ba63..2f641b1 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1181,9 +1181,30 @@ $tpl = new tpl(); $tpl->newTemplate('apache_ispconfig.conf.master'); $records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'"); - - if(count($records) > 0) { - $tpl->setLoop('ip_adresses',$records); + + $records_out= array(); + if(is_array($records)) { + foreach($records as $rec) { + if($rec['ip_type'] == 'IPv6') { + $ip_address = '['.$rec['ip_address'].']'; + } else { + $ip_address = $rec['ip_address']; + } + $ports = explode(',',$rec['virtualhost_port']); + if(is_array($ports)) { + foreach($ports as $port) { + $port = intval($port); + if($port > 0 && $port < 65536 && $ip_address != '') { + $records_out[] = array('ip_address' => $ip_address, 'port' => $port); + } + } + } + } + } + + + if(count($records_out) > 0) { + $tpl->setLoop('ip_adresses',$records_out); } $vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf'); -- Gitblit v1.9.1