Rev 443 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
61 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
256 | daniel-mar | 20 | class OIDplusPageAdminWellKnownOIDs extends OIDplusPagePluginAdmin { |
21 | |||
75 | daniel-mar | 22 | public function init($html=true) { |
61 | daniel-mar | 23 | // Nothing |
24 | } |
||
25 | |||
26 | public function gui($id, &$out, &$handled) { |
||
27 | if ($id === 'oidplus:well_known_oids') { |
||
28 | $handled = true; |
||
360 | daniel-mar | 29 | $out['title'] = _L('Well known OIDs'); |
241 | daniel-mar | 30 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
61 | daniel-mar | 31 | |
32 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
||
33 | $out['icon'] = 'img/error_big.png'; |
||
360 | daniel-mar | 34 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>'; |
281 | daniel-mar | 35 | return; |
36 | } |
||
61 | daniel-mar | 37 | |
416 | daniel-mar | 38 | $out['text'] = ''; |
61 | daniel-mar | 39 | |
416 | daniel-mar | 40 | $out['text'] .= '<p>'._L('Well-known OIDs are OIDs of Registration Authorities which are assigning OIDs to customers, i.e. they are most likely to be used by OIDplus users as their root OID. Well-known OIDs have the following purposes:').'<ol>'; |
41 | $out['text'] .= '<li>'._L('When a new OIDplus user creates his root OID into OIDplus, then the ASN.1 identifiers and Unicode labels of the superior OIDs are automatically added.').'</li>'; |
||
42 | $out['text'] .= '<li>'._L('In the automatic oid-info.com publishing, well-known OIDs will not be transmitted (because it is unlikely that RAs of well-known OIDs will be using OIDplus in combination with automatic publishing to oid-info.com). Instead, all children inside these well-known OIDs are most likely to be yours, so these will be reported to oid-info.com instead.').'</li>'; |
||
43 | // $out['text'] .= '<li>'._L('In OID-WHOIS, if a user requests information about an unknown OID which is inside a well-known OID, then OID-WHOIS will output information at which place more information can be retrieved from.').'</li>'; |
||
44 | $out['text'] .= '</ol></p>'; |
||
45 | |||
46 | $out['text'] .= '<p><abbr title="'._L('These ID names can only be edited in the database directly (Tables ###asn1id and ###iri). Usually, there is no need to do this, though.').'">'._L('How to edit these IDs?').'</abbr></p>'; |
||
47 | |||
281 | daniel-mar | 48 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
49 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
50 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 51 | $out['text'] .= ' <th>'._L('OID').'</th>'; |
52 | $out['text'] .= ' <th>'._L('ASN.1 identifiers (comma sep.)').'</th>'; |
||
53 | $out['text'] .= ' <th>'._L('IRI identifiers (comma sep.)').'</th>'; |
||
281 | daniel-mar | 54 | $out['text'] .= ' </tr>'; |
61 | daniel-mar | 55 | |
450 | daniel-mar | 56 | /* |
443 | daniel-mar | 57 | $res = OIDplus::db()->query("select a.oid from (". |
58 | "select oid from ###asn1id where well_known = ? union ". |
||
59 | "select oid from ###iri where well_known = ?) a ". |
||
450 | daniel-mar | 60 | "order by ".OIDplus::db()->natOrder('oid'), array(true, true)); // <-- This prepared statement does not work in SQL-Server! |
61 | */ |
||
62 | $res = OIDplus::db()->query("select a.oid from (". |
||
63 | "select oid, well_known from ###asn1id union ". |
||
64 | "select oid, well_known from ###iri) a ". |
||
65 | "where a.well_known = ? ". |
||
66 | "order by ".OIDplus::db()->natOrder('oid'), array(true)); // <-- This works |
||
281 | daniel-mar | 67 | while ($row = $res->fetch_array()) { |
68 | $asn1ids = array(); |
||
69 | $res2 = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ?", array($row['oid'])); |
||
70 | while ($row2 = $res2->fetch_array()) { |
||
360 | daniel-mar | 71 | $asn1ids[] = $row2['name'].($row2['standardized'] ? ' ('._L('standardized').')' : ''); |
281 | daniel-mar | 72 | } |
61 | daniel-mar | 73 | |
281 | daniel-mar | 74 | $iris = array(); |
75 | $res2 = OIDplus::db()->query("select name, longarc from ###iri where oid = ?", array($row['oid'])); |
||
76 | while ($row2 = $res2->fetch_array()) { |
||
360 | daniel-mar | 77 | $iris[] = $row2['name'].($row2['longarc'] ? ' ('._L('long arc').')' : ''); |
61 | daniel-mar | 78 | } |
79 | |||
281 | daniel-mar | 80 | $out['text'] .= '<tr>'; |
81 | $out['text'] .= ' <td>'.htmlentities(explode(':',$row['oid'])[1]).'</td>'; |
||
82 | $out['text'] .= ' <td>'.htmlentities(implode(', ', $asn1ids)).'</td>'; |
||
83 | $out['text'] .= ' <td>'.htmlentities(implode(', ', $iris)).'</td>'; |
||
84 | $out['text'] .= '</tr>'; |
||
61 | daniel-mar | 85 | } |
281 | daniel-mar | 86 | |
87 | $out['text'] .= '</table>'; |
||
88 | $out['text'] .= '</div></div>'; |
||
61 | daniel-mar | 89 | } |
90 | } |
||
91 | |||
106 | daniel-mar | 92 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
281 | daniel-mar | 93 | if (!OIDplus::authUtils()::isAdminLoggedIn()) return false; |
360 | daniel-mar | 94 | |
61 | daniel-mar | 95 | if (file_exists(__DIR__.'/treeicon.png')) { |
241 | daniel-mar | 96 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
61 | daniel-mar | 97 | } else { |
98 | $tree_icon = null; // default icon (folder) |
||
99 | } |
||
100 | |||
101 | $json[] = array( |
||
102 | 'id' => 'oidplus:well_known_oids', |
||
103 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 104 | 'text' => _L('Well known OIDs') |
61 | daniel-mar | 105 | ); |
104 | daniel-mar | 106 | |
107 | return true; |
||
61 | daniel-mar | 108 | } |
108 | daniel-mar | 109 | |
110 | public function tree_search($request) { |
||
111 | return false; |
||
112 | } |
||
416 | daniel-mar | 113 | } |