Révision bd0bb466
Ajouté par Ermal il y a plus de 9 ans
usr/local/www/widgets/widgets/ipsec.widget.php | ||
---|---|---|
61 | 61 |
if ($ph2ent['remoteid']['type'] == "mobile") |
62 | 62 |
continue; |
63 | 63 |
ipsec_lookup_phase1($ph2ent,$ph1ent); |
64 |
$ipsecstatus = false; |
|
65 | 64 |
|
66 |
$tun_disabled = "false"; |
|
67 |
$foundsrc = false; |
|
68 |
$founddst = false; |
|
65 |
if (!isset($ph1ent['disabled']) && !isset($ph2ent['disabled'])) { |
|
69 | 66 |
|
70 |
if (isset($ph1ent['disabled']) || isset($ph2ent['disabled'])) { |
|
71 |
$tun_disabled = "true"; |
|
72 |
continue; |
|
73 |
} |
|
74 |
|
|
75 |
if (is_array($ipsec_status['query']) && |
|
76 |
is_array($ipsec_status['query']['ikesalist']) && |
|
77 |
is_array($ipsec_status['query']['ikesalist']['ikesa']) && |
|
78 |
ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) { |
|
79 |
/* tunnel is up */ |
|
80 |
$iconfn = "true"; |
|
81 |
$activecounter++; |
|
82 |
} else { |
|
83 |
/* tunnel is down */ |
|
84 |
$iconfn = "false"; |
|
85 |
$inactivecounter++; |
|
86 |
} |
|
67 |
if (is_array($ipsec_status['query']) && |
|
68 |
is_array($ipsec_status['query']['ikesalist']) && |
|
69 |
is_array($ipsec_status['query']['ikesalist']['ikesa']) && |
|
70 |
ipsec_phase1_status($ipsec_status['query']['ikesalist']['ikesa'], $ph1ent['ikeid'])) { |
|
71 |
/* tunnel is up */ |
|
72 |
$iconfn = "true"; |
|
73 |
$activecounter++; |
|
74 |
} else { |
|
75 |
/* tunnel is down */ |
|
76 |
$iconfn = "false"; |
|
77 |
$inactivecounter++; |
|
78 |
} |
|
87 | 79 |
|
88 |
$ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']), |
|
80 |
$ipsec_detail_array[] = array('src' => convert_friendly_interface_to_friendly_descr($ph1ent['interface']),
|
|
89 | 81 |
'dest' => $ph1ent['remote-gateway'], |
90 | 82 |
'remote-subnet' => ipsec_idinfo_to_text($ph2ent['remoteid']), |
91 | 83 |
'descr' => $ph2ent['descr'], |
92 |
'status' => $iconfn,
|
|
93 |
'disabled' => $tun_disabled);
|
|
84 |
'status' => $iconfn);
|
|
85 |
}
|
|
94 | 86 |
} |
95 | 87 |
} |
96 | 88 |
|
... | ... | |
122 | 114 |
<div class="widgetsubheader" style="display:table-cell;width:30px">Status</div> |
123 | 115 |
</div> |
124 | 116 |
<div style="max-height:105px;overflow:auto;"> |
125 |
<?php |
|
126 |
foreach ($ipsec_detail_array as $ipsec) : |
|
127 |
|
|
128 |
if ($ipsec['disabled'] == "true"){ |
|
129 |
$spans = "<span class=\"gray\">"; |
|
130 |
$spane = "</span>"; |
|
131 |
} |
|
132 |
else { |
|
133 |
$spans = $spane = ""; |
|
134 |
} |
|
135 |
|
|
136 |
?> |
|
137 | 117 |
|
118 |
<?php foreach ($ipsec_detail_array as $ipsec) : ?> |
|
119 |
|
|
138 | 120 |
<div style="display:table-row;"> |
139 | 121 |
<div class="listlr" style="display:table-cell;width:39px"> |
140 |
<?php echo $spans;?> |
|
141 |
<?php echo htmlspecialchars($ipsec['src']);?> |
|
142 |
<?php echo $spane;?> |
|
122 |
<?php echo htmlspecialchars($ipsec['src']);?> |
|
143 | 123 |
</div> |
144 |
<div class="listr" style="display:table-cell;width:100px"><?php echo $spans;?>
|
|
124 |
<div class="listr" style="display:table-cell;width:100px"> |
|
145 | 125 |
<?php echo $ipsec['remote-subnet'];?> |
146 | 126 |
<br /> |
147 |
(<?php echo htmlspecialchars($ipsec['dest']);?>)<?php echo $spane;?>
|
|
127 |
(<?php echo htmlspecialchars($ipsec['dest']);?>) |
|
148 | 128 |
</div> |
149 |
<div class="listr" style="display:table-cell;width:90px"><?php echo $spans;?><?php echo htmlspecialchars($ipsec['descr']);?><?php echo $spane;?></div>
|
|
150 |
<div class="listr" style="display:table-cell;width:37px" align="center"><?php echo $spans;?>
|
|
129 |
<div class="listr" style="display:table-cell;width:90px"></div> |
|
130 |
<div class="listr" style="display:table-cell;width:37px" align="center"> |
|
151 | 131 |
<?php |
152 | 132 |
|
153 | 133 |
if($ipsec['status'] == "true") { |
... | ... | |
159 | 139 |
} |
160 | 140 |
|
161 | 141 |
echo "<img src ='/themes/{$g['theme']}/images/icons/icon_{$iconfn}.gif' alt='Tunnel status' width='11' height='11' />"; |
162 |
|
|
163 |
?><?php echo $spane;?></div>
|
|
142 |
?> |
|
143 |
</div> |
|
164 | 144 |
</div> |
165 | 145 |
<?php endforeach; ?> |
166 | 146 |
</div> |
Formats disponibles : Unified diff
Do not display the disabled tunnels since they are not needed in the widget. Ticket #3955