Révision 1c4b1636
Ajouté par Renato Botelho il y a plus de 9 ans
usr/local/www/interfaces_assign.php | ||
---|---|---|
52 | 52 |
require("captiveportal.inc"); |
53 | 53 |
require_once("rrd.inc"); |
54 | 54 |
|
55 |
function interface_assign_description($portinfo, $portname) { |
|
56 |
if ($portinfo['isvlan']) { |
|
57 |
$descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']); |
|
58 |
if ($portinfo['descr']) |
|
59 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
60 |
} elseif ($portinfo['iswlclone']) { |
|
61 |
$descr = $portinfo['cloneif']; |
|
62 |
if ($portinfo['descr']) |
|
63 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
64 |
} elseif ($portinfo['isppp']) { |
|
65 |
$descr = $portinfo['descr']; |
|
66 |
} elseif ($portinfo['isbridge']) { |
|
67 |
$descr = strtoupper($portinfo['bridgeif']); |
|
68 |
if ($portinfo['descr']) |
|
69 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
70 |
} elseif ($portinfo['isgre']) { |
|
71 |
$descr = "GRE {$portinfo['remote-addr']}"; |
|
72 |
if ($portinfo['descr']) |
|
73 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
74 |
} elseif ($portinfo['isgif']) { |
|
75 |
$descr = "GIF {$portinfo['remote-addr']}"; |
|
76 |
if ($portinfo['descr']) |
|
77 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
78 |
} elseif ($portinfo['islagg']) { |
|
79 |
$descr = strtoupper($portinfo['laggif']); |
|
80 |
if ($portinfo['descr']) |
|
81 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
82 |
} elseif ($portinfo['isqinq']) { |
|
83 |
$descr = $portinfo['descr']; |
|
84 |
} elseif (substr($portname, 0, 4) == 'ovpn') { |
|
85 |
$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")"; |
|
86 |
} else |
|
87 |
$descr = $portname . " (" . $portinfo['mac'] . ")"; |
|
88 |
|
|
89 |
return htmlspecialchars($descr); |
|
90 |
} |
|
91 |
|
|
55 | 92 |
/* |
56 | 93 |
In this file, "port" refers to the physical port name, |
57 | 94 |
while "interface" refers to LAN, WAN, or OPTn. |
... | ... | |
445 | 482 |
foreach ($portlist as $portname => $portinfo): |
446 | 483 |
?> |
447 | 484 |
<option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>> |
448 |
<?php |
|
449 |
if ($portinfo['isvlan']) { |
|
450 |
$descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']); |
|
451 |
if ($portinfo['descr']) |
|
452 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
453 |
echo htmlspecialchars($descr); |
|
454 |
} elseif ($portinfo['iswlclone']) { |
|
455 |
$descr = $portinfo['cloneif']; |
|
456 |
if ($portinfo['descr']) |
|
457 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
458 |
echo htmlspecialchars($descr); |
|
459 |
} elseif ($portinfo['isppp']) { |
|
460 |
echo htmlspecialchars($portinfo['descr']); |
|
461 |
} elseif ($portinfo['isbridge']) { |
|
462 |
$descr = strtoupper($portinfo['bridgeif']); |
|
463 |
if ($portinfo['descr']) |
|
464 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
465 |
echo htmlspecialchars($descr); |
|
466 |
} elseif ($portinfo['isgre']) { |
|
467 |
$descr = "GRE {$portinfo['remote-addr']}"; |
|
468 |
if ($portinfo['descr']) |
|
469 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
470 |
echo htmlspecialchars($descr); |
|
471 |
} elseif ($portinfo['isgif']) { |
|
472 |
$descr = "GIF {$portinfo['remote-addr']}"; |
|
473 |
if ($portinfo['descr']) |
|
474 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
475 |
echo htmlspecialchars($descr); |
|
476 |
} elseif ($portinfo['islagg']) { |
|
477 |
$descr = strtoupper($portinfo['laggif']); |
|
478 |
if ($portinfo['descr']) |
|
479 |
$descr .= " (" . $portinfo['descr'] . ")"; |
|
480 |
echo htmlspecialchars($descr); |
|
481 |
} elseif ($portinfo['isqinq']) { |
|
482 |
echo htmlspecialchars($portinfo['descr']); |
|
483 |
} elseif (substr($portname, 0, 4) == 'ovpn') { |
|
484 |
echo htmlspecialchars($portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")"); |
|
485 |
} else |
|
486 |
echo htmlspecialchars($portname . " (" . $portinfo['mac'] . ")"); |
|
487 |
?> |
|
485 |
<?=interface_assign_description($portinfo, $portname);?> |
|
488 | 486 |
</option> |
489 | 487 |
<?php |
490 | 488 |
endforeach; |
Formats disponibles : Unified diff
Convert this block into a function for later use