Rev 450 | 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 |
||
511 | daniel-mar | 5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
61 | daniel-mar | 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 | |||
511 | daniel-mar | 20 | if (!defined('INSIDE_OIDPLUS')) die(); |
21 | |||
256 | daniel-mar | 22 | class OIDplusPageAdminWellKnownOIDs extends OIDplusPagePluginAdmin { |
23 | |||
75 | daniel-mar | 24 | public function init($html=true) { |
61 | daniel-mar | 25 | // Nothing |
26 | } |
||
27 | |||
28 | public function gui($id, &$out, &$handled) { |
||
29 | if ($id === 'oidplus:well_known_oids') { |
||
30 | $handled = true; |
||
360 | daniel-mar | 31 | $out['title'] = _L('Well known OIDs'); |
241 | daniel-mar | 32 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
61 | daniel-mar | 33 | |
34 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
||
35 | $out['icon'] = 'img/error_big.png'; |
||
360 | daniel-mar | 36 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>'; |
281 | daniel-mar | 37 | return; |
38 | } |
||
61 | daniel-mar | 39 | |
416 | daniel-mar | 40 | $out['text'] = ''; |
61 | daniel-mar | 41 | |
416 | daniel-mar | 42 | $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>'; |
43 | $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>'; |
||
44 | $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>'; |
||
45 | // $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>'; |
||
46 | $out['text'] .= '</ol></p>'; |
||
47 | |||
48 | $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>'; |
||
49 | |||
281 | daniel-mar | 50 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
51 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
52 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 53 | $out['text'] .= ' <th>'._L('OID').'</th>'; |
54 | $out['text'] .= ' <th>'._L('ASN.1 identifiers (comma sep.)').'</th>'; |
||
55 | $out['text'] .= ' <th>'._L('IRI identifiers (comma sep.)').'</th>'; |
||
281 | daniel-mar | 56 | $out['text'] .= ' </tr>'; |
61 | daniel-mar | 57 | |
450 | daniel-mar | 58 | /* |
443 | daniel-mar | 59 | $res = OIDplus::db()->query("select a.oid from (". |
60 | "select oid from ###asn1id where well_known = ? union ". |
||
61 | "select oid from ###iri where well_known = ?) a ". |
||
450 | daniel-mar | 62 | "order by ".OIDplus::db()->natOrder('oid'), array(true, true)); // <-- This prepared statement does not work in SQL-Server! |
63 | */ |
||
64 | $res = OIDplus::db()->query("select a.oid from (". |
||
65 | "select oid, well_known from ###asn1id union ". |
||
66 | "select oid, well_known from ###iri) a ". |
||
67 | "where a.well_known = ? ". |
||
68 | "order by ".OIDplus::db()->natOrder('oid'), array(true)); // <-- This works |
||
281 | daniel-mar | 69 | while ($row = $res->fetch_array()) { |
70 | $asn1ids = array(); |
||
71 | $res2 = OIDplus::db()->query("select name, standardized from ###asn1id where oid = ?", array($row['oid'])); |
||
72 | while ($row2 = $res2->fetch_array()) { |
||
360 | daniel-mar | 73 | $asn1ids[] = $row2['name'].($row2['standardized'] ? ' ('._L('standardized').')' : ''); |
281 | daniel-mar | 74 | } |
61 | daniel-mar | 75 | |
281 | daniel-mar | 76 | $iris = array(); |
77 | $res2 = OIDplus::db()->query("select name, longarc from ###iri where oid = ?", array($row['oid'])); |
||
78 | while ($row2 = $res2->fetch_array()) { |
||
360 | daniel-mar | 79 | $iris[] = $row2['name'].($row2['longarc'] ? ' ('._L('long arc').')' : ''); |
61 | daniel-mar | 80 | } |
81 | |||
281 | daniel-mar | 82 | $out['text'] .= '<tr>'; |
83 | $out['text'] .= ' <td>'.htmlentities(explode(':',$row['oid'])[1]).'</td>'; |
||
84 | $out['text'] .= ' <td>'.htmlentities(implode(', ', $asn1ids)).'</td>'; |
||
85 | $out['text'] .= ' <td>'.htmlentities(implode(', ', $iris)).'</td>'; |
||
86 | $out['text'] .= '</tr>'; |
||
61 | daniel-mar | 87 | } |
281 | daniel-mar | 88 | |
89 | $out['text'] .= '</table>'; |
||
90 | $out['text'] .= '</div></div>'; |
||
61 | daniel-mar | 91 | } |
92 | } |
||
93 | |||
106 | daniel-mar | 94 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
281 | daniel-mar | 95 | if (!OIDplus::authUtils()::isAdminLoggedIn()) return false; |
360 | daniel-mar | 96 | |
61 | daniel-mar | 97 | if (file_exists(__DIR__.'/treeicon.png')) { |
241 | daniel-mar | 98 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
61 | daniel-mar | 99 | } else { |
100 | $tree_icon = null; // default icon (folder) |
||
101 | } |
||
102 | |||
103 | $json[] = array( |
||
104 | 'id' => 'oidplus:well_known_oids', |
||
105 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 106 | 'text' => _L('Well known OIDs') |
61 | daniel-mar | 107 | ); |
104 | daniel-mar | 108 | |
109 | return true; |
||
61 | daniel-mar | 110 | } |
108 | daniel-mar | 111 | |
112 | public function tree_search($request) { |
||
113 | return false; |
||
114 | } |
||
416 | daniel-mar | 115 | } |