Merge pull request #313 from Churro/froxlorMerge_8265df4

IPs and Ports: Only show attributes used by the current webserver
This commit is contained in:
Michael Kaufmann
2016-02-20 22:16:41 +01:00
5 changed files with 20 additions and 10 deletions

View File

@@ -29,6 +29,10 @@ if (isset($_POST['id'])) {
if ($page == 'ipsandports' if ($page == 'ipsandports'
|| $page == 'overview' || $page == 'overview'
) { ) {
// Do not display attributes that are not used by the current webserver
$websrv = Settings::Get('system.webserver');
$is_nginx = ($websrv == 'nginx');
$is_apache = ($websrv == 'apache2');
if ($action == '') { if ($action == '') {

View File

@@ -40,6 +40,7 @@ return array(
'image' => 'icons/ipsports_add.png', 'image' => 'icons/ipsports_add.png',
'fields' => array( 'fields' => array(
'listen_statement' => array( 'listen_statement' => array(
'visible' => !$is_nginx,
'label' => $lng['admin']['ipsandports']['create_listen_statement'], 'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(
@@ -48,6 +49,7 @@ return array(
'value' => array('1') 'value' => array('1')
), ),
'namevirtualhost_statement' => array( 'namevirtualhost_statement' => array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'], 'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(
@@ -77,6 +79,7 @@ return array(
'rows' => 12 'rows' => 12
), ),
'vhostcontainer_servername_statement' => array( 'vhostcontainer_servername_statement' => array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'], 'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(

View File

@@ -42,6 +42,7 @@ return array(
'image' => 'icons/ipsports_edit.png', 'image' => 'icons/ipsports_edit.png',
'fields' => array( 'fields' => array(
'listen_statement' => array( 'listen_statement' => array(
'visible' => !$is_nginx,
'label' => $lng['admin']['ipsandports']['create_listen_statement'], 'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(
@@ -50,6 +51,7 @@ return array(
'value' => array($result['listen_statement']) 'value' => array($result['listen_statement'])
), ),
'namevirtualhost_statement' => array( 'namevirtualhost_statement' => array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'], 'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(
@@ -81,6 +83,7 @@ return array(
'value' => $result['specialsettings'] 'value' => $result['specialsettings']
), ),
'vhostcontainer_servername_statement' => array( 'vhostcontainer_servername_statement' => array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'], 'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'values' => array( 'values' => array(

View File

@@ -26,11 +26,11 @@ $header
<tr> <tr>
<th>{$lng['admin']['ipsandports']['ip']}&nbsp;{$arrowcode['ip']}</th> <th>{$lng['admin']['ipsandports']['ip']}&nbsp;{$arrowcode['ip']}</th>
<th>{$lng['admin']['ipsandports']['port']}&nbsp;{$arrowcode['port']}</th> <th>{$lng['admin']['ipsandports']['port']}&nbsp;{$arrowcode['port']}</th>
<th>Listen</th> <if !$is_nginx><th>Listen</th></if>
<th>NameVirtualHost</th> <if $is_apache><th>NameVirtualHost</th></if>
<th>vHost-Container</th> <th>vHost-Container</th>
<th>Specialsettings</th> <th>Specialsettings</th>
<th>ServerName</th> <if $is_apache><th>ServerName</th></if>
<th>SSL</th> <th>SSL</th>
<th>{$lng['panel']['options']}</th> <th>{$lng['panel']['options']}</th>
</tr> </tr>
@@ -39,7 +39,7 @@ $header
<if $pagingcode != ''> <if $pagingcode != ''>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="8">{$pagingcode}</td> <td colspan="<if $is_apache>8<else>6</if>">{$pagingcode}</td>
</tr> </tr>
</tfoot> </tfoot>
</if> </if>

View File

@@ -1,11 +1,11 @@
<tr> <tr>
<td>{$row['ip']}</td> <td>{$row['ip']}</td>
<td>{$row['port']}</td> <td>{$row['port']}</td>
<td><if $row['listen_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <if !$is_nginx><td><if $row['listen_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td></if>
<td><if $row['namevirtualhost_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <if $is_apache><td><if $row['namevirtualhost_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td></if>
<td><if $row['vhostcontainer']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <td><if $row['vhostcontainer']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td>
<td><if $row['specialsettings']!=''>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <td><if $row['specialsettings']!=''>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td>
<td><if $row['vhostcontainer_servername_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <if $is_apache><td><if $row['vhostcontainer_servername_statement']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td></if>
<td><if $row['ssl']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td> <td><if $row['ssl']=='1'>{$lng['panel']['yes']}<else>{$lng['panel']['no']}</if></td>
<td> <td>
<a href="{$linker->getLink(array('section' => 'ipsandports', 'page' => $page, 'action' => 'edit', 'id' => $row['id']))}"> <a href="{$linker->getLink(array('section' => 'ipsandports', 'page' => $page, 'action' => 'edit', 'id' => $row['id']))}">