Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc4e3fb

Browse files
committed
[BF] potential fix for lg undefined variable
1 parent bafca2d commit cc4e3fb

1 file changed

Lines changed: 127 additions & 125 deletions

File tree

resources/views/services/lg/route.foil.php

Lines changed: 127 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -10,168 +10,170 @@
1010
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
1111
</div>
1212
<div class="modal-body">
13-
<?php foreach( $t->content->routes as $r ): ?>
14-
<table class="table table-striped text-monospace" style="font-size: 14px;">
15-
<tbody>
16-
<tr>
17-
<td>
18-
<b>Network</b>
19-
</td>
20-
<td>
21-
<?= $r->network ?>
22-
</td>
23-
</tr>
24-
<tr>
25-
<td>
26-
<b>Gateway</b>
27-
</td>
28-
<td>
29-
<?= $r->gateway ?>
30-
&nbsp;&nbsp;
31-
<?php if( $r->primary ): ?>
32-
<span class="badge badge-success">
33-
PRIMARY
34-
</span>
35-
<?php else: ?>
36-
<span class="badge badge-warning">
37-
NOT PRIMARY
38-
</span>
39-
<?php endif; ?>
40-
</td>
41-
</tr>
42-
<tr>
43-
<td>
44-
<b>From Protocol</b>
45-
</td>
46-
<td>
47-
<?= $r->from_protocol ?>
48-
</td>
49-
</tr>
50-
<tr>
51-
<td>
52-
<b>Age</b>
53-
</td>
54-
<td>
55-
<?= isset( $r->age ) && $r->age ? date( "Y-m-d H:i:s", strtotime( $r->age ) ) : '' ?>
56-
</td>
57-
</tr>
58-
<tr>
59-
<td>
60-
<b>Metric</b>
61-
</td>
62-
<td>
63-
<?= $r->metric ?>
64-
</td>
65-
</tr>
66-
<tr>
67-
<td>
68-
<b>Type</b>
69-
</td>
70-
<td>
71-
<?= implode( ' ', $r->type ) ?>
72-
</td>
73-
</tr>
74-
<?php if (isset( $r->bgp->as_path )): ?>
13+
<?php if( isset( $t->content->routes ) ): ?>
14+
<?php foreach( $t->content->routes as $r ): ?>
15+
<table class="table table-striped text-monospace" style="font-size: 14px;">
16+
<tbody>
7517
<tr>
7618
<td>
77-
<b>BGP :: AS Path</b>
19+
<b>Network</b>
7820
</td>
7921
<td>
80-
<?= implode( ' ', $r->bgp->as_path ) ?>
22+
<?= $r->network ?>
8123
</td>
8224
</tr>
83-
<?php endif; ?>
84-
<?php if (isset( $r->bgp->next_hop )): ?>
8525
<tr>
8626
<td>
87-
<b>BGP :: Next Hop</b>
27+
<b>Gateway</b>
8828
</td>
8929
<td>
90-
<?= $r->bgp->next_hop ?>
30+
<?= $r->gateway ?>
31+
&nbsp;&nbsp;
32+
<?php if( $r->primary ): ?>
33+
<span class="badge badge-success">
34+
PRIMARY
35+
</span>
36+
<?php else: ?>
37+
<span class="badge badge-warning">
38+
NOT PRIMARY
39+
</span>
40+
<?php endif; ?>
9141
</td>
9242
</tr>
93-
<?php endif; ?>
94-
<?php if (isset( $r->bgp->med )): ?>
9543
<tr>
9644
<td>
97-
<b>BGP :: MED</b>
45+
<b>From Protocol</b>
9846
</td>
9947
<td>
100-
<?= $r->bgp->med ?>
48+
<?= $r->from_protocol ?>
10149
</td>
10250
</tr>
103-
<?php endif; ?>
104-
<?php if (isset( $r->bgp->local_pref )): ?>
10551
<tr>
10652
<td>
107-
<b>BGP :: Local Pref</b>
53+
<b>Age</b>
10854
</td>
10955
<td>
110-
<?= $r->bgp->local_pref ?>
56+
<?= isset( $r->age ) && $r->age ? date( "Y-m-d H:i:s", strtotime( $r->age ) ) : '' ?>
11157
</td>
11258
</tr>
113-
<?php endif; ?>
114-
<?php if (isset( $r->bgp->atomic_aggr )): ?>
11559
<tr>
11660
<td>
117-
<b>BGP :: Atomic Aggr</b>
61+
<b>Metric</b>
11862
</td>
11963
<td>
120-
<?= $r->bgp->atomic_aggr ?>
64+
<?= $r->metric ?>
12165
</td>
12266
</tr>
123-
<?php endif; ?>
124-
<?php if (isset( $r->bgp->aggregator )): ?>
12567
<tr>
12668
<td>
127-
<b>BGP :: Aggregator</b>
69+
<b>Type</b>
12870
</td>
12971
<td>
130-
<?= $r->bgp->aggregator ?>
72+
<?= implode( ' ', $r->type ) ?>
13173
</td>
13274
</tr>
133-
<?php endif; ?>
134-
<?php if (isset( $r->bgp->communities )): ?>
135-
<tr>
136-
<td>
137-
<b>BGP :: Communities</b>
138-
</td>
139-
<td>
140-
<?php foreach( $r->bgp->communities as $c ): ?>
141-
<tt><?= implode(':',$c) ?></tt>
142-
143-
<?php if( $cinfo = $t->bird()->translateBgpCommunity( implode(':',$c) ) ): ?>
144-
<span class="badge badge-<?= $cinfo[1] ?>"><?= $cinfo[0] ?></span>
145-
<?php endif; ?>
146-
<br>
147-
<?php endforeach; ?>
148-
</td>
149-
</tr>
150-
<?php endif; ?>
151-
<?php if (isset( $r->bgp->large_communities )): ?>
152-
<tr>
153-
<td>
154-
<b>BGP :: Large Communities</b>
155-
</td>
156-
<td>
157-
<?php foreach( $r->bgp->large_communities as $c ): ?>
158-
<tt><?= implode(':',$c) ?></tt>
159-
160-
<?php if( $t->lg->router()->asn === $c[0] ): ?>
161-
<?php if( $lcinfo = $t->bird()->translateBgpFilteringLargeCommunity( ':' . $c[1] . ':' . $c[2] ) ): ?>
162-
<span class="badge badge-<?= $lcinfo[1] ?>"><?= $lcinfo[0] ?></span>
75+
<?php if (isset( $r->bgp->as_path )): ?>
76+
<tr>
77+
<td>
78+
<b>BGP :: AS Path</b>
79+
</td>
80+
<td>
81+
<?= implode( ' ', $r->bgp->as_path ) ?>
82+
</td>
83+
</tr>
84+
<?php endif; ?>
85+
<?php if (isset( $r->bgp->next_hop )): ?>
86+
<tr>
87+
<td>
88+
<b>BGP :: Next Hop</b>
89+
</td>
90+
<td>
91+
<?= $r->bgp->next_hop ?>
92+
</td>
93+
</tr>
94+
<?php endif; ?>
95+
<?php if (isset( $r->bgp->med )): ?>
96+
<tr>
97+
<td>
98+
<b>BGP :: MED</b>
99+
</td>
100+
<td>
101+
<?= $r->bgp->med ?>
102+
</td>
103+
</tr>
104+
<?php endif; ?>
105+
<?php if (isset( $r->bgp->local_pref )): ?>
106+
<tr>
107+
<td>
108+
<b>BGP :: Local Pref</b>
109+
</td>
110+
<td>
111+
<?= $r->bgp->local_pref ?>
112+
</td>
113+
</tr>
114+
<?php endif; ?>
115+
<?php if (isset( $r->bgp->atomic_aggr )): ?>
116+
<tr>
117+
<td>
118+
<b>BGP :: Atomic Aggr</b>
119+
</td>
120+
<td>
121+
<?= $r->bgp->atomic_aggr ?>
122+
</td>
123+
</tr>
124+
<?php endif; ?>
125+
<?php if (isset( $r->bgp->aggregator )): ?>
126+
<tr>
127+
<td>
128+
<b>BGP :: Aggregator</b>
129+
</td>
130+
<td>
131+
<?= $r->bgp->aggregator ?>
132+
</td>
133+
</tr>
134+
<?php endif; ?>
135+
<?php if (isset( $r->bgp->communities )): ?>
136+
<tr>
137+
<td>
138+
<b>BGP :: Communities</b>
139+
</td>
140+
<td>
141+
<?php foreach( $r->bgp->communities as $c ): ?>
142+
<tt><?= implode(':',$c) ?></tt>
143+
144+
<?php if( $cinfo = $t->bird()->translateBgpCommunity( implode(':',$c) ) ): ?>
145+
<span class="badge badge-<?= $cinfo[1] ?>"><?= $cinfo[0] ?></span>
163146
<?php endif; ?>
164-
<?php endif; ?>
165-
166-
<br>
167-
<?php endforeach; ?>
168-
</td>
169-
</tr>
170-
<?php endif; ?>
171-
</tbody>
172-
</table>
173-
<br><br>
174-
<?php endforeach; ?>
147+
<br>
148+
<?php endforeach; ?>
149+
</td>
150+
</tr>
151+
<?php endif; ?>
152+
<?php if (isset( $r->bgp->large_communities )): ?>
153+
<tr>
154+
<td>
155+
<b>BGP :: Large Communities</b>
156+
</td>
157+
<td>
158+
<?php foreach( $r->bgp->large_communities as $c ): ?>
159+
<tt><?= implode(':',$c) ?></tt>
160+
161+
<?php if( $t->lg->router()->asn === $c[0] ): ?>
162+
<?php if( $lcinfo = $t->bird()->translateBgpFilteringLargeCommunity( ':' . $c[1] . ':' . $c[2] ) ): ?>
163+
<span class="badge badge-<?= $lcinfo[1] ?>"><?= $lcinfo[0] ?></span>
164+
<?php endif; ?>
165+
<?php endif; ?>
166+
167+
<br>
168+
<?php endforeach; ?>
169+
</td>
170+
</tr>
171+
<?php endif; ?>
172+
</tbody>
173+
</table>
174+
<br><br>
175+
<?php endforeach; ?>
176+
<?php endif; ?>
175177
</div>
176178
<div class="modal-footer">
177179
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>

0 commit comments

Comments
 (0)