Rev 1259 | Rev 1293 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1259 | Rev 1261 | ||
---|---|---|---|
Line 77... | Line 77... | ||
77 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_6 |
77 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_6 |
78 | * @param OIDplusObject $objParent |
78 | * @param OIDplusObject $objParent |
79 | * @return string |
79 | * @return string |
80 | */ |
80 | */ |
81 | public function gridGeneratorLinks(OIDplusObject $objParent): string { |
81 | public function gridGeneratorLinks(OIDplusObject $objParent): string { |
- | 82 | if (!$objParent->isRoot()) return ''; |
|
82 | return |
83 | return |
83 | '<br>'._L('Generate a random AAI:'). |
84 | '<br>'._L('Generate a random AAI:'). |
84 | '<br>- Unicast <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(48, false)">(AAI-48)</a> | <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(64, false)">(AAI-64)</a>'. |
85 | '<br>- <abbr title="'._L('Random hexadecimal string, but second nibble must be %1','2').'">Unicast</abbr> <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(48, false)">(AAI-48)</a> | <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(64, false)">(AAI-64)</a>'. |
85 | '<br>- Multicast <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(48, true)">(AAI-48)</a> | <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(64, true)">(AAI-64)</a>'. |
86 | '<br>- <abbr title="'._L('Random hexadecimal string, but second nibble must be %1','3').'">Multicast</abbr> <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(48, true)">(AAI-48)</a> | <a href="javascript:OIDplusObjectTypePluginMac.generateRandomAAI(64, true)">(AAI-64)</a>'. |
86 | '<br><a href="https://standards.ieee.org/products-programs/regauth/" target="_blank">('._L('Buy an OUI or CID from IEEE').')</a>'; |
87 | '<br><a href="https://standards.ieee.org/products-programs/regauth/" target="_blank">('._L('Buy an OUI or CID from IEEE').')</a>'; |
87 | } |
88 | } |
88 | 89 | ||
89 | /** |
90 | /** |
90 | * @param string $static_node_id |
91 | * @param string $static_node_id |
91 | * @param bool $throw_exception |
92 | * @param bool $throw_exception |
92 | * @return string |
93 | * @return string |
93 | */ |
94 | */ |
94 | public static function prefilterQuery(string $static_node_id, bool $throw_exception): string { |
95 | public static function prefilterQuery(string $static_node_id, bool $throw_exception): string { |
- | 96 | $static_node_id = trim($static_node_id); |
|
- | 97 | ||
95 | $static_node_id = preg_replace('@^eui:@', 'mac:', $static_node_id); |
98 | $static_node_id = preg_replace('@^eui:@', 'mac:', $static_node_id); |
96 | $static_node_id = preg_replace('@^eli:@', 'mac:', $static_node_id); |
99 | $static_node_id = preg_replace('@^eli:@', 'mac:', $static_node_id); |
97 | 100 | ||
- | 101 | // Special treatment for MACs: if someone enters a valid MAC address in the goto box, prepend "mac:" |
|
98 | if (str_starts_with($static_node_id,'mac:')) { |
102 | if (((strpos($static_node_id, ':') !== false) || |
- | 103 | (strpos($static_node_id, '-') !== false) || |
|
- | 104 | (strpos($static_node_id, ' ') !== false)) && mac_valid($static_node_id)) { |
|
99 | $static_node_id = str_replace(' ', '', $static_node_id); |
105 | $static_node_id = 'mac:'.$static_node_id; |
100 | } |
106 | } |
101 | 107 | ||
102 | // Special treatment for OIDs: if someone enters a valid MAC address in the goto box, prepend "mac:" |
108 | if (str_starts_with($static_node_id,'mac:')) { |
103 | if (((strpos($static_node_id, ':') !== false) || (strpos($static_node_id, '-') !== false)) && mac_valid($static_node_id)) { |
109 | $static_node_id = 'mac:'.str_replace(array('-',':',' '), '', substr($static_node_id,4)); |
104 | $static_node_id = 'mac:'.$static_node_id; |
110 | $static_node_id = 'mac:'.strtoupper(substr($static_node_id,4)); |
105 | } |
111 | } |
106 | 112 | ||
107 | return $static_node_id; |
113 | return $static_node_id; |
108 | } |
114 | } |
109 | 115 |